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:
parent
8d75cf1300
commit
af97bc7672
17 changed files with 111 additions and 2 deletions
|
@ -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()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue