Skip to content

Conversation

@vagisha-nidhi
Copy link
Contributor

Description

RFC: microsoft/vstest-docs#204

Adding LogFilePrefix parameter to specify trx name prefix.
When this parameter is specified as dotnet test --logger:"trx;LogFilePrefix=results", the prefix will be appended with target framework and timestamp generating a unique trx file for every target.
Example: E:\TestResults\results_net451_2018_12-24_14-01-07-176.trx

Timestamp is appended with milli seconds precision.

Related issue

#1603

{
var isLogFileNameParameterExists = this.parametersDictionary.TryGetValue(TrxLoggerConstants.LogFileNameKey, out string logFileNameValue);
if (isLogFileNameParameterExists && !string.IsNullOrWhiteSpace(logFileNameValue))
var isLogFilePrefixParameterExists = this.parametersDictionary.TryGetValue(TrxLoggerConstants.LogFilePrefixKey, out string logFilePrefixValue);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can someone give both logFilePrefix and LogFileName ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We will throw in logger initialize in such case

{
this.trxFilePath = Path.Combine(this.testResultsDirPath, logFileNameValue);
var framework = this.parametersDictionary[DefaultLoggerParameterNames.TargetFramework] ?? string.Empty;
framework = NuGetFramework.Parse(framework).GetShortFolderName();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can this cause invalid chars in file path?

Copy link
Contributor

@mayankbansal018 mayankbansal018 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🕐

Copy link
Contributor

@mayankbansal018 mayankbansal018 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

@vagisha-nidhi vagisha-nidhi merged commit 32a75bd into microsoft:master Sep 11, 2019
@singhsarab
Copy link
Contributor

@vagisha-nidhi @hvinett We will need this for the html logger as well, Can you guys sync up on this.

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.

3 participants