We have seperate integration test project which fires the integration test cases on different modules . At present we do not have unit test cases within each module. We would like to ensure that the integration test covers most of the domain functionality.
Since we have the integration tests in a different project , Sonar always reports the test coverage as zero for the modules under test.
Is there any way to have the test coverage reported on a project , when the actual test is run from a different project
Thanks
You should be able to achieve what you want by reading the Code Coverage documentation page on the wiki. Most notably, you'll be able to use the following sample project to see how it works:
IT JaCoCo Sonar Runner sample project
Basically, you have to run your integration tests first using JaCoCo to generate the coverage report (jacoco.exec) and then you reuse this report during the SonarQube analysis.
Related
I want to get the test coverage of my functional / integration automation test cases written in a different repo.
So developers write development code in different repo and integration test cases are in a different repo.
So the question is, is it possible to get the test coverage when both source code and tests are in different repos?
Here is my scenario.
I have a code base, which is built and deployed as EAR on jBoss server.
I have a separate testing framework.
Now I want to run the classes of that EAR using my testing framework.
The test cases are written in TestNG.
Also I want to know the code coverage of the EAR.
I have used eclEmma to do code coverage for Junits, it was simple as the code and tests are at same place.
How can I use Emma in the case of remote code base. Please help.
EclEmma is Eclipse plugin based on JaCoCo - Java Code Coverage Library. JaCoCo provides various ways for collection of code coverage. In particular you can attach it to the server as a Java agent and request information about coverage remotely. And even import and show it in Eclipse using EclEmma.
I have list of Selenium Webdriver testcase written in Junit Test cases which runs, on demand. currently i am running that and manually sending the report for Pass/Fail count on weekend.
I need that it should run on each weekend and send out the report to me for pass/fail count. There are two tools i come across. Jenkins and maven. I am new to both.. which is best for requirement?
Thanks,
Chandra
Jenkins is the correct option here
Maven is a build tool, where we know the build procedure and its dependencies
It can be used in your project to create the class file or jar files required
Jenkins is a Continuous Integration tool, which can be used to schedule and run tasks where you can execute your test cases , report the test result via email.. you can view it as server which executes your tests and provide you the results
I am trying to get bytecode coverage analysis using a code coverage tool (like Emma or Jacoco) after testing with a GUI based functional testing tool (like HP QuickTest Pro or Selenium).
Anyone who has done this could please give me an idea to start this project?
I am doing this now. My approach is to use JaCoCo ant tasks to instrument the binary byte-code files, and use a specific CLASSPATH to execute the instrumented binaries from an ant build.xml from Jenkins.
The reason for doing the code coverage from byte-code is that there is an existing set-up that runs test scripts for a large application using HP QuickTest Pro . I would imagine that the test coverage is in the single digits, but we need an empirical baseline to demonstrate the possible improvements in code coverage from doing unit tests during a build.
Is it possible to run unit tests when a non-maven project is analyzed with Sonar, in Sonar light mode?
Sonar doesn't run unit tests. But it should be able to analyze existing unit tests reports. From Reuse in Sonar unit test reports generated by other systems:
2. Using Sonar in its full capability in an ANT environment
If you are using ANT to build your
applications, the main weakness so far
in Sonar was that it did not allow to
display Unit tests results nor Code
coverage. I am sure that now you have
read the first use case, you know that
by using the
“-Dsonar.dynamicAnalysis=reuseReports”
parameter, this limitation does not
exist anymore. You simply need to
specify where those reports to reuse
are going to be found, by using the
following properties :
sonar.cobertura.reportPath,
sonar.clover.reportPath,
sonar.surefire.reportsPath...