Merge pull request #9697 from dotnet/merges/release/2.1.4xx-to-release/2.2.1xx
Merge release/2.1.4xx to release/2.2.1xx
This commit is contained in:
commit
0304b4ec0d
12 changed files with 170 additions and 12 deletions
|
@ -7,8 +7,8 @@
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="MSTest.TestFramework" Version="1.0.6-preview" />
|
<PackageReference Include="MSTest.TestFramework" Version="$(MSTestVersion)" />
|
||||||
<PackageReference Include="MSTest.TestAdapter" Version="1.1.5-preview" />
|
<PackageReference Include="MSTest.TestAdapter" Version="$(MSTestVersion)" />
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="$(MicrosoftNETTestSdkPackageVersion)" />
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="$(MicrosoftNETTestSdkPackageVersion)" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
|
@ -10,8 +10,8 @@
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="MSTest.TestFramework" Version="1.0.6-preview" />
|
<PackageReference Include="MSTest.TestFramework" Version="$(MSTestVersion)" />
|
||||||
<PackageReference Include="MSTest.TestAdapter" Version="1.1.5-preview" />
|
<PackageReference Include="MSTest.TestAdapter" Version="$(MSTestVersion)" />
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="$(MicrosoftNETTestSdkPackageVersion)" />
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="$(MicrosoftNETTestSdkPackageVersion)" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
|
@ -8,8 +8,8 @@
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="$(MicrosoftNETTestSdkPackageVersion)" />
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="$(MicrosoftNETTestSdkPackageVersion)" />
|
||||||
<PackageReference Include="xunit" Version="2.2.0-beta4-build3444" />
|
<PackageReference Include="xunit" Version="$(XUnitVersion)" />
|
||||||
<PackageReference Include="xunit.runner.visualstudio" Version="2.2.0-beta4-build1194" />
|
<PackageReference Include="xunit.runner.visualstudio" Version="$(XUnitVersion)" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="$(MicrosoftNETTestSdkPackageVersion)" />
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="$(MicrosoftNETTestSdkPackageVersion)" />
|
||||||
<PackageReference Include="xunit" Version="2.2.0-beta4-build3444" />
|
<PackageReference Include="xunit" Version="$(XUnitVersion)" />
|
||||||
<PackageReference Include="xunit.runner.visualstudio" Version="2.2.0-beta4-build1194" />
|
<PackageReference Include="xunit.runner.visualstudio" Version="$(XUnitVersion)" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
<MicrosoftBuildLocalizationPackageVersion>$(MicrosoftBuildPackageVersion)</MicrosoftBuildLocalizationPackageVersion>
|
<MicrosoftBuildLocalizationPackageVersion>$(MicrosoftBuildPackageVersion)</MicrosoftBuildLocalizationPackageVersion>
|
||||||
<MicrosoftBuildUtilitiesCorePackageVersion>$(MicrosoftBuildPackageVersion)</MicrosoftBuildUtilitiesCorePackageVersion>
|
<MicrosoftBuildUtilitiesCorePackageVersion>$(MicrosoftBuildPackageVersion)</MicrosoftBuildUtilitiesCorePackageVersion>
|
||||||
<MicrosoftFSharpCompilerPackageVersion>10.2.0-rtm-180620-0</MicrosoftFSharpCompilerPackageVersion>
|
<MicrosoftFSharpCompilerPackageVersion>10.2.0-rtm-180620-0</MicrosoftFSharpCompilerPackageVersion>
|
||||||
<MicrosoftCodeAnalysisCSharpPackageVersion>2.8.3-beta6-62923-07</MicrosoftCodeAnalysisCSharpPackageVersion>
|
<MicrosoftCodeAnalysisCSharpPackageVersion>2.9.0-beta8-63115-02</MicrosoftCodeAnalysisCSharpPackageVersion>
|
||||||
<MicrosoftCodeAnalysisBuildTasksPackageVersion>$(MicrosoftCodeAnalysisCSharpPackageVersion)</MicrosoftCodeAnalysisBuildTasksPackageVersion>
|
<MicrosoftCodeAnalysisBuildTasksPackageVersion>$(MicrosoftCodeAnalysisCSharpPackageVersion)</MicrosoftCodeAnalysisBuildTasksPackageVersion>
|
||||||
<MicrosoftNETCoreCompilersPackageVersion>$(MicrosoftCodeAnalysisCSharpPackageVersion)</MicrosoftNETCoreCompilersPackageVersion>
|
<MicrosoftNETCoreCompilersPackageVersion>$(MicrosoftCodeAnalysisCSharpPackageVersion)</MicrosoftNETCoreCompilersPackageVersion>
|
||||||
<MicrosoftCodeAnalysisBuildTasksPackageVersion>$(MicrosoftCodeAnalysisCSharpPackageVersion)</MicrosoftCodeAnalysisBuildTasksPackageVersion>
|
<MicrosoftCodeAnalysisBuildTasksPackageVersion>$(MicrosoftCodeAnalysisCSharpPackageVersion)</MicrosoftCodeAnalysisBuildTasksPackageVersion>
|
||||||
|
@ -31,7 +31,7 @@
|
||||||
<MicrosoftNETSdkWebProjectSystemPackageVersion>$(MicrosoftNETSdkWebPackageVersion)</MicrosoftNETSdkWebProjectSystemPackageVersion>
|
<MicrosoftNETSdkWebProjectSystemPackageVersion>$(MicrosoftNETSdkWebPackageVersion)</MicrosoftNETSdkWebProjectSystemPackageVersion>
|
||||||
<MicrosoftDotNetCommonItemTemplatesPackageVersion>1.0.2-beta3</MicrosoftDotNetCommonItemTemplatesPackageVersion>
|
<MicrosoftDotNetCommonItemTemplatesPackageVersion>1.0.2-beta3</MicrosoftDotNetCommonItemTemplatesPackageVersion>
|
||||||
<MicrosoftDotNetCommonProjectTemplates20PackageVersion>$(MicrosoftDotNetCommonItemTemplatesPackageVersion)</MicrosoftDotNetCommonProjectTemplates20PackageVersion>
|
<MicrosoftDotNetCommonProjectTemplates20PackageVersion>$(MicrosoftDotNetCommonItemTemplatesPackageVersion)</MicrosoftDotNetCommonProjectTemplates20PackageVersion>
|
||||||
<MicrosoftDotNetTestProjectTemplates20PackageVersion>1.0.2-beta3-20180614-1775839</MicrosoftDotNetTestProjectTemplates20PackageVersion>
|
<MicrosoftDotNetTestProjectTemplates20PackageVersion>1.0.2-beta3-20180716-1864993</MicrosoftDotNetTestProjectTemplates20PackageVersion>
|
||||||
<MicrosoftTemplateEngineCliPackageVersion>1.0.2-beta3</MicrosoftTemplateEngineCliPackageVersion>
|
<MicrosoftTemplateEngineCliPackageVersion>1.0.2-beta3</MicrosoftTemplateEngineCliPackageVersion>
|
||||||
<MicrosoftTemplateEngineAbstractionsPackageVersion>$(MicrosoftTemplateEngineCliPackageVersion)</MicrosoftTemplateEngineAbstractionsPackageVersion>
|
<MicrosoftTemplateEngineAbstractionsPackageVersion>$(MicrosoftTemplateEngineCliPackageVersion)</MicrosoftTemplateEngineAbstractionsPackageVersion>
|
||||||
<MicrosoftTemplateEngineCliLocalizationPackageVersion>$(MicrosoftTemplateEngineCliPackageVersion)</MicrosoftTemplateEngineCliLocalizationPackageVersion>
|
<MicrosoftTemplateEngineCliLocalizationPackageVersion>$(MicrosoftTemplateEngineCliPackageVersion)</MicrosoftTemplateEngineCliLocalizationPackageVersion>
|
||||||
|
@ -58,6 +58,8 @@
|
||||||
<MicrosoftTestPlatformBuildPackageVersion>$(MicrosoftNETTestSdkPackageVersion)</MicrosoftTestPlatformBuildPackageVersion>
|
<MicrosoftTestPlatformBuildPackageVersion>$(MicrosoftNETTestSdkPackageVersion)</MicrosoftTestPlatformBuildPackageVersion>
|
||||||
<XliffTasksPackageVersion>0.2.0-beta-000042</XliffTasksPackageVersion>
|
<XliffTasksPackageVersion>0.2.0-beta-000042</XliffTasksPackageVersion>
|
||||||
<MicroBuildCorePackageVersion>0.2.0</MicroBuildCorePackageVersion>
|
<MicroBuildCorePackageVersion>0.2.0</MicroBuildCorePackageVersion>
|
||||||
|
<MSTestVersion>1.3.2</MSTestVersion>
|
||||||
|
<XUnitVersion>2.3.1</XUnitVersion>
|
||||||
<NUnit3TemplatesVersion>1.5.1</NUnit3TemplatesVersion>
|
<NUnit3TemplatesVersion>1.5.1</NUnit3TemplatesVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
|
|
||||||
<NugetConfigCLIFeeds>
|
<NugetConfigCLIFeeds>
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
|
<add key="myget-vstest" value="https://dotnet.myget.org/F/vstest/api/v3/index.json" />
|
||||||
<add key="BlobFeed" value="https://dotnetfeed.blob.core.windows.net/dotnet-core/index.json" />
|
<add key="BlobFeed" value="https://dotnetfeed.blob.core.windows.net/dotnet-core/index.json" />
|
||||||
<add key="aspnetcore-release" value="https://dotnet.myget.org/F/aspnetcore-release/api/v3/index.json" />
|
<add key="aspnetcore-release" value="https://dotnet.myget.org/F/aspnetcore-release/api/v3/index.json" />
|
||||||
<add key="aspnetcore-dev" value="https://dotnet.myget.org/F/aspnetcore-dev/api/v3/index.json" />
|
<add key="aspnetcore-dev" value="https://dotnet.myget.org/F/aspnetcore-dev/api/v3/index.json" />
|
||||||
|
|
|
@ -38,7 +38,7 @@ $env:DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
|
||||||
|
|
||||||
# Install a stage 0
|
# Install a stage 0
|
||||||
Write-Output "Installing .NET Core CLI Stage 0"
|
Write-Output "Installing .NET Core CLI Stage 0"
|
||||||
& "$RepoRoot\scripts\obtain\dotnet-install.ps1" -Channel "master" -Architecture $Architecture
|
& "$RepoRoot\scripts\obtain\dotnet-install.ps1" -Version 2.1.302 -Architecture $Architecture
|
||||||
if($LASTEXITCODE -ne 0) { throw "Failed to install stage0" }
|
if($LASTEXITCODE -ne 0) { throw "Failed to install stage0" }
|
||||||
|
|
||||||
# Put the stage0 on the path
|
# Put the stage0 on the path
|
||||||
|
|
|
@ -34,7 +34,7 @@ export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
|
||||||
|
|
||||||
# Install a stage 0
|
# Install a stage 0
|
||||||
echo "Installing .NET Core CLI Stage 0"
|
echo "Installing .NET Core CLI Stage 0"
|
||||||
$REPO_ROOT/scripts/obtain/dotnet-install.sh -Channel master -Architecture x64
|
$REPO_ROOT/scripts/obtain/dotnet-install.sh -Version 2.1.302 -Architecture x64
|
||||||
|
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
echo "Failed to install stage 0"
|
echo "Failed to install stage 0"
|
||||||
|
|
25
test/dotnet-test.Tests/CollectCodeCoverage.runsettings
Normal file
25
test/dotnet-test.Tests/CollectCodeCoverage.runsettings
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
<RunSettings>
|
||||||
|
<DataCollectionRunSettings>
|
||||||
|
<DataCollectors>
|
||||||
|
<DataCollector friendlyName="Code Coverage" uri="datacollector://Microsoft/CodeCoverage/2.0">
|
||||||
|
<Configuration>
|
||||||
|
<CodeCoverage>
|
||||||
|
<!-- Match assembly file paths: -->
|
||||||
|
<ModulePaths>
|
||||||
|
<Exclude>
|
||||||
|
<ModulePath>.*Test.dll</ModulePath>
|
||||||
|
</Exclude>
|
||||||
|
</ModulePaths>
|
||||||
|
|
||||||
|
<!-- We recommend you do not change the following values: -->
|
||||||
|
<UseVerifiableInstrumentation>True</UseVerifiableInstrumentation>
|
||||||
|
<AllowLowIntegrityProcesses>True</AllowLowIntegrityProcesses>
|
||||||
|
<CollectFromChildProcesses>True</CollectFromChildProcesses>
|
||||||
|
<CollectAspDotNet>False</CollectAspDotNet>
|
||||||
|
|
||||||
|
</CodeCoverage>
|
||||||
|
</Configuration>
|
||||||
|
</DataCollector>
|
||||||
|
</DataCollectors>
|
||||||
|
</DataCollectionRunSettings>
|
||||||
|
</RunSettings>
|
|
@ -84,6 +84,36 @@ namespace Microsoft.DotNet.Cli.Test.Tests
|
||||||
result.ExitCode.Should().Be(1);
|
result.ExitCode.Should().Be(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[WindowsOnlyFact]
|
||||||
|
public void ItCreatesTwoCoverageFilesForMultiTargetedProject()
|
||||||
|
{
|
||||||
|
// Copy XunitMulti project in output directory of project dotnet-test.Tests
|
||||||
|
string testAppName = "XunitMulti";
|
||||||
|
var testInstance = TestAssets.Get(testAppName)
|
||||||
|
.CreateInstance("3")
|
||||||
|
.WithSourceFiles();
|
||||||
|
|
||||||
|
var testProjectDirectory = testInstance.Root.FullName;
|
||||||
|
|
||||||
|
string resultsDirectory = Path.Combine(testProjectDirectory, "RD");
|
||||||
|
|
||||||
|
// Delete resultsDirectory if it exist
|
||||||
|
if (Directory.Exists(resultsDirectory))
|
||||||
|
{
|
||||||
|
Directory.Delete(resultsDirectory, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Call test
|
||||||
|
CommandResult result = new DotnetTestCommand()
|
||||||
|
.WithWorkingDirectory(testProjectDirectory)
|
||||||
|
.ExecuteWithCapturedOutput($"{TestBase.ConsoleLoggerOutputNormal} --collect \"Code Coverage\" --results-directory {resultsDirectory}");
|
||||||
|
|
||||||
|
// Verify
|
||||||
|
DirectoryInfo d = new DirectoryInfo(resultsDirectory);
|
||||||
|
FileInfo[] coverageFileInfos = d.GetFiles("*.coverage", SearchOption.AllDirectories);
|
||||||
|
Assert.Equal(2, coverageFileInfos.Length);
|
||||||
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public void ItCanTestAMultiTFMProjectWithImplicitRestore()
|
public void ItCanTestAMultiTFMProjectWithImplicitRestore()
|
||||||
{
|
{
|
||||||
|
|
|
@ -9,6 +9,7 @@ using Microsoft.DotNet.Cli.Utils;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System;
|
using System;
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
|
using System.Xml;
|
||||||
|
|
||||||
namespace Microsoft.DotNet.Cli.Test.Tests
|
namespace Microsoft.DotNet.Cli.Test.Tests
|
||||||
{
|
{
|
||||||
|
@ -311,6 +312,100 @@ namespace Microsoft.DotNet.Cli.Test.Tests
|
||||||
result.ExitCode.Should().Be(1);
|
result.ExitCode.Should().Be(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
[WindowsOnlyFact]
|
||||||
|
public void ItCreatesCoverageFileWhenCodeCoverageEnabledByRunsettings()
|
||||||
|
{
|
||||||
|
var testProjectDirectory = this.CopyAndRestoreVSTestDotNetCoreTestApp("11");
|
||||||
|
|
||||||
|
string resultsDirectory = Path.Combine(testProjectDirectory, "RD");
|
||||||
|
|
||||||
|
// Delete resultsDirectory if it exist
|
||||||
|
if (Directory.Exists(resultsDirectory))
|
||||||
|
{
|
||||||
|
Directory.Delete(resultsDirectory, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
var settingsPath =Path.Combine(AppContext.BaseDirectory, "CollectCodeCoverage.runsettings");
|
||||||
|
|
||||||
|
// Call test
|
||||||
|
CommandResult result = new DotnetTestCommand()
|
||||||
|
.WithWorkingDirectory(testProjectDirectory)
|
||||||
|
.ExecuteWithCapturedOutput(
|
||||||
|
"--settings " + settingsPath
|
||||||
|
+ " --results-directory " + resultsDirectory);
|
||||||
|
|
||||||
|
// Verify test results
|
||||||
|
if (!DotnetUnderTest.IsLocalized())
|
||||||
|
{
|
||||||
|
result.StdOut.Should().Contain("Total tests: 2. Passed: 1. Failed: 1. Skipped: 0.");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Verify coverage file.
|
||||||
|
DirectoryInfo d = new DirectoryInfo(resultsDirectory);
|
||||||
|
FileInfo[] coverageFileInfos = d.GetFiles("*.coverage", SearchOption.AllDirectories);
|
||||||
|
Assert.Equal(1, coverageFileInfos.Length);
|
||||||
|
|
||||||
|
result.ExitCode.Should().Be(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
[WindowsOnlyFact]
|
||||||
|
public void ItCreatesCoverageFileInResultsDirectory()
|
||||||
|
{
|
||||||
|
var testProjectDirectory = this.CopyAndRestoreVSTestDotNetCoreTestApp("12");
|
||||||
|
|
||||||
|
string resultsDirectory = Path.Combine(testProjectDirectory, "RD");
|
||||||
|
|
||||||
|
// Delete resultsDirectory if it exist
|
||||||
|
if (Directory.Exists(resultsDirectory))
|
||||||
|
{
|
||||||
|
Directory.Delete(resultsDirectory, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Call test
|
||||||
|
CommandResult result = new DotnetTestCommand()
|
||||||
|
.WithWorkingDirectory(testProjectDirectory)
|
||||||
|
.ExecuteWithCapturedOutput(
|
||||||
|
"--collect \"Code Coverage\" "
|
||||||
|
+ "--results-directory " + resultsDirectory);
|
||||||
|
|
||||||
|
// Verify test results
|
||||||
|
if (!DotnetUnderTest.IsLocalized())
|
||||||
|
{
|
||||||
|
result.StdOut.Should().Contain("Total tests: 2. Passed: 1. Failed: 1. Skipped: 0.");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Verify coverage file.
|
||||||
|
DirectoryInfo d = new DirectoryInfo(resultsDirectory);
|
||||||
|
FileInfo[] coverageFileInfos = d.GetFiles("*.coverage", SearchOption.AllDirectories);
|
||||||
|
Assert.Equal(1, coverageFileInfos.Length);
|
||||||
|
|
||||||
|
result.ExitCode.Should().Be(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
[UnixOnlyFact]
|
||||||
|
public void ItShouldShowWarningMessageOnCollectCodeCoverage()
|
||||||
|
{
|
||||||
|
var testProjectDirectory = this.CopyAndRestoreVSTestDotNetCoreTestApp("13");
|
||||||
|
|
||||||
|
// Call test
|
||||||
|
CommandResult result = new DotnetTestCommand()
|
||||||
|
.WithWorkingDirectory(testProjectDirectory)
|
||||||
|
.ExecuteWithCapturedOutput(
|
||||||
|
"--collect \"Code Coverage\" "
|
||||||
|
+ "--filter VSTestPassTest");
|
||||||
|
|
||||||
|
// Verify test results
|
||||||
|
if (!DotnetUnderTest.IsLocalized())
|
||||||
|
{
|
||||||
|
result.StdOut.Should().Contain("No code coverage data available. Code coverage is currently supported only on Windows.");
|
||||||
|
result.StdOut.Should().Contain("Total tests: 1. Passed: 1. Failed: 0. Skipped: 0.");
|
||||||
|
result.StdOut.Should().Contain("Test Run Successful.");
|
||||||
|
}
|
||||||
|
|
||||||
|
result.ExitCode.Should().Be(0);
|
||||||
|
}
|
||||||
|
|
||||||
private string CopyAndRestoreVSTestDotNetCoreTestApp([CallerMemberName] string callingMethod = "")
|
private string CopyAndRestoreVSTestDotNetCoreTestApp([CallerMemberName] string callingMethod = "")
|
||||||
{
|
{
|
||||||
// Copy VSTestCore project in output directory of project dotnet-vstest.Tests
|
// Copy VSTestCore project in output directory of project dotnet-vstest.Tests
|
||||||
|
|
|
@ -16,4 +16,9 @@
|
||||||
<PackageReference Include="xunit.runner.visualstudio" Version="2.2.0" />
|
<PackageReference Include="xunit.runner.visualstudio" Version="2.2.0" />
|
||||||
<PackageReference Include="xunit" Version="2.2.0" />
|
<PackageReference Include="xunit" Version="2.2.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Update="CollectCodeCoverage.runsettings">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
|
Loading…
Reference in a new issue