# ESTestCase 2.x + Jacoco not working

**URL:** https://discuss.elastic.co/t/estestcase-2-x-jacoco-not-working/45104
**Category:** Elasticsearch
**Created:** [March 22, 2016, 1:07pm UTC](https://discuss.elastic.co/t/estestcase-2-x-jacoco-not-working/45104 "2016-03-22T13:07:22Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![cadu.goncalves](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/cadu.goncalves/32/8600_2.png) [@cadu.goncalves](https://discuss.elastic.co/u/cadu.goncalves)
#### Post date: [March 22, 2016, 1:07pm UTC](https://discuss.elastic.co/t/estestcase-2-x-jacoco-not-working/45104/1 "2016-03-22T13:07:22Z")

</div>

I've read the [Testing Framework Cheatsheet](https://github.com/elastic/elasticsearch/blob/2.x/TESTING.asciidoc) and tried to execute Jacoco coverage over my unit tests as instructed:  
`mvn -Dtests.coverage test jacoco:report`  
But it doesn't work. Maven fails, debugging it I found the exception:  
`java.lang.RuntimeException: unable to install test security manager Caused by: java.lang.NullPointerException`  
Removing the jacoco report goal results the same:  
`mvn -Dtests.coverage test`  
What is missing in my project? Which configurations in Elasticsearch master pom should I use in my project to fix it?

---

<div class="post-metadata">

### Author: ![cadu.goncalves](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/cadu.goncalves/32/8600_2.png) [@cadu.goncalves](https://discuss.elastic.co/u/cadu.goncalves)
#### Post date: [March 22, 2016, 6:57pm UTC](https://discuss.elastic.co/t/estestcase-2-x-jacoco-not-working/45104/2 "2016-03-22T18:57:03Z")

</div>

Found the problem. The property `tests.coverage.dir` must be set. I did it in my project POM.

---

<div class="post-metadata">

### Author: ![cadu.goncalves](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/cadu.goncalves/32/8600_2.png) [@cadu.goncalves](https://discuss.elastic.co/u/cadu.goncalves)
#### Post date: [March 28, 2016, 1:20pm UTC](https://discuss.elastic.co/t/estestcase-2-x-jacoco-not-working/45104/4 "2016-03-28T13:20:59Z")

</div>

Like so:  
`<plugin>`  
`<groupId>org.apache.maven.plugins</groupId>`  
`<artifactId>maven-surefire-plugin</artifactId>`  
`<configuration>`  
`<systemPropertyVariables>`  
`<tests.coverage.dir>${project.build.directory}</tests.coverage.dir>`  
`</systemPropertyVariables>`  
`</configuration>`  
`</plugin>`

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [July 5, 2017, 11:04pm UTC](https://discuss.elastic.co/t/estestcase-2-x-jacoco-not-working/45104/5 "2017-07-05T23:04:43Z")

</div>


