-
Notifications
You must be signed in to change notification settings - Fork 352
Add target framework to default TRX file name #15565
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
3890e60
72a20c2
46fe387
55c6505
34f22ea
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -630,6 +630,49 @@ public void DefaultTrxFileShouldCreateIfLogFileNameParameterNotPassed() | |||||||
| Assert.IsFalse(string.IsNullOrWhiteSpace(_testableTrxLogger.TrxFile)); | ||||||||
| } | ||||||||
|
|
||||||||
| [TestMethod] | ||||||||
| public void DefaultTrxFileNameShouldIncludeFrameworkWhenAvailable() | ||||||||
| { | ||||||||
| _parameters.Remove(TrxLoggerConstants.LogFileNameKey); | ||||||||
| _parameters[DefaultLoggerParameterNames.TargetFramework] = ".NETCoreApp,Version=v10.0"; | ||||||||
| _testableTrxLogger.Initialize(_events.Object, _parameters); | ||||||||
|
|
||||||||
| MakeTestRunComplete(); | ||||||||
|
|
||||||||
| var fileName = Path.GetFileName(_testableTrxLogger.TrxFile); | ||||||||
| Assert.IsNotNull(fileName); | ||||||||
| Assert.Contains("_net10.0", fileName, $"Expected TFM 'net10.0' in filename but got: {fileName}"); | ||||||||
| Assert.EndsWith(".trx", fileName, $"Expected .trx extension but got: {fileName}"); | ||||||||
| } | ||||||||
|
|
||||||||
| [TestMethod] | ||||||||
| public void DefaultTrxFileNameShouldWorkWithoutFramework() | ||||||||
| { | ||||||||
| _parameters.Remove(TrxLoggerConstants.LogFileNameKey); | ||||||||
|
||||||||
| _parameters.Remove(TrxLoggerConstants.LogFileNameKey); | |
| _parameters.Remove(TrxLoggerConstants.LogFileNameKey); | |
| _parameters.Remove(DefaultLoggerParameterNames.TargetFramework); |
Copilot
AI
Mar 24, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
New behavior uses the raw TargetFramework string when parsing fails, but there’s no test coverage for raw values containing characters that are invalid in filenames or path separators (e.g., Some/Framework, ..\\x, net10.0:custom). Adding a unit test for sanitization (or expected failure behavior) would prevent regressions and validate safe filename handling.
Uh oh!
There was an error while loading. Please reload this page.