Skip to content

Commit

Permalink
Support --project in dotnet test (#43276)
Browse files Browse the repository at this point in the history
  • Loading branch information
mariam-abdulla committed Sep 9, 2024
1 parent 8d10b56 commit da0203c
Show file tree
Hide file tree
Showing 18 changed files with 90 additions and 15 deletions.
3 changes: 3 additions & 0 deletions src/Cli/dotnet/commands/dotnet-test/LocalizableStrings.resx
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,9 @@
<data name="CmdConfigurationDescription" xml:space="preserve">
<value>Defines the build configuration. The default for most projects is Debug, but you can override the build configuration settings in your project.</value>
</data>
<data name="CmdProjectDescription" xml:space="preserve">
<value>Defines the path of the project file to run (folder name or full path). If not specified, it defaults to the current directory.</value>
</data>
<data name="CmdResultsDirectoryDescription" xml:space="preserve">
<value>The directory where the test results will be placed.
The specified directory will be created if it does not exist.</value>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ public int RunWithMSBuild(ParseResult parseResult)
{
List<string> msbuildCommandLineArgs =
[
parseResult.GetValue(TestingPlatformOptions.ProjectOption) ?? string.Empty,
$"-t:_GetTestsProject",
$"-p:GetTestsProjectPipeName={_pipeNameDescription.Name}",
"-verbosity:q"
Expand Down
3 changes: 1 addition & 2 deletions src/Cli/dotnet/commands/dotnet-test/TestApplication.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ public async Task<int> RunAsync(bool isFilterMode, bool enableHelp, BuiltInOptio
{
return 1;
}

bool isDll = _module.DLLPath.EndsWith(".dll");
ProcessStartInfo processStartInfo = new()
{
Expand Down Expand Up @@ -314,7 +313,7 @@ public void OnHandshakeMessage(HandshakeMessage handshakeMessage)

public void OnCommandLineOptionMessages(CommandLineOptionMessages commandLineOptionMessages)
{
HelpRequested?.Invoke(this, new HelpEventArgs { CommandLineOptions = commandLineOptionMessages.CommandLineOptionMessageList.Select(message => new CommandLineOption(message.Name, message.Description, message.IsHidden, message.IsBuiltIn)).ToArray() });
HelpRequested?.Invoke(this, new HelpEventArgs { ModulePath = commandLineOptionMessages.ModulePath, CommandLineOptions = commandLineOptionMessages.CommandLineOptionMessageList.Select(message => new CommandLineOption(message.Name, message.Description, message.IsHidden, message.IsBuiltIn)).ToArray() });
}

internal void OnDiscoveredTestMessages(DiscoveredTestMessages discoveredTestMessages)
Expand Down
1 change: 1 addition & 0 deletions src/Cli/dotnet/commands/dotnet-test/TestCommandParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ private static CliCommand GetTestingPlatformCliCommand()
command.Options.Add(TestingPlatformOptions.NoRestoreOption);
command.Options.Add(TestingPlatformOptions.ArchitectureOption);
command.Options.Add(TestingPlatformOptions.ConfigurationOption);
command.Options.Add(TestingPlatformOptions.ProjectOption);

return command;
}
Expand Down
6 changes: 6 additions & 0 deletions src/Cli/dotnet/commands/dotnet-test/TestingPlatformOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,11 @@ internal static class TestingPlatformOptions
Description = LocalizableStrings.CmdConfigurationDescription,
Arity = ArgumentArity.ExactlyOne
};

public static readonly CliOption<string> ProjectOption = new("--project")
{
Description = LocalizableStrings.CmdProjectDescription,
Arity = ArgumentArity.ExactlyOne
};
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit da0203c

Please sign in to comment.