Enable test verb tests
This commit is contained in:
parent
be9fd8388b
commit
5c5ce3d336
4 changed files with 18 additions and 17 deletions
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<OutputType>Exe</OutputType>
|
<OutputType>Exe</OutputType>
|
||||||
<TargetFrameworks>net46</TargetFrameworks>
|
<TargetFrameworks>net46;netcoreapp1.0</TargetFrameworks>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup Condition="'$(TargetFramework)' == 'net46'">
|
<PropertyGroup Condition="'$(TargetFramework)' == 'net46'">
|
||||||
|
|
|
@ -97,7 +97,7 @@
|
||||||
|
|
||||||
<!-- Workaround for https://github.com/dotnet/sdk/issues/115 -->
|
<!-- Workaround for https://github.com/dotnet/sdk/issues/115 -->
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<HackFilesToCopy Include="$(NuGetPackagesDir)\microsoft.build.runtime\15.1.0-preview-000370-00\contentFiles\any\netcoreapp1.0\**;$(NuGetPackagesDir)\microsoft.codeanalysis.build.tasks\2.0.0-beta6-60922-08\contentFiles\any\any\**;$(NuGetPackagesDir)\Microsoft.TestPlatform.CLI\15.0.0-preview-20161028-03\contentFiles\any\any\**" />
|
<HackFilesToCopy Include="$(NuGetPackagesDir)\microsoft.build.runtime\15.1.0-preview-000370-00\contentFiles\any\netcoreapp1.0\**;$(NuGetPackagesDir)\microsoft.codeanalysis.build.tasks\2.0.0-beta6-60922-08\contentFiles\any\any\**;$(NuGetPackagesDir)\microsoft.testplatform.cli\15.0.0-preview-20161028-03\contentFiles\any\any\**" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Copy SourceFiles="@(HackFilesToCopy)"
|
<Copy SourceFiles="@(HackFilesToCopy)"
|
||||||
DestinationFiles="@(HackFilesToCopy->'$(SdkOutputDirectory)/%(RecursiveDir)%(Filename)%(Extension)')" />
|
DestinationFiles="@(HackFilesToCopy->'$(SdkOutputDirectory)/%(RecursiveDir)%(Filename)%(Extension)')" />
|
||||||
|
|
|
@ -14,10 +14,10 @@ namespace Microsoft.DotNet.Cli.Test.Tests
|
||||||
public class GivenDotnetTest3BuildsAndRunsTestFromCsprojForMultipleTFM : TestBase
|
public class GivenDotnetTest3BuildsAndRunsTestFromCsprojForMultipleTFM : TestBase
|
||||||
{
|
{
|
||||||
// project targeting net46 will not run in non windows machine.
|
// project targeting net46 will not run in non windows machine.
|
||||||
[WindowsOnlyFact(Skip="https://github.com/dotnet/cli/issues/4526")]
|
[WindowsOnlyFact]
|
||||||
public void TestsFromAGivenProjectShouldRunWithExpectedOutputForMultiTFM()
|
public void TestsFromAGivenProjectShouldRunWithExpectedOutputForMultiTFM()
|
||||||
{
|
{
|
||||||
// Copy DotNetCoreTestProject project in output directory of project dotnet-vstest.Tests
|
// Copy VSTestDesktopAndNetCoreApp project in output directory of project dotnet-test.Tests
|
||||||
string testAppName = "VSTestDesktopAndNetCoreApp";
|
string testAppName = "VSTestDesktopAndNetCoreApp";
|
||||||
TestInstance testInstance = TestAssetsManager.CreateTestInstance(testAppName);
|
TestInstance testInstance = TestAssetsManager.CreateTestInstance(testAppName);
|
||||||
|
|
||||||
|
@ -30,18 +30,23 @@ namespace Microsoft.DotNet.Cli.Test.Tests
|
||||||
.Should()
|
.Should()
|
||||||
.Pass();
|
.Pass();
|
||||||
|
|
||||||
// Call test3
|
// Call test
|
||||||
CommandResult result = new DotnetTestCommand()
|
CommandResult result = new DotnetTestCommand()
|
||||||
.WithWorkingDirectory(testProjectDirectory)
|
.WithWorkingDirectory(testProjectDirectory)
|
||||||
.ExecuteWithCapturedOutput("--diag LogFile.txt");
|
.ExecuteWithCapturedOutput("--diag LogFile.txt");
|
||||||
|
|
||||||
|
|
||||||
// Verify
|
|
||||||
// for target framework net46
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
// Verify
|
||||||
|
// for target framework net46
|
||||||
result.StdOut.Should().Contain("Total tests: 3. Passed: 2. Failed: 1. Skipped: 0.");
|
result.StdOut.Should().Contain("Total tests: 3. Passed: 2. Failed: 1. Skipped: 0.");
|
||||||
result.StdOut.Should().Contain("Passed TestNamespace.VSTestTests.VSTestPassTestDesktop");
|
result.StdOut.Should().Contain("Passed TestNamespace.VSTestTests.VSTestPassTestDesktop");
|
||||||
|
|
||||||
|
// for target framework netcoreapp1.0
|
||||||
|
result.StdOut.Should().Contain("Total tests: 3. Passed: 1. Failed: 2. Skipped: 0.");
|
||||||
|
result.StdOut.Should().Contain("Failed TestNamespace.VSTestTests.VSTestFailTestNetCoreApp");
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
|
@ -54,10 +59,6 @@ namespace Microsoft.DotNet.Cli.Test.Tests
|
||||||
System.Console.WriteLine(logfile2.Length>0 ? File.ReadAllText(logfile2[0]):"No log file found");
|
System.Console.WriteLine(logfile2.Length>0 ? File.ReadAllText(logfile2[0]):"No log file found");
|
||||||
System.Console.WriteLine("**************************************************************************************************");
|
System.Console.WriteLine("**************************************************************************************************");
|
||||||
}
|
}
|
||||||
|
|
||||||
// for target framework netcoreapp1.0
|
|
||||||
//result.StdOut.Should().Contain("Total tests: 3. Passed: 1. Failed: 2. Skipped: 0.");
|
|
||||||
//result.StdOut.Should().Contain("Failed TestNamespace.VSTestTests.VSTestFailTestNetCoreApp");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,10 +13,10 @@ namespace Microsoft.DotNet.Cli.Test.Tests
|
||||||
{
|
{
|
||||||
public class GivenDotnettestBuildsAndRunsTestfromCsproj : TestBase
|
public class GivenDotnettestBuildsAndRunsTestfromCsproj : TestBase
|
||||||
{
|
{
|
||||||
//[Fact]
|
[Fact]
|
||||||
public void TestsFromAGivenProjectShouldRunWithExpectedOutput()
|
public void TestsFromAGivenProjectShouldRunWithExpectedOutput()
|
||||||
{
|
{
|
||||||
// Copy DotNetCoreTestProject project in output directory of project dotnet-vstest.Tests
|
// Copy VSTestDotNetCoreProject project in output directory of project dotnet-vstest.Tests
|
||||||
string testAppName = "VSTestDotNetCoreProject";
|
string testAppName = "VSTestDotNetCoreProject";
|
||||||
TestInstance testInstance = TestAssetsManager.CreateTestInstance(testAppName);
|
TestInstance testInstance = TestAssetsManager.CreateTestInstance(testAppName);
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ namespace Microsoft.DotNet.Cli.Test.Tests
|
||||||
// Call test
|
// Call test
|
||||||
CommandResult result = new DotnetTestCommand()
|
CommandResult result = new DotnetTestCommand()
|
||||||
.WithWorkingDirectory(testProjectDirectory)
|
.WithWorkingDirectory(testProjectDirectory)
|
||||||
.ExecuteWithCapturedOutput("/p:TargetFramework=netcoreapp1.0");
|
.ExecuteWithCapturedOutput("-f netcoreapp1.0");
|
||||||
|
|
||||||
// Verify
|
// Verify
|
||||||
result.StdOut.Should().Contain("Total tests: 2. Passed: 1. Failed: 1. Skipped: 0.");
|
result.StdOut.Should().Contain("Total tests: 2. Passed: 1. Failed: 1. Skipped: 0.");
|
||||||
|
@ -40,10 +40,10 @@ namespace Microsoft.DotNet.Cli.Test.Tests
|
||||||
result.StdOut.Should().Contain("Failed TestNamespace.VSTestTests.VSTestFailTest");
|
result.StdOut.Should().Contain("Failed TestNamespace.VSTestTests.VSTestFailTest");
|
||||||
}
|
}
|
||||||
|
|
||||||
//[Fact]
|
[Fact]
|
||||||
public void TestWillNotBuildTheProjectIfNoBuildArgsIsGiven()
|
public void TestWillNotBuildTheProjectIfNoBuildArgsIsGiven()
|
||||||
{
|
{
|
||||||
// Copy DotNetCoreTestProject project in output directory of project dotnet-vstest.Tests
|
// Copy VSTestDotNetCoreProject project in output directory of project dotnet-vstest.Tests
|
||||||
string testAppName = "VSTestDotNetCoreProject";
|
string testAppName = "VSTestDotNetCoreProject";
|
||||||
TestInstance testInstance = TestAssetsManager.CreateTestInstance(testAppName);
|
TestInstance testInstance = TestAssetsManager.CreateTestInstance(testAppName);
|
||||||
|
|
||||||
|
@ -61,7 +61,7 @@ namespace Microsoft.DotNet.Cli.Test.Tests
|
||||||
configuration, "netcoreapp1.0", "VSTestDotNetCoreProject.dll");
|
configuration, "netcoreapp1.0", "VSTestDotNetCoreProject.dll");
|
||||||
expectedError = "The test source file " + "\"" + expectedError + "\"" + " provided was not found.";
|
expectedError = "The test source file " + "\"" + expectedError + "\"" + " provided was not found.";
|
||||||
|
|
||||||
// Call test3
|
// Call test
|
||||||
CommandResult result = new DotnetTestCommand()
|
CommandResult result = new DotnetTestCommand()
|
||||||
.WithWorkingDirectory(testProjectDirectory)
|
.WithWorkingDirectory(testProjectDirectory)
|
||||||
.ExecuteWithCapturedOutput("--noBuild");
|
.ExecuteWithCapturedOutput("--noBuild");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue