* 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:
Faizan2304 2016-11-24 14:18:54 +05:30 committed by Piotr Puszkiewicz
parent 3a3ab7e0b0
commit eb8e0cfa40
12 changed files with 64 additions and 18 deletions

View file

@ -26,13 +26,13 @@
<PrivateAssets>All</PrivateAssets>
</PackageReference>
<PackageReference Include="MSTest.TestFramework">
<Version>1.0.5-preview</Version>
<Version>1.0.6-preview</Version>
</PackageReference>
<PackageReference Include="MSTest.TestAdapter">
<Version>1.1.4-preview</Version>
<Version>1.1.5-preview</Version>
</PackageReference>
<PackageReference Include="Microsoft.NET.Test.Sdk">
<Version>15.0.0-preview-20161024-02</Version>
<Version>15.0.0-preview-20161123-03</Version>
</PackageReference>
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Microsoft.CSharp.targets" />

View file

@ -19,13 +19,13 @@
<PrivateAssets>All</PrivateAssets>
</PackageReference>
<PackageReference Include="MSTest.TestFramework">
<Version>1.0.5-preview</Version>
<Version>1.0.6-preview</Version>
</PackageReference>
<PackageReference Include="MSTest.TestAdapter">
<Version>1.1.4-preview</Version>
<Version>1.1.5-preview</Version>
</PackageReference>
<PackageReference Include="Microsoft.NET.Test.Sdk">
<Version>15.0.0-preview-20161024-02</Version>
<Version>15.0.0-preview-20161123-03</Version>
</PackageReference>
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Microsoft.CSharp.targets" />

View file

@ -26,7 +26,7 @@
<PrivateAssets>All</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.NET.Test.Sdk">
<Version>15.0.0-preview-20161024-02</Version>
<Version>15.0.0-preview-20161123-03</Version>
</PackageReference>
<PackageReference Include="xunit">
<Version>2.2.0-beta4-build3444</Version>

View file

@ -20,7 +20,7 @@
<PrivateAssets>All</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.NET.Test.Sdk">
<Version>15.0.0-preview-20161024-02</Version>
<Version>15.0.0-preview-20161123-03</Version>
</PackageReference>
<PackageReference Include="xunit">
<Version>2.2.0-beta4-build3444</Version>

View file

@ -98,7 +98,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-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>
<Copy SourceFiles="@(HackFilesToCopy)"
DestinationFiles="@(HackFilesToCopy->'$(SdkOutputDirectory)/%(RecursiveDir)%(Filename)%(Extension)')" />

View file

@ -11,8 +11,10 @@ Copyright (c) .NET Foundation. All rights reserved.
-->
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<VSTestTaskAssemblyFile Condition="$(VSTestTaskAssemblyFile) == ''">$(MSBuildExtensionsPath)\Microsoft.TestPlatform.Build.dll</VSTestTaskAssemblyFile>
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
</PropertyGroup>
<UsingTask TaskName="Microsoft.TestPlatform.Build.Tasks.BuildLogTask" AssemblyFile="$(VSTestTaskAssemblyFile)" />
<!--
===================================================================================
DispatchToInnerBuildsWithVSTestTarget
@ -38,7 +40,8 @@ Copyright (c) .NET Foundation. All rights reserved.
<MSBuild Projects="$(MSBuildProjectFile)"
Condition="'$(TargetFrameworks)' != '' "
Targets="$(InnerVSTestTargets)"
Properties="TargetFramework=%(_TargetFramework.Identity);VSTestNoBuild=true">
Properties="TargetFramework=%(_TargetFramework.Identity);VSTestNoBuild=true"
ContinueOnError="true">
<Output ItemName="InnerOutput" TaskParameter="TargetOutputs" />
</MSBuild>
</Target>
@ -62,11 +65,17 @@ Copyright (c) .NET Foundation. All rights reserved.
=================================================================================
-->
<Target Name="VSTest" >
<CallTarget Condition="'$(VSTestNoBuild)' != 'true'" Targets="Build" />
<CallTarget Condition="'$(VSTestNoBuild)' != 'true'" Targets="BuildProject" />
<CallTarget Targets="SetVSTestInnerTarget" />
<CallTarget Targets="DispatchToInnerBuildsWithVSTestTarget" />
</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)">
<PropertyGroup Condition="'$(InnerVSTestTargets)' == ''">
<InnerVSTestTargets>VSTest</InnerVSTestTargets>

View file

@ -20,13 +20,13 @@
<PrivateAssets>All</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.NET.Test.Sdk">
<Version>15.0.0-preview-20161024-02</Version>
<Version>15.0.0-preview-20161123-03</Version>
</PackageReference>
<PackageReference Include="MSTest.TestAdapter">
<Version>1.1.3-preview</Version>
<Version>1.1.5-preview</Version>
</PackageReference>
<PackageReference Include="MSTest.TestFramework">
<Version>1.0.4-preview</Version>
<Version>1.0.6-preview</Version>
</PackageReference>
</ItemGroup>

View file

@ -20,7 +20,7 @@
<PrivateAssets>All</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.NET.Test.Sdk">
<Version>15.0.0-preview-20161024-02</Version>
<Version>15.0.0-preview-20161123-03</Version>
</PackageReference>
<PackageReference Include="xunit">
<Version>2.2.0-beta4-build3444</Version>

View file

@ -24,6 +24,8 @@ namespace Microsoft.DotNet.Tools.Test
Description = "Test Driver for the .NET Platform"
};
cmd.AllowArgumentSeparator = true;
cmd.ArgumentSeparatorHelpText = HelpMessageStrings.MSBuildAdditionalArgsHelpText;
cmd.HelpOption("-h|--help");
var argRoot = cmd.Argument(

View file

@ -33,10 +33,10 @@
<Version>4.0.0-rc-2048</Version>
</PackageReference>
<PackageReference Include="Microsoft.TestPlatform.CLI">
<Version>15.0.0-preview-20161102-02</Version>
<Version>15.0.0-preview-20161123-03</Version>
</PackageReference>
<PackageReference Include="Microsoft.TestPlatform.Build">
<Version>15.0.0-preview-20161107-06</Version>
<Version>15.0.0-preview-20161123-03</Version>
</PackageReference>
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'netcoreapp1.0' ">

View file

@ -10,7 +10,7 @@ using System;
namespace Microsoft.DotNet.Cli.Test.Tests
{
public class GivenDotnetTest3BuildsAndRunsTestFromCsprojForMultipleTFM : TestBase
public class GivenDotnetTestBuildsAndRunsTestFromCsprojForMultipleTFM : TestBase
{
[WindowsOnlyFact(Skip="https://github.com/dotnet/cli/issues/4616")]
public void MStestMultiTFM()

View file

@ -96,5 +96,40 @@ namespace Microsoft.DotNet.Cli.Test.Tests
// Verify
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]);
}
}
}