-
Notifications
You must be signed in to change notification settings - Fork 111
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to get JaCoCo coverage while using "mvn jqf:repro ..." command #256
Comments
This should definitely work, and is an easy way to run all test inputs in the corpus by providing a directory. In the JQF-Zest Example repo, if I add this annotation, then I can run after fuzzing:
In your example repo, I think the dependency on Jupiter might be causing a conflict with JQF's JUnit4-based runner and spoil test discovery. A low-level workaround might be to use JQF has also has native support for creating |
Thank you very much for your answer!
Indeed, downgrade to JUnit4 solved the problem when using @fuzz(repro=<file_or_dir>) annotation.
This is a very interesting option, but I couldn't get it to work. I add this lines in pom.xml:
In the command But when I try to run What am I doing wrong? |
As I mentioned earlier, adding the jacocoagent.jar file to classpath is not a pure-Maven solution, because of how JaCoCo is deployed to Maven Central. What you have as a dependency is the
The Maven JAR they publish is a wrapper for the JAR that actually contains the classes. This is fine for their use case of using the Maven package as a You could create a pure-Maven solution by using some other plugins that unwrap this JAR at test time and include it in your dependencies somehow. I haven't gone that deep. For research experiments where we needed JaCoCo coverage results, we simply pulled the jacocoagent.jar as a system dependency. |
I'm not very experienced in Java yet and I don't really know how to implement this. :(
Do you mean using I unpack jacoco-0.8.10.zip into /home/user/Fuzzing/jacoco-0.8.10 directory and then I trying to run the following bash script:
But I get ClassNotFoundException again. Also I try correct this lines in pom.xml:
But this does not give the desired effect. |
Hi!
I wrote little test project containing the dimMe() method of com.org.exampleclass.ExampleClass class and corresponding ExampleClassFuzzTest.java fuzzing wrapper for this method.
I'm successfully fuzzing this method using jqf-maven-plugin:
mvn jqf:repro -Dclass=com.org.exampleclass.ExampleClassFuzzTest -Dmethod=testFuzzDimMe
And then I succeed reproduce function arguments from input files:
mvn jqf:repro -Dclass=com.org.exampleclass.ExampleClassFuzzTest -Dmethod=testFuzzDimMe -Dinput=target/fuzz-results/com.org.exampleclass.ExampleClassFuzzTest/testFuzzDimMe/corpus/ -DprintArgs
I would like to get a JaCoCo report on the coverage achieved when running the last command. How can this be achieved?
I know about the -DlogCoverage option, but I need the JaCoCo format (jacoco.exec file).
I tried installing javaagent via the MAVEN_OPTS environment variable (see run.sh file). But in the html report I see empty coverage.
Also I try run
mvn test -Dtest=<filter>
with a@Fuzz(repro=<file_or_dir>)
annotation on the JQF test driver, but maven does not treat fuzzing tests with this annotation as unit tests and does not execute them.Is there a way and how to link in pom.xml the execution of jqf-maven-plugin with jacoco-maven-plugin? Or is there any other way to get the correct jacoco.exec file when running the
mvn jqf:repro
command?The text was updated successfully, but these errors were encountered: