Skip to content
This repository has been archived by the owner on Apr 20, 2023. It is now read-only.

Add results directory arg to dotnet test #5391

Merged
merged 2 commits into from
Jan 21, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/dotnet/commands/dotnet-test/LocalizableStrings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,7 @@ internal class LocalizableStrings

public const string RunSettingsArgsHelpText = @"Any extra commandline runsettings arguments that should be passed to vstest. See 'dotnet vstest --help' for available options.
Example: -- RunConfiguration.ResultsDirectory=""C:\users\user\desktop\Results Directory"" MSTest.DeploymentEnabled=false";
public const string CmdResultsDirectoryDescription = @"Test results directory will be created in specified path if not exists.
Example: --results-directory <PATH_TO_RESULTS_DIRECTORY>";

This comment was marked as spam.

}
}
10 changes: 10 additions & 0 deletions src/dotnet/commands/dotnet-test/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,11 @@ public static int Run(string[] args)
LocalizableStrings.CmdNoBuildDescription,
CommandOptionType.NoValue);

var resultsDirectoryOption = cmd.Option(
"-r|--results-directory",
LocalizableStrings.CmdResultsDirectoryDescription,
CommandOptionType.SingleValue);

CommandOption verbosityOption = MSBuildForwardingApp.AddVerbosityOption(cmd);

cmd.OnExecute(() =>
Expand Down Expand Up @@ -129,6 +134,11 @@ public static int Run(string[] args)
msbuildArgs.Add($"/p:TargetFramework={frameworkOption.Value()}");
}

if (resultsDirectoryOption.HasValue())
{
msbuildArgs.Add($"/p:VSTestResultsDirectory={resultsDirectoryOption.Value()}");
}

if (outputOption.HasValue())
{
msbuildArgs.Add($"/p:OutputPath={outputOption.Value()}");
Expand Down