Skip to content

Commit 4c496ab

Browse files
committed
update README.md with more detailed info about coverlet
1 parent 1d92ee6 commit 4c496ab

File tree

1 file changed

+71
-1
lines changed

1 file changed

+71
-1
lines changed

README.md

Lines changed: 71 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,74 @@
22
[![Build status](https://ci.appveyor.com/api/projects/status/6rdf00wufospr4r8?svg=true)](https://ci.appveyor.com/project/tonerdo/coverlet)
33
[![Coverage Status](https://coveralls.io/repos/github/tonerdo/coverlet/badge.svg?branch=master)](https://coveralls.io/github/tonerdo/coverlet?branch=master)
44
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
5-
# coverlet
5+
# coverlet
6+
7+
Coverlet is a cross platform code coverage library for .NET Core, with support for line and method coverage.
8+
9+
## Installation
10+
11+
Available on [NuGet](https://www.nuget.org/packages/coverlet.msbuild/)
12+
13+
Visual Studio:
14+
15+
```powershell
16+
PM> Install-Package coverlet.msbuild
17+
```
18+
19+
.NET Core CLI:
20+
21+
```bash
22+
dotnet add package coverlet.msbuild
23+
```
24+
25+
## How It Works
26+
27+
Coverlet integrates with the MSBuild system and that allows it to go through the following process:
28+
29+
### Before Tests Run
30+
31+
* Locate the unit test assembly and selects all the referenced assemblies that have PDBs.
32+
* Instruments the selected assemblies by inserting code to record sequence point hits to a temporary file.
33+
34+
### After Tests Run
35+
36+
* Restore the original non-instrumented assembly files.
37+
* Read the recorded hits information from the temporary file.
38+
* Generate the coverage result from the hits information and write it to a file.
39+
40+
## Usage
41+
42+
Coverlet deosn't require any additional setup other than including the NuGet package. It integrates with the `dotnet test` infrastructure built into the .NET Core CLI and when enabled will automatically generate coverage results after tests are run.
43+
44+
### Code Coverage
45+
46+
Enabling code coverage is as simple as setting the `CollectCoverage` property to `true`
47+
48+
```bash
49+
dotnet test /p:CollectCoverage=true
50+
```
51+
52+
After the above command is run, a `coverage.json` file containing the results will be generated in the root directory of the test project. A summary of the results will also be displayed in the terminal.
53+
54+
### Coverage Output
55+
56+
Coverlet can generate coverage results in multiple formats, which is specified using the `CoverletOutputFormat` property. Possible values include `json` (default), `lcov` and `opencover`. For example, the following command emits coverage results in the opencover format:
57+
58+
```bash
59+
dotnet test /p:CollectCoverage=true /p:CoverletOutputFormat=opencover
60+
```
61+
62+
The output folder of the coverage result file can also be specified using the `CoverletOutputDirectory` property.
63+
64+
## Roadmap
65+
66+
* Branch coverage
67+
* Console runner (removes the need for requiring a NuGet package)
68+
69+
## Issues & Contributions
70+
71+
If you find a bug or have a feature request, please report them at this repository's issues section. Contributions are highly welcome, however, except for very small changes, kindly file an issue and let's have a discussion before you open a pull request.
72+
73+
## License
74+
75+
This project is licensed under the MIT license. See the [LICENSE](LICENSE) file for more info.

0 commit comments

Comments
 (0)