NCOVER without NUNIT Test cases - code-coverage

I understand NCOVER is an awesome tool to instrument .dll and run Nunit test cases. Is it possible to instrument .dll's and run manual test cases using NCOVER?
If yes how? If not then is there a .NET tool that can provide such a provision?

Yes, you can run NCover on manually tested code, just the same as you would for unit tests or other automated code. You don't actually have to run a separate instrumentation step. Instrumentation is done automatically in the background.
In NCover 4 you would simply setup a project that monitors your application, and when it starts up NCover will automatically begin collecting coverage.

Related

How do I merge coverage reports of independent test runs

In our (grails 2.x) projects, we often have plugins, that come with their own unit tests, but are accompanied by testapps, which include the plugin inline, and run functional and integration tests.
To run the tests, we first run the unit tests on the plugin project, and then run the integration and functional tests on the test application.
I would like to start using code coverage metrics, but I need my data to be representative of all the tests that are running, not just unit tests that come embedded in the plugin source tree.
I have not yet chosen a particular code coverage solution, so this is a free variable that could help solve the issue.
Any help or insight appreciated

Android app code coverage without having JUnit or any other automated test case?

I have an full fledged android application and its source code but there is no JUnit or any other automated test cases are available for the app. How can I do code coverage test for it?
Is Jacoco any plugin like Gradle can be helpful in this scenario?
Thanks in adavance.
Our Java Test Coverage Tool can collect code coverage statistics regardless of how the application is exercised. It is not dependent on any specific unit test framework (although it can work any, including none).
If you run it with tests, you get "code coverage from tests". If you simply exercise the application manually, you get "what code does this manual operation exercise?" If you do a thorough manual exercising of the code, you get the equivalent of "what code does all of my manual testing" exercise.

How do I get SonarQube and Emma unit test coverage with Jacoco IT code coverage?

I'm trying to get Sonar IT Code coverage to work for me when my unit tests are "covered" via Emma.
My situation :
(1) I have unit tests that make extensive use of JMockit. Removing JMockit is not an option. I want to get unit test coverage reports for these tests.
(2) I have integration tests that simply run the core server side portion of the app (its a Spring web app) with different input scenarios. I want IT code coverage reports for this.
For part (1) I have chosen to use Emma for my unit test coverage mainly because I was having issues with Jacoco and JMockit working together due to both tangling each other up while instrumenting the java classes on the fly. There are some issues with these tools working together - with no solution that I saw as being reliable and non-invasive to the unit tests themselves. So in the end, I chose to use Emma as its does "offline instrumentation" to perform the code coverage. Jacoco does offline as well, but I could not get Sonar to pick up its results in this mode (Maybe I forgot a semi-colon :-) ).
For part (2) [ the IT code coverage part ] I have only seen the ability to specify the following property
sonar.jacoco.itReportPath=build/coverage/jacoco.exec
I can only assume, we need to use Jacoco to instrument the IT tests? Correct me if I'm wrong. So technically I can use Jacoco for this part of the tests because my integration tests do not use JMockit.
This is what I did. I have a separate ant task that recompiles the code base (stripping out the Emma instrumentation) and then repackages the application and runs the jacoco:coverage tool against my integration tests.
Problem is.. my unit tests are Emma based.. so how do you tell Sonar to use the Emma plugin for the Emma unit tests and the Jacoco plugin for the IT tests? Can this even be done?
Here is how I set up my Sonar properties:
sonar.test=test
sonar.sources=src
sonar.binaries=build/compile
# The value of the property must be the key of the language.
sonar.language=java
# Encoding of the source code
sonar.sourceEncoding=UTF-8
sonar.host.url=http://localhost:9000
sonar.dynamicAnalysis=reuseReports
sonar.java.coveragePlugin=emma
sonar.core.codeCoveragePlugin=emma
sonar.jacoco.itReportPath=build/coverage/jacoco.exec
sonar.emma.reportPath=build/coverage
sonar.junit.reportsPath=build/test/report
sonar.surefire.reportsPath=build/test/report
My ant build runs the Emma unit tests (output in Emma form) and then the IT tests are run with the output to the jacoco.exec file. Then I upload to Sonar.
I get the unit test coverage stats - not the IT stats. I'm not really surprised with the results.
But does anyone have an idea where I made a wrong turn?
You already made some efforts using jacoco for your unit-test-coverage. I would continue trying to make that solution work and maybe post your difficulties with that here.
I recommend to try using jacoco for both coverage reports, because Integration-Coverage can only be analysed with jacoco, as you can read here:
http://www.sonarqube.org/measure-coverage-by-integration-tests-with-sonar-updated/
I have consulted the documentation of sonarqube and configuration-websites and did not find a possibility to use different coverage plugins.
You can find the documentation for
Unit-Test-Coverage here: http://docs.codehaus.org/display/SONAR/Code+Coverage+by+Unit+Tests+for+Java+Project
and for Int-Test-Coverage here: http://docs.codehaus.org/display/SONAR/Code+Coverage+by+Integration+Tests+for+Java+Project

Sonar and Jenkins- Integration tests

I have a problem of comprehension.
Unit tests are coded by developers in order to test a class (Java).
Integration tests are aimed to know if the different classes work together.
My problem is:
Based on continuous integration: I have Subversion (SVN) linked to Jenkins, and Sonar linked to Jenkins.
How are the integration tests created? Who does them? Are these tests already available in Sonar, or developers have to code them? Sonar launches integration tests thanks to Jenkins? How does it work...?
Integration tests are also coded by developers, to test multiple classes at one time, conceptually a "module", whatever that means in your world.
In my world, unit tests are tests that exercise one class, and have no dependencies externally. We allow file system access for mock data and logging, but that's all.
If a test exercises an actual database, or a running executable somewhere (e.g. web service) it is an integration test. We write them with junit, same as a unit test.
We find it works best for us to have separate Jenkins jobs linked in a pipeline to build, execute unit tests, execute integration tests, and load Sonar. While SonarQube is able to run tests for you, we prefer the separation which allows us to manually execute either set of tests via Jenkins without updating Sonar at the same time.

Analyzing Code Coverage from GRUNT

I have a JavaScript-heavy app being built via GRUNT. To test this app, I have tests written with Jasmine. The tests are being run via Karma and Protractor. I would like to show code coverage of these tests in the command-line. My question is, how do I do this? I can't figure out how to integrate code coverage details within my build process. Ideally, I would love to see code coverage of my unit tests and code covereage of my integration tests.
Thank you.
I don't believe code-coverage is possible at this time with Protractor. Karma's code-coverage is made available via istanbul. It appears one would have to write a custom reporter. I agree this would be a nice feature. I may take some time in the near future to see if I can crank this out. If I make any progress, I will post here again.

Resources