1.2.4.8. Flight Recorder Support
Since version 1.7, the JUnit Platform provides opt-in support for generating Flight Recorder events. JEP 328 describes the Java Flight Recorder (JFR) as:
Flight Recorder records events originating from applications, the JVM and the OS. Events are stored in a single file that can be attached to bug reports and examined by support engineers, allowing after-the-fact analysis of issues in the period leading up to a problem.
In order to record Flight Recorder events generated while running tests, you need to:
- Provide module
org.junit.platform.jfr
(junit-platform-jfr-1.7.0.jar
) on the class-path or module-path at test runtime. - Start flight recording when launching a test run. Flight Recorder can be started via java command line option:
-XX:StartFlightRecording:filename=...
Please consult the manual of your build tool for the appropriate commands.
To analyze the recorded events, use the jfr command line tool shipped with recent JDKs or open the recording file with JDK Mission Control.
Flight Recorder support is currently an experimental feature. You’re invited to give it a try and provide feedback to the JUnit team so they can improve and eventually promote this feature.