diff --git a/README.md b/README.md index 8e6c895..af2d42e 100644 --- a/README.md +++ b/README.md @@ -51,6 +51,30 @@ jqf-afl-fuzz -c target/test-classes:target/classes -i src/test/resources/terms/ Generated inputs are stored in `fuzz-results/queue/`. More samples can be added to `src/test/resources/terms/` to speed up the process. +## Running tests + calculating test coverage + +First run the unit tests: +``` +mvn jacoco:prepare-agent test jacoco:report +``` + +Then run the application with the JaCoCo agent: (adjust the path to the agent jar) +``` +cp target/typicalc-1.0-SNAPSHOT.jar /tmp +java -javaagent:jacoco.agent.jar=port=36320,destfile=jacoco-it.exec,output=tcpserver /tmp/typicalc-1.0-SNAPSHOT.jar +``` + +To run the integration tests: +``` +mvn integration-test +mvn jacoco:dump@pull-test-data -Dapp.host=localhost -Dapp.port=36320 -Dskip.dump=false +``` + +Finally, a code coverage report can be generated: +``` +mvn antrun:run@generate-report -Dskip.int.tests.report=false +``` + ## Deploying using Docker To build the Dockerized version of the project, run: diff --git a/pom.xml b/pom.xml index 0af25b3..2e80927 100644 --- a/pom.xml +++ b/pom.xml @@ -224,6 +224,115 @@ org.jacoco jacoco-maven-plugin 0.8.6 + + + pull-test-data + post-integration-test + + dump + + + ${project.build.directory}/jacoco-it.exec +
${app.host}
+ ${app.port} + false + ${skip.dump} +
+
+ + jacoco-integration-initialize + pre-integration-test + + prepare-agent-integration + + + failsafe.argLine + target/jacoco-it-base.exec + + +
+ + + + org.apache.maven.plugins + maven-antrun-plugin + 3.0.0 + + + generate-report + none + + run + + + ${skip.int.tests.report} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + package + + run + + + + + + + + + + + + + + + + + + + org.jacoco + org.jacoco.ant + 0.8.6 + + @@ -262,42 +371,6 @@ UTF-8 - - - org.apache.maven.plugins - maven-antrun-plugin - 3.0.0 - - - package - - run - - - - - - - - - - - - - - - - - -