Hello Friends ,
In last day i was doing some configuration work to extract functional coverage report using JACOCO Agent.jar. At first i would mention that i was working on maven project and it was running over the Apache Spark 1.5 .
I followed steps mentioned below to get functional coverage (You can comment below if you have any better way to do this 🙂 ).
1. Download jacoco-agent.jar
2. Extract the jar and you’ll find a jacoco-agent.jar inside the extracted folder.
3.Configure spark-default.conf with your project(as most probably you had configured in start of your project) and jacoco-agent.
4. Run the spark-submit command.
5. Execute your functionality(or Querry).
6. Now stop the spark-submit command.
7. jacoco.exec would be placed at the destfile path(/tmp/jacoco).If already yo have generated your jacoco.exec from any other way you can follow step 8 & 9 to generate report in HTML format.
8. Add following plugin to pom.xml in your project :
<!– Sets the path to the file which contains the execution data. –>
<!– Sets the output directory for the code coverage report. –>
<!– Sets the VM argument line used when unit tests are run. –>
<!– Skips unit tests if the value of skip.unit.tests property is true –>
<!– Excludes integration tests when unit tests are run. –>
- Run mvn test from from your project.Coverage report in html format generated at specified location as given in maven plugin.