Enable test verb tests

This commit is contained in:
Faizan Ahmad 2016-11-01 22:01:30 +05:30
parent be9fd8388b
commit 5c5ce3d336
4 changed files with 18 additions and 17 deletions

View file

@ -4,7 +4,7 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFrameworks>net46</TargetFrameworks>
<TargetFrameworks>net46;netcoreapp1.0</TargetFrameworks>
</PropertyGroup>
<PropertyGroup Condition="'$(TargetFramework)' == 'net46'">

View file

@ -97,7 +97,7 @@
<!-- Workaround for https://github.com/dotnet/sdk/issues/115 -->
<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>
<Copy SourceFiles="@(HackFilesToCopy)"
DestinationFiles="@(HackFilesToCopy->'$(SdkOutputDirectory)/%(RecursiveDir)%(Filename)%(Extension)')" />

View file

@ -14,10 +14,10 @@ namespace Microsoft.DotNet.Cli.Test.Tests
public class GivenDotnetTest3BuildsAndRunsTestFromCsprojForMultipleTFM : TestBase
{
// project targeting net46 will not run in non windows machine.
[WindowsOnlyFact(Skip="https://github.com/dotnet/cli/issues/4526")]
[WindowsOnlyFact]
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";
TestInstance testInstance = TestAssetsManager.CreateTestInstance(testAppName);
@ -30,18 +30,23 @@ namespace Microsoft.DotNet.Cli.Test.Tests
.Should()
.Pass();
// Call test3
// Call test
CommandResult result = new DotnetTestCommand()
.WithWorkingDirectory(testProjectDirectory)
.ExecuteWithCapturedOutput("--diag LogFile.txt");
// Verify
// for target framework net46
try
{
// Verify
// for target framework net46
result.StdOut.Should().Contain("Total tests: 3. Passed: 2. Failed: 1. Skipped: 0.");
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
{
@ -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("**************************************************************************************************");
}
// 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");
}
}
}

View file

@ -13,10 +13,10 @@ namespace Microsoft.DotNet.Cli.Test.Tests
{
public class GivenDotnettestBuildsAndRunsTestfromCsproj : TestBase
{
//[Fact]
[Fact]
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";
TestInstance testInstance = TestAssetsManager.CreateTestInstance(testAppName);
@ -32,7 +32,7 @@ namespace Microsoft.DotNet.Cli.Test.Tests
// Call test
CommandResult result = new DotnetTestCommand()
.WithWorkingDirectory(testProjectDirectory)
.ExecuteWithCapturedOutput("/p:TargetFramework=netcoreapp1.0");
.ExecuteWithCapturedOutput("-f netcoreapp1.0");
// Verify
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");
}
//[Fact]
[Fact]
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";
TestInstance testInstance = TestAssetsManager.CreateTestInstance(testAppName);
@ -61,7 +61,7 @@ namespace Microsoft.DotNet.Cli.Test.Tests
configuration, "netcoreapp1.0", "VSTestDotNetCoreProject.dll");
expectedError = "The test source file " + "\"" + expectedError + "\"" + " provided was not found.";
// Call test3
// Call test
CommandResult result = new DotnetTestCommand()
.WithWorkingDirectory(testProjectDirectory)
.ExecuteWithCapturedOutput("--noBuild");