To exclude test code from the code coverage results and only include application code, add the ExcludeFromCodeCoverageAttribute attribute to your test class. To include assemblies that aren't part of your solution, obtain the . pdb files for these assemblies and copy them into the same folder as the assembly .
Configure coveragePress Ctrl+Alt+S to open the IDE settings and select Build, Execution, Deployment | Coverage. Define how the collected coverage data will be processed: Show options before applying coverage to the editor: show the Code Coverage dialog every time you run a new run configuration with code coverage.
Code Coverage vs Test Coverage. So, now we know that code coverage is a measure of how much code is executed during testing, while test coverage is a measure of how much of the feature set is covered with tests.
The easiest way to exclude code from code coverage analysis is to use ExcludeFromCodeCoverage attribute. This attribute tells tooling that class or some of its members are not planned to be covered with tests. EditFormModel class shown above can be left out from code coverage by simply adding the attribute.
Add --source=.
to the coverage
run line. It will both limit the focus to the current directory, and will search for .py
files that weren't run at all.
If you use nose
as a testrunner instead, the coverage plugin for it provides
--cover-inclusive Include all python files under working directory in
coverage report. Useful for discovering holes in test
coverage if not all files are imported by the test
suite. [NOSE_COVER_INCLUSIVE]
--cover-tests Include test modules in coverage report
[NOSE_COVER_TESTS]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With