Bug fixes (#4810)
* Bug fixes * Nitpick * -Fixed failed tests -Added test to cover trx logger scenario. * Fix for issue https://github.com/Microsoft/vstest/issues/241 * Fix for failed test. We have taken fix where dotnet test will return nonzero if test fails. In multi TFM scenario if test fails it termates the whole process as dotnet test is returning 1. As a fix of this we should continue if some test fails for next TFM * Bump Microsoft.Testplatform.CLI and Microsoft.NET.Test.Sdk version
This commit is contained in:
parent
3a3ab7e0b0
commit
eb8e0cfa40
12 changed files with 64 additions and 18 deletions
|
@ -26,13 +26,13 @@
|
||||||
<PrivateAssets>All</PrivateAssets>
|
<PrivateAssets>All</PrivateAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="MSTest.TestFramework">
|
<PackageReference Include="MSTest.TestFramework">
|
||||||
<Version>1.0.5-preview</Version>
|
<Version>1.0.6-preview</Version>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="MSTest.TestAdapter">
|
<PackageReference Include="MSTest.TestAdapter">
|
||||||
<Version>1.1.4-preview</Version>
|
<Version>1.1.5-preview</Version>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk">
|
<PackageReference Include="Microsoft.NET.Test.Sdk">
|
||||||
<Version>15.0.0-preview-20161024-02</Version>
|
<Version>15.0.0-preview-20161123-03</Version>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildExtensionsPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildExtensionsPath)\Microsoft.CSharp.targets" />
|
||||||
|
|
|
@ -19,13 +19,13 @@
|
||||||
<PrivateAssets>All</PrivateAssets>
|
<PrivateAssets>All</PrivateAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="MSTest.TestFramework">
|
<PackageReference Include="MSTest.TestFramework">
|
||||||
<Version>1.0.5-preview</Version>
|
<Version>1.0.6-preview</Version>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="MSTest.TestAdapter">
|
<PackageReference Include="MSTest.TestAdapter">
|
||||||
<Version>1.1.4-preview</Version>
|
<Version>1.1.5-preview</Version>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk">
|
<PackageReference Include="Microsoft.NET.Test.Sdk">
|
||||||
<Version>15.0.0-preview-20161024-02</Version>
|
<Version>15.0.0-preview-20161123-03</Version>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildExtensionsPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildExtensionsPath)\Microsoft.CSharp.targets" />
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
<PrivateAssets>All</PrivateAssets>
|
<PrivateAssets>All</PrivateAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk">
|
<PackageReference Include="Microsoft.NET.Test.Sdk">
|
||||||
<Version>15.0.0-preview-20161024-02</Version>
|
<Version>15.0.0-preview-20161123-03</Version>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="xunit">
|
<PackageReference Include="xunit">
|
||||||
<Version>2.2.0-beta4-build3444</Version>
|
<Version>2.2.0-beta4-build3444</Version>
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
<PrivateAssets>All</PrivateAssets>
|
<PrivateAssets>All</PrivateAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk">
|
<PackageReference Include="Microsoft.NET.Test.Sdk">
|
||||||
<Version>15.0.0-preview-20161024-02</Version>
|
<Version>15.0.0-preview-20161123-03</Version>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="xunit">
|
<PackageReference Include="xunit">
|
||||||
<Version>2.2.0-beta4-build3444</Version>
|
<Version>2.2.0-beta4-build3444</Version>
|
||||||
|
|
|
@ -98,7 +98,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-20161102-02\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-20161123-03\contentFiles\any\any\**" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Copy SourceFiles="@(HackFilesToCopy)"
|
<Copy SourceFiles="@(HackFilesToCopy)"
|
||||||
DestinationFiles="@(HackFilesToCopy->'$(SdkOutputDirectory)/%(RecursiveDir)%(Filename)%(Extension)')" />
|
DestinationFiles="@(HackFilesToCopy->'$(SdkOutputDirectory)/%(RecursiveDir)%(Filename)%(Extension)')" />
|
||||||
|
|
|
@ -11,8 +11,10 @@ Copyright (c) .NET Foundation. All rights reserved.
|
||||||
-->
|
-->
|
||||||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
|
<VSTestTaskAssemblyFile Condition="$(VSTestTaskAssemblyFile) == ''">$(MSBuildExtensionsPath)\Microsoft.TestPlatform.Build.dll</VSTestTaskAssemblyFile>
|
||||||
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
|
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
<UsingTask TaskName="Microsoft.TestPlatform.Build.Tasks.BuildLogTask" AssemblyFile="$(VSTestTaskAssemblyFile)" />
|
||||||
<!--
|
<!--
|
||||||
===================================================================================
|
===================================================================================
|
||||||
DispatchToInnerBuildsWithVSTestTarget
|
DispatchToInnerBuildsWithVSTestTarget
|
||||||
|
@ -38,7 +40,8 @@ Copyright (c) .NET Foundation. All rights reserved.
|
||||||
<MSBuild Projects="$(MSBuildProjectFile)"
|
<MSBuild Projects="$(MSBuildProjectFile)"
|
||||||
Condition="'$(TargetFrameworks)' != '' "
|
Condition="'$(TargetFrameworks)' != '' "
|
||||||
Targets="$(InnerVSTestTargets)"
|
Targets="$(InnerVSTestTargets)"
|
||||||
Properties="TargetFramework=%(_TargetFramework.Identity);VSTestNoBuild=true">
|
Properties="TargetFramework=%(_TargetFramework.Identity);VSTestNoBuild=true"
|
||||||
|
ContinueOnError="true">
|
||||||
<Output ItemName="InnerOutput" TaskParameter="TargetOutputs" />
|
<Output ItemName="InnerOutput" TaskParameter="TargetOutputs" />
|
||||||
</MSBuild>
|
</MSBuild>
|
||||||
</Target>
|
</Target>
|
||||||
|
@ -62,11 +65,17 @@ Copyright (c) .NET Foundation. All rights reserved.
|
||||||
=================================================================================
|
=================================================================================
|
||||||
-->
|
-->
|
||||||
<Target Name="VSTest" >
|
<Target Name="VSTest" >
|
||||||
<CallTarget Condition="'$(VSTestNoBuild)' != 'true'" Targets="Build" />
|
<CallTarget Condition="'$(VSTestNoBuild)' != 'true'" Targets="BuildProject" />
|
||||||
<CallTarget Targets="SetVSTestInnerTarget" />
|
<CallTarget Targets="SetVSTestInnerTarget" />
|
||||||
<CallTarget Targets="DispatchToInnerBuildsWithVSTestTarget" />
|
<CallTarget Targets="DispatchToInnerBuildsWithVSTestTarget" />
|
||||||
</Target>
|
</Target>
|
||||||
|
|
||||||
|
<Target Name="BuildProject">
|
||||||
|
<Microsoft.TestPlatform.Build.Tasks.BuildLogTask BuildStarted="True" />
|
||||||
|
<CallTarget Targets="Build" />
|
||||||
|
<Microsoft.TestPlatform.Build.Tasks.BuildLogTask />
|
||||||
|
</Target>
|
||||||
|
|
||||||
<Target Name="SetVSTestInnerTarget" Returns="@(InnerOutput)">
|
<Target Name="SetVSTestInnerTarget" Returns="@(InnerOutput)">
|
||||||
<PropertyGroup Condition="'$(InnerVSTestTargets)' == ''">
|
<PropertyGroup Condition="'$(InnerVSTestTargets)' == ''">
|
||||||
<InnerVSTestTargets>VSTest</InnerVSTestTargets>
|
<InnerVSTestTargets>VSTest</InnerVSTestTargets>
|
||||||
|
|
|
@ -20,13 +20,13 @@
|
||||||
<PrivateAssets>All</PrivateAssets>
|
<PrivateAssets>All</PrivateAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk">
|
<PackageReference Include="Microsoft.NET.Test.Sdk">
|
||||||
<Version>15.0.0-preview-20161024-02</Version>
|
<Version>15.0.0-preview-20161123-03</Version>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="MSTest.TestAdapter">
|
<PackageReference Include="MSTest.TestAdapter">
|
||||||
<Version>1.1.3-preview</Version>
|
<Version>1.1.5-preview</Version>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="MSTest.TestFramework">
|
<PackageReference Include="MSTest.TestFramework">
|
||||||
<Version>1.0.4-preview</Version>
|
<Version>1.0.6-preview</Version>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
<PrivateAssets>All</PrivateAssets>
|
<PrivateAssets>All</PrivateAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk">
|
<PackageReference Include="Microsoft.NET.Test.Sdk">
|
||||||
<Version>15.0.0-preview-20161024-02</Version>
|
<Version>15.0.0-preview-20161123-03</Version>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="xunit">
|
<PackageReference Include="xunit">
|
||||||
<Version>2.2.0-beta4-build3444</Version>
|
<Version>2.2.0-beta4-build3444</Version>
|
||||||
|
|
|
@ -24,6 +24,8 @@ namespace Microsoft.DotNet.Tools.Test
|
||||||
Description = "Test Driver for the .NET Platform"
|
Description = "Test Driver for the .NET Platform"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
cmd.AllowArgumentSeparator = true;
|
||||||
|
cmd.ArgumentSeparatorHelpText = HelpMessageStrings.MSBuildAdditionalArgsHelpText;
|
||||||
cmd.HelpOption("-h|--help");
|
cmd.HelpOption("-h|--help");
|
||||||
|
|
||||||
var argRoot = cmd.Argument(
|
var argRoot = cmd.Argument(
|
||||||
|
|
|
@ -33,10 +33,10 @@
|
||||||
<Version>4.0.0-rc-2048</Version>
|
<Version>4.0.0-rc-2048</Version>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="Microsoft.TestPlatform.CLI">
|
<PackageReference Include="Microsoft.TestPlatform.CLI">
|
||||||
<Version>15.0.0-preview-20161102-02</Version>
|
<Version>15.0.0-preview-20161123-03</Version>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="Microsoft.TestPlatform.Build">
|
<PackageReference Include="Microsoft.TestPlatform.Build">
|
||||||
<Version>15.0.0-preview-20161107-06</Version>
|
<Version>15.0.0-preview-20161123-03</Version>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup Condition=" '$(TargetFramework)' == 'netcoreapp1.0' ">
|
<ItemGroup Condition=" '$(TargetFramework)' == 'netcoreapp1.0' ">
|
||||||
|
|
|
@ -10,7 +10,7 @@ using System;
|
||||||
|
|
||||||
namespace Microsoft.DotNet.Cli.Test.Tests
|
namespace Microsoft.DotNet.Cli.Test.Tests
|
||||||
{
|
{
|
||||||
public class GivenDotnetTest3BuildsAndRunsTestFromCsprojForMultipleTFM : TestBase
|
public class GivenDotnetTestBuildsAndRunsTestFromCsprojForMultipleTFM : TestBase
|
||||||
{
|
{
|
||||||
[WindowsOnlyFact(Skip="https://github.com/dotnet/cli/issues/4616")]
|
[WindowsOnlyFact(Skip="https://github.com/dotnet/cli/issues/4616")]
|
||||||
public void MStestMultiTFM()
|
public void MStestMultiTFM()
|
|
@ -96,5 +96,40 @@ namespace Microsoft.DotNet.Cli.Test.Tests
|
||||||
// Verify
|
// Verify
|
||||||
result.StdOut.Should().Contain(expectedError);
|
result.StdOut.Should().Contain(expectedError);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void TestWillCreateTrxLogger()
|
||||||
|
{
|
||||||
|
// Copy VSTestDotNetCore project in output directory of project dotnet-vstest.Tests
|
||||||
|
string testAppName = "VSTestDotNetCore";
|
||||||
|
TestInstance testInstance = TestAssetsManager.CreateTestInstance(testAppName);
|
||||||
|
|
||||||
|
string testProjectDirectory = testInstance.TestRoot;
|
||||||
|
|
||||||
|
// Restore project VSTestDotNetCore
|
||||||
|
new RestoreCommand()
|
||||||
|
.WithWorkingDirectory(testProjectDirectory)
|
||||||
|
.Execute()
|
||||||
|
.Should()
|
||||||
|
.Pass();
|
||||||
|
|
||||||
|
string trxLoggerDirectory = Path.Combine(testProjectDirectory, "TestResults");
|
||||||
|
|
||||||
|
// Delete trxLoggerDirectory if it exist
|
||||||
|
if(Directory.Exists(trxLoggerDirectory))
|
||||||
|
{
|
||||||
|
Directory.Delete(trxLoggerDirectory, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Call test with logger enable
|
||||||
|
CommandResult result = new DotnetTestCommand()
|
||||||
|
.WithWorkingDirectory(testProjectDirectory)
|
||||||
|
.ExecuteWithCapturedOutput("--logger:trx");
|
||||||
|
|
||||||
|
// Verify
|
||||||
|
String[] trxFiles = Directory.GetFiles(trxLoggerDirectory, "*.trx");
|
||||||
|
Assert.Equal(1, trxFiles.Length);
|
||||||
|
result.StdOut.Should().Contain(trxFiles[0]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in a new issue