Integration testing and unit test coverage consolidation

Source: Internet
Author: User

The first thing to understand is that the Java for unit testing and integration testing in MAVEN is mixed, without a default directory. You need to configure which time unit tests and which are integration tests yourself.

Default does not run, only installs the Surfire plug-in only then runs the single test, only installs the Failuresafe to run the test directory under the IT end class. The default is to identify JUnit and so on.

See maven Integration test http://blog.csdn.net/fei33423/article/details/51090574


* Using Cobertura

1 integration testing can call code directly

1.1 http://www.jayway.com/2008/12/13/getting-coverage-for-integration-tests/

The approach is to use the Maven tool to add a profile mvn-p to move the integration test code code into Src/test/java.

So you can run together. Two documents cannot be dynamically merged according to the protocol format.

1.2 Through the instructions here, if the integration test and unit test run under the same module, you can

Http://www.mojohaus.org/cobertura-maven-plugin/usage.html


1.3 http://aroundthecode.org/2014/07/07/unit-and-integration-tests-coverage-with-sonarqube-and-jacoco/

http://blog.javabien.net/2012/11/23/combine-surefire-tests-and-failsafe-tests-coverage/

Http://stackoverflow.com/questions/13031219/how-to-configure-multi-module-maven-sonar-jacoco-to-give-merged-coverage-rep

1.4 Sonar can merge Jacco unit test and integration test coverage, Cobertura no

Http://stackoverflow.com/questions/23977082/can-sonar-calculate-overall-test-coverage-when-using-cobertura

Http://docs.sonarqube.org/display/PLUG/Code+Coverage+by+Integration+Tests+for+Java+Project


2 integration testing does not directly invoke source code and relies on third-party protocols and containers, such as HTTP

Official website Document Http://www.mojohaus.org/cobertura-maven-plugin/instrumentingDeploymentArtifact.html

1.1 https://blog.avisi.nl/2012/09/25/calculating-the-code-coverage-of-integration-tests/

This article explains how to use the Cobertura command to inject a war packet into the statistical code and then put the generated cobertura.ser into Tomcat boot. Run selenium, run to get the data, through Usecobertura-report to generate the XML or HTML report. Generate results

1.1 Advanced, appeal this process can be combined in Maven via the jetty and Cobertura plug-in configuration.

Http://stackoverflow.com/questions/8034913/cobertura-and-jetty


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.