Skip to content

Conversation

@clmcgrath
Copy link

This pull request adds support for dynamic template replacement in TRX log file names and prefixes. Users can now use placeholders such as {assembly}, {framework}, {date}, {time}, {machine}, {user}, and {configuration} in the log file name or prefix parameters, and these will be replaced with the corresponding runtime values. The implementation includes robust, case-insensitive replacement logic and comprehensive unit tests to verify correct behavior for all supported templates, including handling of missing values and multiple templates.

Template Replacement Feature:

  • Added new private fields (_assemblyName, _targetFramework, _configuration) to TrxLogger to capture values for template replacement.
  • Implemented the ProcessTemplateReplacements method in TrxLogger to perform case-insensitive, multi-template replacement in log file name and prefix patterns.
  • Updated logic in TestResultHandler and AcquireTrxFileNamePath to capture assembly name, target framework, and configuration for use in template replacement, and applied template processing to log file name and prefix parameters. [1] [2]
  • Defined constants for all supported template placeholders in TrxLoggerConstants (Constants.cs).

Testing and Validation:

  • Added extensive unit tests to TrxLoggerTests.cs to verify template replacement for all supported placeholders, case insensitivity, handling of unknown values, and correct behavior with multiple templates in both log file name and prefix.…machine, user, and configuration in TrxLogger file naming

Description

Please add a meaningful description for this change.
Ensure the PR has required unit tests.

Related issue

Kindly link any related issues. E.g. Fixes #xyz.

  • I have ensured that there is a previously discussed and approved issue.

@clmcgrath
Copy link
Author

@microsoft-github-policy-service agree

@nohwnd
Copy link
Member

nohwnd commented Dec 1, 2025

reason for close:

Hello, at the moment we don't take any new features into vstest, we are focusing on Microsoft.testing.platform.

This however is a feature I'd like and there is similar proposal on microsoft.testing.platform, and a draft PR generated via copilot, but I did not get anywhere further.

If you like to take that on and implement it that would be very useful. microsoft/testfx#6586

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants