Add --runtime option to dotnet test.

This commit adds a `--runtime` option to the `dotnet test` command for
consistency with other commands.

The option does not have a short form of `-r`, however, because `dotnet test`
already uses the short form for another option (results directory).

Fixes #9583.
This commit is contained in:
Peter Huene 2018-07-25 13:25:14 -07:00
parent 8d75cf1300
commit af97bc7672
No known key found for this signature in database
GPG key ID: E1D265D820213D6A
17 changed files with 111 additions and 2 deletions

View file

@ -312,6 +312,46 @@ namespace Microsoft.DotNet.Cli.Test.Tests
result.ExitCode.Should().Be(1);
}
[Fact]
public void ItTestsWithTheSpecifiedRuntimeOption()
{
var testInstance = TestAssets.Get("XunitCore")
.CreateInstance()
.WithSourceFiles();
var rootPath = testInstance.Root.FullName;
var rid = DotnetLegacyRuntimeIdentifiers.InferLegacyRestoreRuntimeIdentifier();
new BuildCommand()
.WithWorkingDirectory(rootPath)
.ExecuteWithCapturedOutput($"--runtime {rid}")
.Should()
.Pass()
.And.NotHaveStdErr();
var result = new DotnetTestCommand()
.WithWorkingDirectory(rootPath)
.ExecuteWithCapturedOutput($"{TestBase.ConsoleLoggerOutputNormal} --no-build --runtime {rid}");
result
.Should()
.NotHaveStdErrContaining("MSB1001")
.And
.HaveStdOutContaining(rid);
if (!DotnetUnderTest.IsLocalized())
{
result
.Should()
.HaveStdOutContaining("Total tests: 2. Passed: 1. Failed: 1. Skipped: 0.")
.And
.HaveStdOutContaining("Passed TestNamespace.VSTestXunitTests.VSTestXunitPassTest")
.And
.HaveStdOutContaining("Failed TestNamespace.VSTestXunitTests.VSTestXunitFailTest");
}
result.ExitCode.Should().Be(1);
}
[WindowsOnlyFact]
public void ItCreatesCoverageFileWhenCodeCoverageEnabledByRunsettings()