Questions tagged [code-coverage]

"Code coverage" (synonym: test coverage) is a measure of the amount of application source code that has been exercised, usually by some testing regime, often by unit testing.

Code coverage is a measure of the amount of application source code that has been exercised, usually by some testing regime, often by unit testing. There are two key questions: given an exercise regime, how much of the source code is executed (under the assumption that the exercise also shows the program effects to be correct), and, given an exercise regime, how does one increase the coverage amount by modifying the exercise.

Determining the actual coverage is normally accomplished by instrumenting the source code to track when its elements are executed, and then simply running the exercise regime. The instrumented data is collected and often displayed in a report and/or a visual display.

Improving coverage given a specific exercise regime is difficult. One must determine for some block of uncovered code, how to cause that code to be executed, often requiring a complex initialization of the program environment to trigger the code block.

Code coverage is also known as , but see that tag's wiki for an alternate meaning.

5306 questions
3
votes
0 answers

Jacoco in Android - Enforcing code coverage metrics

Need help on enforcing code coverage metrics. I have based my solution on this blog post. I have already referred following posts in an attempt to solve this problem. this series of posts this one on Jacoco with java project (not android) this…
3
votes
1 answer

An AxoCover-like experience for .NET Core

I'm using AxoCover extension, and I'm used to this coverage visualization like so in the screenshot below: Can't really find anything that would do the same thing for .NET Core. Can anybody point me out any .NET Core alternative for this extension?
3
votes
1 answer

Visual Studio Enterprise Code Coverage report in TeamCity

Does anyone have any experience importing Visual Studio Enterprise 2017 code coverage results (either *.coverage or *.coveragexml) into TeamCity? We're testing a C++ project, so we cannot use TeamCitys built in coverage report tools. The help page…
Adam Bennett
  • 92
  • 1
  • 5
3
votes
0 answers

Jasmine testing, .not.toHaveBeenCalled();

I am doing unit testing with Jasmine, and Instanbul. I am testing a submit form. And I have already several unit tests for it. But now I want that if: this.allowSubmitAgain = false; this method: this.diplomaService.saveDiplomaMetaData(false,…
3
votes
3 answers

ruby rspec wont work with simplecov

I installed simplecov gem and added require 'simplecov' SimpleCov.start to the spec_helper.rb file, now if i include spec_helper.rb in my some_file_spec.rb file and try to run it i get…
Konstantin
  • 41
  • 1
  • 4
3
votes
1 answer

Can TFS 2010 Workflow-based team build get Code Coverage results?

Using Workflow to create a build I'd like for the build quality to change depending if the current code coverage threshold is met. I have everything set up but the condition to check the coverage percentages. Is there a way to test if…
Scott Root
  • 582
  • 4
  • 6
3
votes
0 answers

How can I generate code coverage for .Net Core 2.x from integration tests on linux/mac?

I am doing .NET core 2 work on a mac (and my build server is linux) and I'm looking for a way to generate code coverage for integration tests that use and embedded web server as the system under test. I can get coverage for my unit tests but not…
Windfall_J
  • 31
  • 2
3
votes
1 answer

Coverall branches [[0,0]] missed meaning?

I'm just starting out with Coveralls and testing coverage and I see info such as this. What do the arrays mean? How should I interpret these? I can't seem to find anywhere in the docs or online regarding the meaning of these.
rb612
  • 5,280
  • 3
  • 30
  • 68
3
votes
0 answers

Jest + Istanbul: collect coverage for functions called directly from the tests only

Problem Is there a way to configure Istanbul/Jest to collect a separate code coverage metric? The metric should count the visited lines/branches of code but only when the line is executed as a part of a direct call to containing…
Igor Soloydenko
  • 11,067
  • 11
  • 47
  • 90
3
votes
1 answer

Where do I define Arbitrary instances?

I can't figure out where to define Arbitrary instances for my datatype. If I put it in the package, then the package unnecessarily has to have QuickCheck as a dependency. If I put it in the tests, then other packages can't make use of the instance.…
dspyz
  • 5,280
  • 2
  • 25
  • 63
3
votes
0 answers

Coverage is undefined

I ma trying to generate some coverage for my tests in Protractor. I am using Istanbul Istanbul and also I am following this tutorial: coverage My code inside [protr.conf.js is this: var istanbul = require('istanbul'); var collector = new…
John Dow
  • 47
  • 2
  • 7
3
votes
1 answer

Inline comment directives to coverage and to flake8

Assume I have the following __init__py: # __init__.py from . import my_foo Just like so, flake8 would complain with F401. This can be resolved by: # __init__.py from . import my_foo # NOQA: F401 On the other hand, cov plugin of pytest would…
Dror
  • 12,174
  • 21
  • 90
  • 160
3
votes
2 answers

More metrics for CodeCoverage Elixir

Background I have a test suite and I need to know the coverage of the project. I have played around with mix test --cover but I find the native erlang's coverage analysis tool to be insufficient at best. The native coverage tool doesn't tell you…
Flame_Phoenix
  • 16,489
  • 37
  • 131
  • 266
3
votes
1 answer

PHPUnit - PHP_Token_Stream error on clover-coverage

I am using PHPUnit 3.5.10, and having a problem trying to generate xml reports for clover-coverage. Exporting with coverage-html works fine. Also, if I exclude enough files from the coverage report it will generate the clover.xml file. However, when…
jonmc12
  • 562
  • 8
  • 11
3
votes
0 answers

coverlet does not create out put file

I have created a small sample application(.Netcore 1.1) and installed coverlet. I also added a unit test project (MSTEST) to the above mention application. when I run the bellow script in power-shell the test passes successfully but I don't get any…
Bijan
  • 41
  • 3