JUnit 4 JFR
![Javadocs](https://camo.githubusercontent.com/b1b0f740db97dd18a6f184a459f3e3e39b24db01027063f61e01605d440694cb/68747470733a2f2f7777772e6a617661646f632e696f2f62616467652f636f6d2e6769746875622e6d6172736368616c6c2f6a756e6974342d6a66722e737667)
A JUnit extension that generates JFR events.
<dependency>
<groupId>com.github.marschall</groupId>
<artifactId>junit4-jfr</artifactId>
<version>0.1.0</version>
<scope>test</scope>
</dependency>
Requires Java 11 based on OpenJDK.
If you can migrate to JUnit 5 and marschall/junit-jfr as it offers much higher fidelity.
Usage
- Add a
JfrMethodRule
to your unit test class, see JfrMethodRuleTest for and example. - Generate a flight recording from your unit tests, eg using
-XX:StartFlightRecording:filename=recording.jfr
-XX:FlightRecorderOptions:stackdepth=128
public class ProfiledTest {
@Rule
public JfrMethodRule jfr = new JfrMethodRule();
@Test
public void testMethod() {
// implementation
}
}