Closed EvanXiaa closed 3 years ago
JQF needs to be able to instrument classes as they are being loaded by the JVM in order to collect coverage feedback. The command-line runner uses a javaagent and special bootclasspath, whereas the Maven plugin uses a custom instrumenting class loader before running guided fuzzing.
If you want to collect coverage when running from IDEA, you will have to either set javaagend/bootclasspath or customize the classloader. I don't know the specifics of IntelliJ settings but that's a direction to consider.
Hope this helps.
To follow up on that; to run a particular test in IDEA with coverage enabled, you can go to Edit Configurations
, choose the test you want to run, and add the VM options from the command-line runner to the configurations. Those options are
-ea -Xbootclasspath/a:"$INST_CLASSPATH" -javaagent:${INST_JAR} -Djanala.conf="${SCRIPT_DIR}/janala.conf"
with the environment variables defined. Refer to the command-line runner for how to set those variables appropriately.
Thank you for replying. I'll have a try. : )
Hello author! I tried to debug jqf with ideal but during the test the coverage is always zero. And I found the method "handleEvent" is never called in that case. Could you please tell me how could this happen? By the way, the project can work and calculate coverage when I use terminal.