Skip to content

Commit

Permalink
Enable code coverage for acceptance tests (#2107)
Browse files Browse the repository at this point in the history
  • Loading branch information
Evangelink authored Jan 15, 2024
1 parent c99c7bb commit 6bd81c4
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
6 changes: 5 additions & 1 deletion eng/Version.Details.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@
<Uri>https://github.com/dotnet/arcade</Uri>
<Sha>d731f58a502086842739a358ab490bec08fdb8a7</Sha>
</Dependency>
<Dependency Name="Microsoft.Testing.Platform" Version="1.0.0-preview.24065.5">
<Dependency Name="Microsoft.Testing.Extensions.CodeCoverage" Version="17.10.1-preview.24065.1">
<Uri>https://dev.azure.com/devdiv/DevDiv/_git/vs-code-coverage</Uri>
<Sha>eb7f655d26aad09abc9da2ea1814f4debc70559b</Sha>
</Dependency>
<Dependency Name="Microsoft.Testing.Platform" Version="1.0.0-preview.24065.2">
<Uri>https://github.com/microsoft/testanywhere</Uri>
<Sha>c0709917bef3809ed89441a6c36ec1033a099387</Sha>
</Dependency>
Expand Down
1 change: 1 addition & 0 deletions eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
<PropertyGroup Label="MSTest test dependencies">
<FluentAssertionsVersion>6.12.0</FluentAssertionsVersion>
<MicrosoftCodeAnalysisAnalyzerTestingVersion>1.1.2-beta1.23431.1</MicrosoftCodeAnalysisAnalyzerTestingVersion>
<MicrosoftTestingExtensionsCodeCoverageVersion>17.10.1-preview.24065.1</MicrosoftTestingExtensionsCodeCoverageVersion>
<!-- Pinned to 4.18.4 for security -->
<MoqVersion>4.18.4</MoqVersion>
<MSBuildStructuredLogger>2.1.858</MSBuildStructuredLogger>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@
<ImplicitUsings>true</ImplicitUsings>
<Nullable>enable</Nullable>
<GenerateProgramFile>false</GenerateProgramFile>
<DefineConstants>$(DefineConstants);ENABLE_CODECOVERAGE</DefineConstants>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="MSBuild.StructuredLogger" Version="$(MSBuildStructuredLogger)" />
<PackageReference Include="Microsoft.Testing.Extensions.CodeCoverage" Version="$(MicrosoftTestingExtensionsCodeCoverageVersion)" />
<PackageReference Include="Microsoft.Testing.Extensions.CrashDump" Version="$(MicrosoftTestingPlatformVersion)" GeneratePathProperty="True" />
<PackageReference Include="Microsoft.Testing.Extensions.TrxReport" Version="$(MicrosoftTestingPlatformVersion)" GeneratePathProperty="True" />
<PackageReference Include="Microsoft.Testing.Framework" Version="$(MicrosoftTestingPlatformVersion)" GeneratePathProperty="True" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,14 @@
using Microsoft.Testing.Framework.Configurations;
using Microsoft.Testing.Platform.Acceptance.IntegrationTests;
using Microsoft.Testing.Platform.CommandLine;
#if ENABLE_CODECOVERAGE
using Microsoft.Testing.Extensions.CodeCoverage;
#endif
using Microsoft.Testing.Platform.Extensions.TestHost;

ITestApplicationBuilder builder = await TestApplication.CreateBuilderAsync(args);
builder.TestHost.AddTestApplicationLifecycleCallbacks(sp => new GlobalTasks(sp.GetCommandLineOptions()));

builder.AddTestFramework(new TestFrameworkConfiguration(Debugger.IsAttached ? 1 : Environment.ProcessorCount), new SourceGeneratedTestNodesBuilder());
#if ENABLE_CODECOVERAGE
builder.AddCodeCoverage();
builder.AddCodeCoverageProvider();
#endif
builder.AddCrashDumpProvider();
builder.AddTrxReportProvider();
Expand Down

0 comments on commit 6bd81c4

Please sign in to comment.