Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancement: Activate JaCoCo during regression test execution #12

Open
deors opened this issue Apr 15, 2016 · 3 comments
Open

Enhancement: Activate JaCoCo during regression test execution #12

deors opened this issue Apr 15, 2016 · 3 comments

Comments

@deors
Copy link

deors commented Apr 15, 2016

Activate JaCoCo during regression test execution so we can gather coverage from those tests and afterwards pull them into SonarQube. This is useful specially for the overall code coverage metrics, which calculates the coverage from unit and integration tests combined.

@anton-kasperovich
Copy link
Contributor

@deors please, take a look on PR's which in referenced

@deors
Copy link
Author

deors commented Jun 7, 2016

Hi @anton-kasperovich. The PR looks good, and it brings calculation of code coverage of unit tests and the publishing of the results to SonarQube. However I had in mind specifically the code coverage of regression tests (Cucumber, Selenium and what-not).

Activating this it is a bit more challenging, and would involve these steps:

  1. Activate code coverage in the CI server. The CI server instance must be launched with JaCoCo agent enabled.
  2. Afterwards, before test execution starts, a reset remote call to the agent is executed, to ensure there is not coverage information accumulated from a previous run on the environment.
  3. Execute the regression tests as usual. This can include as many tools we leverage during that phase, inclusive of performance tests. However I would not recommend running performance tests with code coverage activated, because it has a hit in performance.
  4. After regression tests are executed, a dump remote call to the agent is executed, and the reports are pulled from the server.
  5. Ideally, pass that report to SonarQube. This is dependent with Enhancement: Move SonarQube step after regression tests are executed #11, as code analysis step must occur after all the tests, so it can load results from regression and performance tests, optionally using those metrics for the quality gate of the project.

Note: instead of playing with reset/dump commands, it is possible to work with sessions in JaCoCo, but I think it would add more complexity to the setup of the jobs.

For more information on how to issue the dump/reset commands, you can see references in JaCoCo FAQ, Ant task, Maven plug-in and can also be controlled through JMX extension:
http://eclemma.org/jacoco/trunk/doc/faq.html
http://eclemma.org/jacoco/trunk/doc/agent.html
http://eclemma.org/jacoco/trunk/doc/maven.html

@deors
Copy link
Author

deors commented Jun 7, 2016

I forget to add. Instead of step 2 for doing the reset, we can alternatively do the dump followed by the reset in step 3. Probably easier and cleaner.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants