Skip to content

Commit 47cdd27

Browse files
authored
Use Xunit.v3 (latest release) (#1720)
* use xunit.v3 for unit tests Update dependencies and refactor test framework - Bump `Nerdbank.GitVersioning` to version `3.7.115`. - Add new package references for `Tmds.ExecFunction`, `xunit.v3`, and `System.Buffers`. - Remove outdated package references in `Directory.Packages.props`. - Update `Microsoft.NET.Test.Sdk` and `xunit` versions across projects. - Refactor tests to use standard `Fact` attributes instead of `ConditionalFact`. - Enhance logging and error handling in `CoverletInProcDataCollector` and `InstrumentationTask` tests. - Clean up deprecated code and comments in test files. - Adjust project files for compatibility with the latest .NET SDK. * cleanup '#pragma warning disable' * Update publish-coverage-results.yml * enabling Microsoft Testing Platform * enabling Microsoft Testing Platform for all tests * Revert "enabling Microsoft Testing Platform for all tests" This reverts commit 0447967. * enable Microsoft Testing Platform for coverlet core tests * remove filters handled by publish-coverage-results.yml * add test Execute_StateUnderTest_Success() * fix warning * Update package versions to use property references Refactor project files to replace hardcoded package version numbers with property references for improved maintainability. New properties added in `Directory.Packages.props` include `MicrosoftBuildVersion`, `MicrosoftCodeAnalysisVersion`, `MicrosoftNETTestSdkVersion`, `NugetPackageVersion`, `XunitV3Version`, and `XunitRunnerVisualstudioVersion`. Updated `PackageVersion` and `PackageReference` entries in relevant project files to utilize these properties, enhancing consistency and simplifying future version updates. * use Microsoft Testing Plaform for coverlet.msbuild.task.tests * Update projects to .NET 8 and improve CI configurations - Changed build configuration names in Azure Pipelines to lowercase for consistency. - Add `build.sh` with commands for building and testing with coverage. - Updated `build.yml` to reflect new casing and added diagnostic logging for test results. - Adjusted `coverlet.collector.csproj` and related project files for proper packaging and dependency resolution. - Modified `coverlet.msbuild.props` to set `CoverletToolsPath` based on the operating system. - Added new properties in `coverlet.integration.tests.csproj` for improved testing platform support. * small documentation update * Update changelog, documentation and add helper script `build.sh` * disable Microsoft.Testing.Platform for coverlet.msbuild.tasks.tests * Update NuGet package versions in Directory.Packages.props This commit updates several NuGet package versions in the `Directory.Packages.props` file, including: - `NugetPackageVersion` from `6.13.1` to `6.13.2` - `XunitV3Version` from `1.1.0` to `2.0.0` - `Microsoft.Extensions.Logging.Abstractions` from `8.0.2` to `8.0.3` - Fixed a syntax error in the `NuGet.Frameworks` package version line - `LinqKit.Microsoft.EntityFrameworkCore` from `8.1.7` to `8.1.8` - `xunit.v3` from `1.1.0` to `2.0.0` Other package versions remain unchanged, maintaining the overall structure of the file. * use property XunitV3Version * use property XunitRunnerVisualstudioVersion * incorporate review comments
1 parent e106d0d commit 47cdd27

File tree

111 files changed

+1343
-1039
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

111 files changed

+1343
-1039
lines changed

Directory.Packages.props

+29-20
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,33 @@
55
</PropertyGroup>
66
<ItemGroup>
77
<GlobalPackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" />
8-
<GlobalPackageReference Include="Nerdbank.GitVersioning" Version="3.7.112" />
8+
<GlobalPackageReference Include="Nerdbank.GitVersioning" Version="3.7.115" />
99
</ItemGroup>
10+
<PropertyGroup>
11+
<MicrosoftBuildVersion>17.13.9</MicrosoftBuildVersion>
12+
<MicrosoftCodeAnalysisVersion>4.12.0</MicrosoftCodeAnalysisVersion>
13+
<!-- Test Platform, .NET Test SDK and Object Model -->
14+
<MicrosoftNETTestSdkVersion>17.13.0</MicrosoftNETTestSdkVersion>
15+
<NugetPackageVersion>6.13.2</NugetPackageVersion>
16+
<XunitV3Version>2.0.0</XunitV3Version>
17+
<XunitRunnerVisualstudioVersion>3.0.2</XunitRunnerVisualstudioVersion>
18+
</PropertyGroup>
1019
<ItemGroup>
1120
<PackageVersion Include="DotNetConfig" Version="1.2.0" />
1221
<PackageVersion Include="Microsoft.Bcl.AsyncInterfaces" Version="8.0.0" />
13-
<PackageVersion Include="Microsoft.Build.Utilities.Core" Version="17.12.6" />
14-
<PackageVersion Include="Microsoft.Build.Framework" Version="17.12.6" />
22+
<PackageVersion Include="Microsoft.Build.Utilities.Core" Version="$(MicrosoftBuildVersion)" />
23+
<PackageVersion Include="Microsoft.Build.Framework" Version="$(MicrosoftBuildVersion)" />
1524
<PackageVersion Include="Microsoft.Build.Locator" Version="1.7.8" />
16-
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp" Version="4.12.0" />
25+
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp" Version="$(MicrosoftCodeAnalysisVersion)" />
1726
<PackageVersion Include="Microsoft.Extensions.DependencyModel" Version="8.0.2" />
1827
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="8.0.1" />
1928
<PackageVersion Include="Microsoft.Extensions.FileSystemGlobbing" Version="8.0.0" />
2029
<!--For test TestInstrument_NetstandardAwareAssemblyResolver_PreserveCompilationContext-->
21-
<PackageVersion Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.2" />
22-
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
23-
<PackageVersion Include="Microsoft.TestPlatform.ObjectModel" Version="17.12.0" />
30+
<PackageVersion Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.3" />
31+
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="$(MicrosoftNETTestSdkVersion)" />
32+
<PackageVersion Include="Microsoft.TestPlatform.ObjectModel" Version="$(MicrosoftNETTestSdkVersion)" />
2433
<!-- Microsoft.TestPlatform.ObjectModel has a dependency to NuGet.Frameworks with specific version -->
25-
<!-- https://github.com/microsoft/vstest/blob/9a0c41811637edf4afe0e265e08fdd1cb18109ed/src/Microsoft.TestPlatform.ObjectModel/Microsoft.TestPlatform.ObjectModel.csproj#L35-->
34+
<!-- https://github.com/microsoft/vstest/blob/9a0c41811637edf4afe0e265e08fdd1cb18109ed/src/Microsoft.TestPlatform.ObjectModel/Microsoft.TestPlatform.ObjectModel.csproj#L36-->
2635
<!-- wrong configuration will create "build\coverlet.msbuild.targets(72,5): error : Unable to read beyond the end of the stream." -->
2736
<!--
2837
vstest 17.5 version /scripts/build/TestPlatform.Dependencies.props
@@ -31,32 +40,32 @@
3140
NuGetFrameworksVersion is defined here https://github.com/microsoft/vstest/blob/9a0c41811637edf4afe0e265e08fdd1cb18109ed/eng/Versions.props#L94C1-L94C1
3241
-->
3342
<PackageVersion Include="Newtonsoft.Json" Version="13.0.3" />
34-
<PackageVersion Include="NuGet.Frameworks" Version="6.12.1" />
35-
<PackageVersion Include="NuGet.Packaging" Version="6.12.1" />
36-
<PackageVersion Include="NuGet.Versioning" Version="6.12.1" />
43+
<PackageVersion Include="NuGet.Frameworks" Version="$(NugetPackageVersion)" />
44+
<PackageVersion Include="NuGet.Packaging" Version="$(NugetPackageVersion)" />
45+
<PackageVersion Include="NuGet.Versioning" Version="$(NugetPackageVersion)" />
3746
<PackageVersion Include="Mono.Cecil" Version="0.11.6" />
3847
<PackageVersion Include="Moq" Version="4.20.72" />
3948
<PackageVersion Include="ReportGenerator.Core" Version="5.3.11" />
4049
<!--For test issue 809 https://github.com/coverlet-coverage/coverlet/issues/809-->
41-
<PackageVersion Include="LinqKit.Microsoft.EntityFrameworkCore" Version="8.1.7" />
50+
<PackageVersion Include="LinqKit.Microsoft.EntityFrameworkCore" Version="8.1.8" />
4251
<PackageVersion Include="System.CommandLine" Version="2.0.0-beta4.22272.1" />
4352
<!--To test issue 1104 https://github.com/coverlet-coverage/coverlet/issues/1104-->
53+
<!-- latest Tmds.ExecFunction package uses EnvDTE V17.8.37221 -->
54+
<PackageVersion Include="Tmds.ExecFunction" Version="0.8.0" />
55+
<PackageVersion Include="xunit.v3" Version="$(XunitV3Version)" />
56+
<PackageVersion Include="xunit.runner.visualstudio" Version="$(XunitRunnerVisualstudioVersion)" />
57+
<PackageVersion Include="System.Buffers" Version="4.6.0" />
4458
<PackageVersion Include="System.Collections.Immutable" Version="8.0.0" />
4559
<PackageVersion Include="System.Configuration.ConfigurationManager" Version="8.0.0" />
4660
<PackageVersion Include="System.Linq.Async" Version="6.0.1" />
47-
<PackageVersion Include="System.Reflection.Metadata" Version="8.0.1" />
48-
<PackageVersion Include="System.Threading.Tasks.Extensions" Version="4.6.0" />
49-
<PackageVersion Include="Tmds.ExecFunction" Version="0.8.0" />
50-
<PackageVersion Include="xunit" Version="2.9.2" />
51-
<PackageVersion Include="xunit.assemblyfixture" Version="2.2.0" />
52-
<PackageVersion Include="xunit.assert" Version="2.9.2" />
53-
<PackageVersion Include="xunit.runner.visualstudio" Version="2.8.2" />
54-
<PackageVersion Include="System.Buffers" Version="4.6.0" />
5561
<PackageVersion Include="System.Memory" Version="4.6.0" />
5662
<PackageVersion Include="System.Net.Http" Version="4.3.4" />
63+
<PackageVersion Include="System.Reflection.Metadata" Version="8.0.1" />
64+
<PackageVersion Include="System.Runtime.CompilerServices.Unsafe" Version="6.1.0" />
5765
<PackageVersion Include="System.Security.Cryptography.Pkcs" Version="6.0.5" />
5866
<PackageVersion Include="System.Text.Encoding.CodePages" Version="8.0.0" />
5967
<PackageVersion Include="System.Text.Json" Version="8.0.5" />
6068
<PackageVersion Include="System.Text.RegularExpressions" Version="4.3.1" />
69+
<PackageVersion Include="System.Threading.Tasks.Extensions" Version="4.6.0" />
6170
</ItemGroup>
6271
</Project>

Documentation/Changelog.md

+9-2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
66

77
## Unreleased
88

9+
### Fixed
10+
- use `<TargetFramework>netstandard2.0</TargetFramework>` for _coverlet.collector_ and _coverlet.msbuild.tasks_ Packages´
11+
12+
### Improvements
13+
- use [xunit.v3](https://xunit.net/docs/getting-started/v3/whats-new) for tests and example code
14+
15+
916
## Release date 2024-01-20
1017
### Packages
1118
coverlet.msbuild 6.0.4
@@ -60,8 +67,8 @@ coverlet.collector 6.0.1
6067
- Uncovered lines in .NET 8 for inheriting records [#1555](https://github.com/coverlet-coverage/coverlet/issues/1555)
6168
- Fix record constructors not covered when SkipAutoProps is true [#1561](https://github.com/coverlet-coverage/coverlet/issues/1561)
6269
- Fix .NET 7 Method Group branch coverage issue [#1447](https://github.com/coverlet-coverage/coverlet/issues/1447)
63-
- Fix ExcludeFromCodeCoverage does not exclude method in a partial class [#1548](https://github.com/coverlet-coverage/coverlet/issues/1548)
64-
- Fix ExcludeFromCodeCoverage does not exclude F# task [#1547](https://github.com/coverlet-coverage/coverlet/issues/1547)
70+
- Fix ExcludeFromCodeCoverage does not exclude method in a partial class [#1548](https://github.com/coverlet-coverage/coverlet/issues/1548)
71+
- Fix ExcludeFromCodeCoverage does not exclude F# task [#1547](https://github.com/coverlet-coverage/coverlet/issues/1547)
6572
- Fix issues where ExcludeFromCodeCoverage ignored [#1431](https://github.com/coverlet-coverage/coverlet/issues/1431)
6673
- Fix issues with ExcludeFromCodeCoverage attribute [#1484](https://github.com/coverlet-coverage/coverlet/issues/1484)
6774
- Fix broken links in documentation [#1514](https://github.com/coverlet-coverage/coverlet/issues/1514)

Documentation/ConsumeNightlyBuild.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ PM> Install-Package coverlet.msbuild -Version X.X.X-preview.X.XXX -Source https:
3333
Example:
3434

3535
```powershell
36-
PM> Install-Package coverlet.msbuild -Version 3.0.4-preview.4.g5de0ad7d60 -Source https://pkgs.dev.azure.com/tonerdo/coverlet/_packaging/coverlet-nightly/nuget/v3/index.json
36+
PM> Install-Package coverlet.msbuild -Version 6.0.4-preview.4.g5de0ad7d60 -Source https://pkgs.dev.azure.com/tonerdo/coverlet/_packaging/coverlet-nightly/nuget/v3/index.json
3737
```
3838

3939
### .NET CLI
@@ -45,7 +45,7 @@ PM> Install-Package coverlet.msbuild -Version 3.0.4-preview.4.g5de0ad7d60 -Sourc
4545
Example:
4646

4747
```bash
48-
dotnet add package coverlet.msbuild --version 3.0.4-preview.4.g5de0ad7d60 --source https://pkgs.dev.azure.com/tonerdo/coverlet/_packaging/coverlet-nightly/nuget/v3/index.json
48+
dotnet add package coverlet.msbuild --version 6.0.4-preview.4.g5de0ad7d60 --source https://pkgs.dev.azure.com/tonerdo/coverlet/_packaging/coverlet-nightly/nuget/v3/index.json
4949
```
5050

5151
### MSBuild project file
@@ -57,5 +57,5 @@ Example:
5757
Example:
5858

5959
```xml
60-
<PackageReference Include="coverlet.msbuild" Version="3.0.4-preview.4.g5de0ad7d60" />
60+
<PackageReference Include="coverlet.msbuild" Version="6.0.4-preview.4.g5de0ad7d60" />
6161
```

Documentation/DriversFeatures.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ In the table below we keep track of main differences:
88

99
| Feature | MSBuild | .NET Tool | DataCollectors |
1010
|:-----------------------------------|:--------------|--------------|------------------|
11-
| .NET Core support(>= 2.0) | Yes | Yes | Yes |
12-
| .NET Framework support(>= 4.6.1) | Yes | Yes | Yes(since 3.0.0) |
11+
| .NET Core support(>= 6.0) | Yes | Yes | Yes |
12+
| .NET Framework support(>= 4.7.2) | Yes | Yes | Yes(since 3.0.0) |
1313
| Show result on console | Yes | Yes | No |
1414
| Deterministic reports output folder| Yes | Yes | No |
1515
| Merge reports | Yes | Yes | No |

Documentation/Examples/MSBuild/DeterministicBuild/HowTo.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
To run test we need to generates packages to reference in on test project.
1+
To run test we need to generates packages to reference in on test project.
22
Run from repo root
33

44
```shell
@@ -44,9 +44,9 @@ Add msbuild package version generated to `"..\Documentation\Examples\MSBuild\Det
4444
</PropertyGroup>
4545

4646
<ItemGroup>
47-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
48-
<PackageReference Include="xunit" Version="2.6.5" />
49-
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.6">
47+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.13.0" />
48+
<PackageReference Include="xunit.v3" Version="1.1.0" />
49+
<PackageReference Include="xunit.runner.visualstudio" Version="3.0.2">
5050
<PrivateAssets>all</PrivateAssets>
5151
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
5252
</PackageReference>

Documentation/Examples/MSBuild/DeterministicBuild/XUnitTestProject1/XUnitTestProject1.csproj

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
</PropertyGroup>
88

99
<ItemGroup>
10-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
11-
<PackageReference Include="xunit" Version="2.6.6" />
12-
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.6">
10+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.13.0" />
11+
<PackageReference Include="xunit.v3" Version="1.1.0" />
12+
<PackageReference Include="xunit.runner.visualstudio" Version="3.0.2">
1313
<PrivateAssets>all</PrivateAssets>
1414
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
1515
</PackageReference>

Documentation/Examples/MSBuild/MergeWith/XUnitTestProject1/XUnitTestProject1.csproj

+4-4
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@
1111
<PrivateAssets>all</PrivateAssets>
1212
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
1313
</PackageReference>
14-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
15-
<PackageReference Include="xunit" Version="2.6.6" />
16-
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.6">
14+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.13.0" />
15+
<PackageReference Include="xunit.v3" Version="1.1.0" />
16+
<PackageReference Include="xunit.runner.visualstudio" Version="3.0.2">
1717
<PrivateAssets>all</PrivateAssets>
1818
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
19-
</PackageReference>
19+
</PackageReference>
2020
</ItemGroup>
2121

2222
<ItemGroup>

Documentation/Examples/MSBuild/MergeWith/XUnitTestProject2/XUnitTestProject2.csproj

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
<PrivateAssets>all</PrivateAssets>
1212
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
1313
</PackageReference>
14-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
15-
<PackageReference Include="xunit" Version="2.6.6" />
16-
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.6">
14+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.13.0" />
15+
<PackageReference Include="xunit.v3" Version="1.1.0" />
16+
<PackageReference Include="xunit.runner.visualstudio" Version="3.0.2">
1717
<PrivateAssets>all</PrivateAssets>
1818
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
1919
</PackageReference>

Documentation/Examples/MSBuild/MergeWith/XUnitTestProject3/XUnitTestProject3.csproj

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
<PrivateAssets>all</PrivateAssets>
1212
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
1313
</PackageReference>
14-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
15-
<PackageReference Include="xunit" Version="2.6.6" />
16-
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.6">
14+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.13.0" />
15+
<PackageReference Include="xunit.v3" Version="1.1.0" />
16+
<PackageReference Include="xunit.runner.visualstudio" Version="3.0.2">
1717
<PrivateAssets>all</PrivateAssets>
1818
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
1919
</PackageReference>

Documentation/Examples/VSTest/DeterministicBuild/HowTo.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ Add collectors package version generated to `"..\Documentation\Examples\VSTest\D
4444
</PropertyGroup>
4545

4646
<ItemGroup>
47-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
48-
<PackageReference Include="xunit" Version="2.6.5" />
49-
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.6">
47+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.13.0" />
48+
<PackageReference Include="xunit.v3" Version="1.1.0" />
49+
<PackageReference Include="xunit.runner.visualstudio" Version="3.0.2">
5050
<PrivateAssets>all</PrivateAssets>
5151
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
5252
</PackageReference>

Documentation/Examples/VSTest/DeterministicBuild/XUnitTestProject1/XUnitTestProject1.csproj

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
</PropertyGroup>
88

99
<ItemGroup>
10-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
11-
<PackageReference Include="xunit" Version="2.6.6" />
12-
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.6">
10+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.13.0" />
11+
<PackageReference Include="xunit.v3" Version="1.1.0" />
12+
<PackageReference Include="xunit.runner.visualstudio" Version="3.0.2">
1313
<PrivateAssets>all</PrivateAssets>
1414
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
1515
</PackageReference>

Documentation/Examples/VSTest/HelloWorld/XUnitTestProject1/XUnitTestProject1.csproj

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
</PropertyGroup>
99

1010
<ItemGroup>
11-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
12-
<PackageReference Include="xunit" Version="2.6.6" />
13-
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.6">
11+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.13.0" />
12+
<PackageReference Include="xunit.v3" Version="1.1.0" />
13+
<PackageReference Include="xunit.runner.visualstudio" Version="3.0.2">
1414
<PrivateAssets>all</PrivateAssets>
1515
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
1616
</PackageReference>

0 commit comments

Comments
 (0)