Skip to content

Commit

Permalink
fix markdown in README.md and update version of nuget packages (examp…
Browse files Browse the repository at this point in the history
…les) (#1567)

* fix markdown in README.me and update version of nuget packages in examples

* update PackageReference (Documentation)

* Update CheckNugetStatus.yml
  • Loading branch information
Bertk committed Jan 7, 2024
1 parent e9d16b0 commit 44b5587
Show file tree
Hide file tree
Showing 15 changed files with 93 additions and 55 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -305,10 +305,12 @@ DeterministicTest.props
test/coverlet.integration.determisticbuild/*.txt
test/coverlet.integration.determisticbuild/runsettings

coverage.json
coverage.xml
coverage.*.json
coverage.*.xml
coverage.cobertura.xml
coverage.opencover.xml
coverage.*.xml
coverage.*.cobertura.xml
coverage.*.opencover.xml

Expand Down
16 changes: 10 additions & 6 deletions Documentation/Examples/MSBuild/DeterministicBuild/HowTo.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Run from repo root
```shell
C:\git\coverlet
λ dotnet pack
Microsoft (R) Build Engine version 16.5.0+d4cbfca49 for .NET Core
Microsoft (R) Build Engine version 17.7.4+3ebbd7c49 for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.

Restore completed in 73,36 ms for C:\git\coverlet\src\coverlet.core\coverlet.core.csproj.
Expand Down Expand Up @@ -44,9 +44,12 @@ Add msbuild package version generated to `"..\Documentation\Examples\MSBuild\Det
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0" />
<PackageReference Include="xunit" Version="2.5.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="xunit" Version="2.6.5" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.6">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
<!-- version comes from coverlet.msbuild.6.0.1-preview.8.gcb9b802a5f.nupkg -->
<PackageReference Include="coverlet.msbuild" Version="coverlet.msbuild.6.0.1-preview.8.gcb9b802a5f.nupkg" >
<PrivateAssets>all</PrivateAssets>
Expand Down Expand Up @@ -97,8 +100,9 @@ Calculating coverage result...
+---------+------+--------+--------+
```

You should see on output folder the coverlet source root mapping file generated. The filename starts with 'CoverletSourceRootsMapping_'.
This is the confirmation that you're running coverage on deterministic build.
You should see on output folder the coverlet source root mapping file generated. The filename starts with 'CoverletSourceRootsMapping_'. Do not use `--no-build` option
This is the confirmation that you're running coverage on deterministic build e.g. `Documentation\Examples\MSBuild\DeterministicBuild\XUnitTestProject1\bin\Debug\net6.0\CoverletSourceRootsMapping_XUnitTestProject1`


```text
Documentation\Examples\MSBuild\DeterministicBuild\XUnitTestProject1\bin\Debug\net6.0\CoverletSourceRootsMapping_XUnitTestProject1
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
Expand All @@ -7,9 +7,12 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0" />
<PackageReference Include="xunit" Version="2.6.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.4" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="xunit" Version="2.6.5" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.6">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
<PackageReference Include="coverlet.msbuild" Version="ADD VERSION FROM bin\Debug\Packages generated running 'dotnet pack' from repo root" >
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,12 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0" />
<PackageReference Include="xunit" Version="2.6.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.4" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="xunit" Version="2.6.3" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.5">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,12 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0" />
<PackageReference Include="xunit" Version="2.6.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.4" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="xunit" Version="2.6.5" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.6">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,12 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0" />
<PackageReference Include="xunit" Version="2.6.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.4" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="xunit" Version="2.6.5" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.6">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
</ItemGroup>

<ItemGroup>
Expand Down
9 changes: 6 additions & 3 deletions Documentation/Examples/VSTest/DeterministicBuild/HowTo.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,12 @@ Add collectors package version generated to `"..\Documentation\Examples\VSTest\D
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0" />
<PackageReference Include="xunit" Version="2.5.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="xunit" Version="2.6.5" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.6">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
<!-- version comes from coverlet.coverlet.collector.6.0.1-preview.8.gcb9b802a5f.snupkg -->
<PackageReference Include="coverlet.collector.6.0.1-preview.8.gcb9b802a5f.nupkg" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,12 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0" />
<PackageReference Include="xunit" Version="2.6.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.4" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="xunit" Version="2.6.5" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.6">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="ADD VERSION FROM bin\Debug\Packages generated running 'dotnet pack' from repo root" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,13 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0" />
<PackageReference Include="xunit" Version="2.6.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.4" />
<PackageReference Include="coverlet.collector" Version="6.0.0">
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="xunit" Version="2.6.5" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.6">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="6.0.0" >
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
4 changes: 2 additions & 2 deletions Documentation/GlobalTool.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ coverlet --help

The current options are (output of `coverlet --help`):

```bash
Cross platform .NET Core code coverage tool 3.0.0.0
```text
Cross platform .NET Core code coverage tool 6.0.0.0
Usage: coverlet [arguments] [options]
Expand Down
4 changes: 2 additions & 2 deletions Documentation/KnownIssues.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,12 @@ If you upgrade the collector package with a version greater than 1.0.0, in-proc
*Solutions:*
1) Reference `Microsoft.NET.Test.Sdk` with version *greater than* 17.5.0
1) Reference `Microsoft.NET.Test.Sdk` with version *greater than* 17.7.0
```xml
<ItemGroup>
...
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
...
</ItemGroup>
```
Expand Down
8 changes: 4 additions & 4 deletions Documentation/Troubleshooting.md
Original file line number Diff line number Diff line change
Expand Up @@ -177,10 +177,10 @@ To use/debug local collectors build we need to tell to our project to restore an
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.2.0" />
<PackageReference Include="xunit" Version="2.4.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.0" />
<PackageReference Include="coverlet.collector" Version="1.0.67" /> <-- My local package version
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="xunit" Version="2.6.5" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.6" />
<PackageReference Include="coverlet.collector" Version="6.0.0" /> <-- My local package version -->
</ItemGroup>
<ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions Documentation/VSTestIntegration.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ A sample project file looks like:
<TargetFrameworks>net6.0;net48</TargetFrameworks>
</PropertyGroup>
<ItemGroup>
<!-- Minimum version 17.5.0 -->
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0" />
<!-- Minimum version 17.7.0 -->
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<!-- Update this reference when new version is released -->
<PackageReference Include="coverlet.collector" Version="6.0.0">
<PrivateAssets>all</PrivateAssets>
Expand Down
39 changes: 25 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ Coverlet is a cross platform code coverage framework for .NET, with support for
**Coverlet documentation reflect the current repository state of the features, not the released ones.**
**Check the [changelog](Documentation/Changelog.md) to understand if the documented feature you want to use has been officially released.**

# Main contents
## Main contents

* [QuickStart](#quick-start)
* [How It Works](#how-it-works)
* [Drivers features differences](Documentation/DriversFeatures.md)
Expand All @@ -38,13 +39,16 @@ Coverlet supports only SDK-style projects https://docs.microsoft.com/en-us/visua

### VSTest Integration (preferred due to [known issue](https://github.com/coverlet-coverage/coverlet/blob/master/Documentation/KnownIssues.md#1-vstest-stops-process-execution-earlydotnet-test))

### Installation
### Installation (coverlet.collector)

```bash
dotnet add package coverlet.collector
```
N.B. You **MUST** add package only to test projects and if you create xunit test projects (`dotnet new xunit`) you'll find the reference already present in `csproj` file because Coverlet is the default coverage tool for every .NET Core and >= .NET 5 applications, you've only to update to last version if needed.

### Usage
N.B. You **MUST** add package only to test projects and if you create xunit test projects (`dotnet new xunit`) you'll find the reference already present in `csproj` file because Coverlet is the default coverage tool for every .NET Core and >= .NET 6 applications, you've only to update to last version if needed. Do not add `coverlet.collector` and `coverlet.msbuild` package in a test project.

### Usage (coverlet.collector)

Coverlet is integrated into the Visual Studio Test Platform as a [data collector](https://github.com/Microsoft/vstest-docs/blob/master/docs/extensions/datacollector.md). To get coverage simply run the following command:

```bash
Expand All @@ -55,22 +59,26 @@ After the above command is run, a `coverage.cobertura.xml` file containing the r

See [documentation](Documentation/VSTestIntegration.md) for advanced usage.

#### Requirements
#### Requirements (coverlet.collector)

* _You need to be running .NET 6.0 SDK v6.0.316 or newer_
* _You need to reference version 17.5.0 and above of Microsoft.NET.Test.Sdk_
```

```xml
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0" />
```

### MSBuild Integration (suffers of possible [known issue](https://github.com/coverlet-coverage/coverlet/blob/master/Documentation/KnownIssues.md#1-vstest-stops-process-execution-earlydotnet-test))

### Installation
### Installation (coverlet.msbuild)

```bash
dotnet add package coverlet.msbuild
```
N.B. You **MUST** add package only to test projects

### Usage
N.B. Typically you **MUST** add package only to test projects. Do not add `coverlet.msbuild` and `coverlet.collector` package in a test project.

### Usage (coverlet.msbuild)

Coverlet also integrates with the build system to run code coverage after tests. Enabling code coverage is as simple as setting the `CollectCoverage` property to `true`

Expand All @@ -82,18 +90,19 @@ After the above command is run, a `coverage.json` file containing the results wi

See [documentation](Documentation/MSBuildIntegration.md) for advanced usage.

#### Requirements
#### Requirements (coverlet.msbuild)

Requires a runtime that support _.NET Standard 2.0 and above_

### .NET Global Tool ([guide](https://docs.microsoft.com/en-us/dotnet/core/tools/global-tools), suffers from possible [known issue](https://github.com/coverlet-coverage/coverlet/blob/master/Documentation/KnownIssues.md#1-vstest-stops-process-execution-earlydotnet-test))

### Installation
### Installation (coverlet.console)

```bash
dotnet tool install --global coverlet.console
```

### Usage
### Usage (coverlet.console)

The `coverlet` tool is invoked by specifying the path to the assembly that contains the unit tests. You also need to specify the test runner and the arguments to pass to the test runner using the `--target` and `--targetargs` options respectively. The invocation of the test runner with the supplied arguments **must not** involve a recompilation of the unit test assembly or no coverage result will be generated.

Expand All @@ -107,12 +116,12 @@ _Note: The `--no-build` flag is specified so that the `/path/to/test-assembly.dl

See [documentation](Documentation/GlobalTool.md) for advanced usage.

#### Requirements
#### Requirements (coverlet.console)

.NET global tools rely on a .NET Core runtime installed on your machine https://docs.microsoft.com/en-us/dotnet/core/tools/global-tools#what-could-go-wrong

.NET Coverlet global tool requires _.NET Core 2.2 and above_


## How It Works

Coverlet generates code coverage information by going through the following process:
Expand Down Expand Up @@ -148,10 +157,12 @@ If you're using [Cake Build](https://cakebuild.net) for your build script you ca
If you want to visualize coverlet output inside Visual Studio while you code, you can use the following addins depending on your platform.

### Windows

If you're using Visual Studio on Windows, you can use the [Fine Code Coverage](https://marketplace.visualstudio.com/items?itemName=FortuneNgwenya.FineCodeCoverage) extension.
Visualization is updated when you run unit tests inside Visual Studio.

### Mac OS

If you're using Visual Studio for Mac, you can use the [VSMac-CodeCoverage](https://github.com/ademanuele/VSMac-CodeCoverage) extension.

## Consume nightly build
Expand Down
2 changes: 1 addition & 1 deletion eng/CheckNugetStatus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ parameters:
breakBuild: false

steps:
- task: NuGetAuthenticate@0
- task: NuGetAuthenticate@1
condition: ${{parameters.condition}}
enabled: ${{parameters.enableQualitySteps}}

Expand Down

0 comments on commit 44b5587

Please sign in to comment.