You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: readme.md
+5-5
Original file line number
Diff line number
Diff line change
@@ -26,17 +26,17 @@ Let's assume your C# solution has the following folder structure:
26
26
To generate code coverage analysis, execute the following comment from a command prompt in your solution's root:
27
27
28
28
```PowerShell
29
-
.\packages\OpenCover.4.6.166\tools\OpenCover.Console.exe -register:user -target:"C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\MSTest.exe" -targetargs:"/noresults /noisolation /testcontainer:"".\MyProject Unit Tests\bin\Debug\MyProject.UnitTests.dll" -filter:"+[MyProject]* -[MyProject]MyProject.Properties.*" -excludebyattribute:*.ExcludeFromCodeCoverage* -hideskipped:All -output:.\MyProject_coverage.xml
29
+
.\packages\OpenCover.4.6.519\tools\OpenCover.Console.exe -register:user -target:"C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\MSTest.exe" -targetargs:"/noresults /noisolation /testcontainer:"".\MyProject Unit Tests\bin\Debug\MyProject.UnitTests.dll" -filter:"+[MyProject]* -[MyProject]MyProject.Properties.*" -excludebyattribute:*.ExcludeFromCodeCoverage* -hideskipped:All -output:.\MyProject_coverage.xml
30
30
```
31
31
32
32
This command makes a few assumptions which you will most likely have to adjust to meet your needs:
33
33
34
34
1. Use Visual Studio 2013
35
-
2. Use OpenCover v4.6.166, which is the latest version as of this writing, to generate code coverage. Of course you will need to adjust the path to the OpenCover package when new versions are available.
35
+
2. Use OpenCover v4.6.519, which is the latest version as of this writing, to generate code coverage. Of course you will need to adjust the path to the OpenCover package when new versions are available.
36
36
3. Unit tests are compiled in a DLL called .\MyProject Unit Tests\bin\Debug\MyProject.UnitTests.dll (replace 'Debug' with 'Release if you compile in 'Release' mode).
37
37
4. Code coverage will include all classes, methods and properties under the [MyProject] namespace except [MyProject]MyProject.Properties. These properties, typically, include your project version number, compiler options, etc. and therefore should be excluded from the code coverage report.
38
-
4. Any class decorated with the 'ExcludeFromCodeCoverage' attribute is automatically excluded from the coverage analysis.
39
-
5. Code coverage analysis is written to a XML file called MyProject_coverage.xml
38
+
5. Any class decorated with the 'ExcludeFromCodeCoverage' attribute is automatically excluded from the coverage analysis.
39
+
6. Code coverage analysis is written to a XML file called MyProject_coverage.xml
40
40
41
41
Now that you have generated your code coverage analysis, you must download Codecov's "upload script" and use it to upload your code coverage file to CodeCov.
42
42
@@ -61,7 +61,7 @@ If you use a CI, such as AppVeyor for example, you need to modify the 'after_tes
61
61
62
62
```YAML
63
63
after_test:
64
-
- .\packages\OpenCover.4.5.3522\OpenCover.Console.exe -register:user -target:"C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\MSTest.exe" -targetargs:"/noresults /noisolation /testcontainer:"".\MyProject Unit Tests\bin\Debug\MyProject.UnitTests.dll" -filter:"+[MyProject]* -[MyProject]MyProject.Properties.*" -excludebyattribute:*.ExcludeFromCodeCoverage* -hideskipped:All -output:.\MyProject_coverage.xml
64
+
- .\packages\OpenCover.4.6.519\OpenCover.Console.exe -register:user -target:"C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\MSTest.exe" -targetargs:"/noresults /noisolation /testcontainer:"".\MyProject Unit Tests\bin\Debug\MyProject.UnitTests.dll" -filter:"+[MyProject]* -[MyProject]MyProject.Properties.*" -excludebyattribute:*.ExcludeFromCodeCoverage* -hideskipped:All -output:.\MyProject_coverage.xml
0 commit comments