https://github.com/marschall/junit4-jfr
a JUnit 4 extension that generates JFR events
https://github.com/marschall/junit4-jfr
java-flight-recorder junit junit4
Last synced: 3 months ago
JSON representation
a JUnit 4 extension that generates JFR events
- Host: GitHub
- URL: https://github.com/marschall/junit4-jfr
- Owner: marschall
- Created: 2019-06-30T14:09:04.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2021-01-26T18:28:50.000Z (over 4 years ago)
- Last Synced: 2025-01-16T02:44:58.826Z (4 months ago)
- Topics: java-flight-recorder, junit, junit4
- Language: Java
- Size: 562 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
JUnit 4 JFR [](https://maven-badges.herokuapp.com/maven-central/com.github.marschall/junit4-jfr) [](https://www.javadoc.io/doc/com.github.marschall/junit4-jfr)
===========A JUnit extension that generates JFR events.
```xml
com.github.marschall
junit4-jfr
0.1.0
test```
Requires Java 11 based on OpenJDK.

If you can migrate to JUnit 5 and [marschall/junit-jfr](https://github.com/marschall/junit-jfr) as it offers much higher fidelity.
Usage
-----* Add a `JfrMethodRule` to your unit test class, see [JfrMethodRuleTest](https://github.com/marschall/junit4-jfr/blob/master/src/test/java/com/github/marschall/junit4/jfr/JfrMethodRuleTest.java) for and example.
* Generate a flight recording from your unit tests, eg using
```
-XX:StartFlightRecording:filename=recording.jfr
-XX:FlightRecorderOptions:stackdepth=128
``````java
public class ProfiledTest {@Rule
public JfrMethodRule jfr = new JfrMethodRule();@Test
public void testMethod() {
// implementation
}}
```