Book Image

APACHE KARAF COOKBOOK

Book Image

APACHE KARAF COOKBOOK

Overview of this book

Table of Contents (17 chapters)
Apache Karaf Cookbook
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Coverage with Apache Karaf Pax Exam tests


Apart from testing the application, it is usually also a requirement to know how well the unit and integration tests actually cover the code. For code coverage, a couple of technologies are available. This recipe will cover how to set up your test environment to find the coverage of the test.

Getting ready

It's best to have gone through the Testing Apache Karaf features recipe before starting this follow-up recipe. The sources of this recipe are available at https://github.com/jgoodyear/ApacheKarafCookbook/tree/master/chapter10/chapter10-recipe4.

How to do it…

To find out about the coverage of the test, a code coverage tool is needed. We will take the Java Code Coverage Library as it has a Maven plugin for automated coverage analysis. At first, the Maven coordinates for the plugin are added as shown in the following code:

<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.7.0.201403182114...