From 44b14f987ef4f2c629535c686f2a611226941381 Mon Sep 17 00:00:00 2001 From: Satya Madala Date: Thu, 19 Jan 2017 11:27:37 +0530 Subject: [PATCH] Add results directory arg to dotnet test --- src/dotnet/commands/dotnet-test/LocalizableStrings.cs | 2 ++ src/dotnet/commands/dotnet-test/Program.cs | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/src/dotnet/commands/dotnet-test/LocalizableStrings.cs b/src/dotnet/commands/dotnet-test/LocalizableStrings.cs index 0f69a5cc82..af567dcebb 100644 --- a/src/dotnet/commands/dotnet-test/LocalizableStrings.cs +++ b/src/dotnet/commands/dotnet-test/LocalizableStrings.cs @@ -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 "; } } diff --git a/src/dotnet/commands/dotnet-test/Program.cs b/src/dotnet/commands/dotnet-test/Program.cs index 89d0c35954..26a57f4944 100644 --- a/src/dotnet/commands/dotnet-test/Program.cs +++ b/src/dotnet/commands/dotnet-test/Program.cs @@ -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(() => @@ -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()}");