Skip to content

Commit a1d47d3

Browse files
authored
Update documentation (#1018)
1 parent 740cf36 commit a1d47d3

14 files changed

+314
-260
lines changed

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Contributions are highly welcome, however, except for very small changes, kindly
1111

1212
Clone this repo:
1313

14-
git clone https://github.com/tonerdo/coverlet.git
14+
git clone https://github.com/coverlet-coverage/coverlet.git
1515
cd coverlet
1616

1717
Building, testing, and packing use all the standard dotnet commands:

Documentation/Changelog.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,4 +113,3 @@ coverlet.collector 1.1.0
113113
-Fix property attribute detection [#477](https://github.com/tonerdo/coverlet/pull/477) by https://github.com/amweiss
114114
-Fix instrumentation serialization bug [#458](https://github.com/tonerdo/coverlet/pull/458)
115115
-Fix culture for cobertura xml report [#464](https://github.com/tonerdo/coverlet/pull/464)
116-
Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
# Consume nightly build
22

3-
You can check metadata of nightly build packages here:
3+
You can check the metadata of nightly build packages here:
44

5-
Msbuild https://www.myget.org/feed/coverlet-dev/package/nuget/coverlet.msbuild
5+
MSBuild https://www.myget.org/feed/coverlet-dev/package/nuget/coverlet.msbuild
66
VSTest collector https://www.myget.org/feed/coverlet-dev/package/nuget/coverlet.collector
7-
.Net tools https://www.myget.org/feed/coverlet-dev/package/nuget/coverlet.console
7+
.NET tools https://www.myget.org/feed/coverlet-dev/package/nuget/coverlet.console
8+
9+
To consume nightly builds, create a `NuGet.Config` in your root solution directory and add the following content:
810

9-
To consume nightly build create a `NuGet.Config` on your root solution directory and add following content
1011
```xml
1112
<?xml version="1.0" encoding="utf-8"?>
1213
<configuration>
@@ -23,34 +24,38 @@ To consume nightly build create a `NuGet.Config` on your root solution directory
2324

2425
### Install packages
2526

26-
You can install nightly package using visual studio
27+
Visual Studio:
2728

2829
![File](images/nightly.PNG)
2930

30-
Nuget(PM console)
31-
```
31+
NuGet (Package Manager console):
32+
33+
```powershell
3234
PM> Install-Package coverlet.msbuild -Version 2.6.25-g6209239d69 -Source https://www.myget.org/F/coverlet-dev/api/v3/index.json
3335
```
3436

35-
.NET CLI
36-
```
37+
.NET CLI:
38+
39+
```bash
3740
dotnet add package coverlet.msbuild --version 2.6.25-g6209239d69 --source https://www.myget.org/F/coverlet-dev/api/v3/index.json
3841
```
3942

40-
.csproj
43+
MSBuild project file:
4144

42-
```
45+
```xml
4346
<PackageReference Include="coverlet.msbuild" Version="2.6.25-g6209239d69" />
4447
```
4548

4649
### How to verify version
4750

48-
You can understand which version you're using comparing nightly build release date and repo commits.
51+
You can understand which version you're using by comparing nightly build release date with repo commits.
52+
4953
For instance if we want to consume last msbuild nightly build:
54+
5055
* Go to https://www.myget.org/feed/coverlet-dev/package/nuget/coverlet.msbuild
5156
* Scroll down the page and check release date
5257
![File](images/nightly_1.PNG)
5358
* Go to repo commits and compare date and first part of commit hash
5459
![File](images/nightly_2.PNG)
5560

56-
As you can see we build at 00.00 UTC and build takes some seconds, so it's possible that release date won't be the same of commit repo.
61+
As you can see we build at 00.00 UTC and build takes some seconds, so it's possible that release date won't be the same as repo commits.

Documentation/DeterministicBuild.md

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,23 @@
11
# Deterministic build
22

3-
Deterministic build **is supported only** by `msbuild`(`/p:CollectCoverage=true`) and `collectors`(`--collect:"XPlat Code Coverage"`) drivers.
3+
Support for deterministic builds is available **only** in the `msbuild` (`/p:CollectCoverage=true`) and `collectors` (`--collect:"XPlat Code Coverage"`) drivers. Deterministic builds are important because they enable verification that the resulting binary was built from the specified sources. For more information on how to enable deterministic builds, I recommend you to take a look at [Claire Novotny](https://github.com/clairernovotny)'s [guide](https://github.com/clairernovotny/DeterministicBuilds).
44

5-
Deterministic builds are important as they enable verification that the resulting binary was built from the specified source and provides traceability.
6-
For more information on how to enable deterministic build I recommend you to take a look at [@clairernovotny](https://github.com/clairernovotny)'s guide https://github.com/clairernovotny/DeterministicBuilds
5+
From a coverage perspective, deterministic builds create some challenges because coverage tools usually need access to complete source file metadata (ie. local path) during instrumentation and report generation. These files are reported inside the `.pdb` files, where debugging information is stored.
76

8-
From coverage perspective deterministic build put some challenge because usually coverage tools need access to source file metadata (ie. local path) during instrumentation and report generation.
9-
These files are reported inside `pdb` files, where are stored debugging information needed by debuggers and also by tools that needs to work with "build" metadata information, for example generated `dll` modules and `source files` used.
10-
In local (non-CI) builds metadata emitted to pdbs are not "deterministic", that means that for instance source files path are reported with full path.
11-
If for instance we build same project on different machine we'll have different paths emitted inside pdbs, so builds are "non deterministic" because same project build won't generates same artifacts.
7+
In local (non-CI) builds, metadata emitted to pdbs are not "deterministic", which means that source files are reported with their full paths. For example, when we build the same project on different machines we'll have different paths emitted inside pdbs, hence, builds are "non deterministic".
128

13-
As explained above, to improve the level of security of generated artifacts (suppose for instance DLLs inside the nuget package), we need to apply some signature (signing with certificate) and validate before usage to avoid possible security issues like tampering.
14-
Finally thanks to deterministic CI builds (with the `ContinuousIntegrationBuild` property set to `true`) plus signature we can validate artifacts and be sure that binary was build from a specific sources (because there is no hard-coded variables metadata like paths from different build machines).
9+
As explained above, to improve the level of security of generated artifacts (for instance, DLLs inside the NuGet package), we need to apply some signature (signing with certificate) and validate before usage to avoid possible security issues like tampering.
10+
11+
Finally, thanks to deterministic CI builds (with the `ContinuousIntegrationBuild` property set to `true`) plus signature we can validate artifacts and be sure that the binary was built from specific sources (because there is no hard-coded variable metadata, like paths from different build machines).
1512

1613
**Deterministic build is supported without any workaround since version 3.1.100 of .NET Core SDK**
1714

1815
## Workaround only for .NET Core SDK < 3.1.100
1916

20-
At the moment deterministic build works thanks to Roslyn compiler that emits deterministic metadata if `DeterministicSourcePaths` is enabled. Take a look here for more information https://github.com/dotnet/sourcelink/tree/master/docs#deterministicsourcepaths.
21-
To allow coverlet to correctly do his work we need to provide information to translate deterministic path to real local path for every project referenced by tests project.
22-
The current workaround is to add on top of your repo a `Directory.Build.targets` with inside a simple snippet with custom `target` that supports coverlet resolution algorithm.
17+
At the moment, deterministic build works thanks to the Roslyn compiler emitting deterministic metadata if `DeterministicSourcePaths` is enabled. Take a look [here](https://github.com/dotnet/sourcelink/tree/master/docs#deterministicsourcepaths) for more information.
18+
19+
To allow Coverlet to correctly do its work, we need to provide information to translate deterministic paths to real local paths for every project referenced by the test project. The current workaround is to add at the root of your repo a `Directory.Build.targets` with a custom `target` that supports Coverlet resolution algorithm.
20+
2321
```xml
2422
<!-- This target must be imported into Directory.Build.targets -->
2523
<!-- Workaround. Remove once we're on 3.1.300+
@@ -46,9 +44,9 @@ https://github.com/dotnet/sourcelink/issues/572 -->
4644
</Project>
4745

4846
```
49-
If you already have a `Directory.Build.targets` file on your repo root you can simply copy `DeterministicBuild.targets` you can find on coverlet repo root next to yours and import it in your targets file.
50-
This target will be used by coverlet to generate on build phase a file on output folder with mapping translation informations, the file is named `CoverletSourceRootsMapping`.
47+
48+
If you already have a `Directory.Build.targets` file on your repo root you can simply copy `DeterministicBuild.targets` (which can be found at the root of this repo) next to yours and import it in your targets file. This target will be used by Coverlet to generate, at build time, a file that contains mapping translation information, the file is named `CoverletSourceRootsMapping` and will be in the output folder of your project.
5149

5250
You can follow our [step-by-step sample](Examples.md)
5351

54-
Feel free to file an issue in case of troubles!
52+
Feel free to file an issue in case you run into any trouble!

Documentation/DriversFeatures.md

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
11
# Driver feature differences
22

3-
Since the beginning all coverlet drivers shared the same coverage engine.
4-
Since version 3.0.0 we decided to consolidate versioning across drivers so for every new release all drivers will have the same version number.
5-
We think that keeping the versions in sync express better the set of features every release will have.
6-
This does not mean that all drivers will support every functionality/feature or have the same behaviours, since they are limited by the context they're running in.
7-
In the table below we keep track of main differences:
3+
All Coverlet drivers share the same coverage engine. Since version 3.0.0, we've consolidated versioning across drivers, so for every new release, all drivers will have the same version number.
4+
5+
We think that keeping the versions in sync better expresses the set of features every release will have. This does not mean that all drivers will support every functionality/feature or have the same behaviours, since they are limited by the context they're running in.
86

9-
| Feature | MsBuild | .NET Tool | DataCollectors |
10-
|----------|:-------------:|-------------:|----------------:|
11-
| .NET Core support(>= 2.0) | Yes | Yes |Yes |
12-
| .NET Framework support(>= 4.6.1) | Yes | Yes |Yes(since 3.0.0) |
13-
| Show result on console | Yes | Yes | No |
14-
| Deterministic reports output folder | Yes | Yes |No |
15-
| Merge reports | Yes | Yes |No |
16-
| Coverage threshold validation | Yes | Yes |No |
7+
In the table below we keep track of main differences:
178

9+
| Feature | MSBuild | .NET Tool | DataCollectors |
10+
|:-----------------------------------|:--------------|--------------|------------------|
11+
| .NET Core support(>= 2.0) | Yes | Yes | Yes |
12+
| .NET Framework support(>= 4.6.1) | Yes | Yes | Yes(since 3.0.0) |
13+
| Show result on console | Yes | Yes | No |
14+
| Configurable reports output folder | Yes | Yes | No |
15+
| Merge reports | Yes | Yes | No |
16+
| Coverage threshold validation | Yes | Yes | No |
1817

19-
If possible we advice you to use the collectors integration (vstest engine integration), since it is fully integrated inside the test pipeline and does not suffer of the [known issues](KnownIssues.md) of the other drivers.
18+
When possible, we advice you to use the collectors integration (VSTest engine integration), since it is fully integrated inside the test pipeline and does not suffer from the [known issues](KnownIssues.md) of the other drivers.

Documentation/Examples.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# Examples
2-
32
## MSBuild Integration
4-
* Use `/p:MergeWith` feature `Documentation/Examples/MSBuild/MergeWith/MergeWith.sln`
3+
4+
* Using `/p:MergeWith` feature `Documentation/Examples/MSBuild/MergeWith/MergeWith.sln`
55
* Deterministic build feature `Documentation/Examples/MSBuild/DeterministicBuild/DeterministicBuild.sln`
66

77
## VSTest Integration
8-
* 'HelloWorld' sample `Documentation/Examples/VSTest/HelloWorld/HelloWorld.sln`
9-
* Deterministic build feature `Documentation/Examples/VSTest/DeterministicBuild/DeterministicBuild.sln`
108

9+
* HelloWorld sample `Documentation/Examples/VSTest/HelloWorld/HelloWorld.sln`
10+
* Deterministic build feature `Documentation/Examples/VSTest/DeterministicBuild/DeterministicBuild.sln`

Documentation/GlobalTool.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ coverlet <ASSEMBLY> --target <TARGET> --targetargs <TARGETARGS> --output teamcit
119119
The currently supported [TeamCity statistics](https://confluence.jetbrains.com/display/TCD18/Build+Script+Interaction+with+TeamCity#BuildScriptInteractionwithTeamCity-ServiceMessages) are:
120120
121121
| TeamCity Statistic Key | Description |
122-
| :--- | :--- |
122+
|:------------------------|:-------------------------------|
123123
| CodeCoverageL | Line-level code coverage |
124124
| CodeCoverageB | Branch-level code coverage |
125125
| CodeCoverageM | Method-level code coverage |
@@ -226,9 +226,14 @@ Both `--exclude` and `--include` options can be used together but `--exclude` ta
226226
227227
You can also include coverage of the test assembly itself by specifying the `--include-test-assembly` flag.
228228
229+
## SourceLink
230+
231+
Coverlet supports [SourceLink](https://github.com/dotnet/sourcelink) custom debug information contained in PDBs. When you specify the `--use-source-link` flag, Coverlet will generate results that contain the URL to the source files in your source control instead of local file paths.
232+
229233
## Exit Codes
230234
231-
Coverlet outputs specific exit codes to better support build automation systems for determining failures and take action on it.
235+
Coverlet outputs specific exit codes to better support build automation systems for determining the kind of failure so the appropriate action can be taken.
236+
232237
```bash
233238
0 - Success.
234239
1 - If any test fails.

0 commit comments

Comments
 (0)