JUnit JFR

A JUnit extension that generates JFR events.

License

License

MIT
Categories

Categories

JUnit Unit Testing
GroupId

GroupId

com.github.marschall
ArtifactId

ArtifactId

junit4-jfr
Last Version

Last Version

0.1.0
Release Date

Release Date

Type

Type

jar
Description

Description

JUnit JFR
A JUnit extension that generates JFR events.
Project URL

Project URL

https://github.com/marschall/junit4-jfr
Source Code Management

Source Code Management

https://github.com/marschall/junit4-jfr

Download junit4-jfr

How to add to project

<!-- https://jarcasting.com/artifacts/com.github.marschall/junit4-jfr/ -->
<dependency>
    <groupId>com.github.marschall</groupId>
    <artifactId>junit4-jfr</artifactId>
    <version>0.1.0</version>
</dependency>
// https://jarcasting.com/artifacts/com.github.marschall/junit4-jfr/
implementation 'com.github.marschall:junit4-jfr:0.1.0'
// https://jarcasting.com/artifacts/com.github.marschall/junit4-jfr/
implementation ("com.github.marschall:junit4-jfr:0.1.0")
'com.github.marschall:junit4-jfr:jar:0.1.0'
<dependency org="com.github.marschall" name="junit4-jfr" rev="0.1.0">
  <artifact name="junit4-jfr" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.github.marschall', module='junit4-jfr', version='0.1.0')
)
libraryDependencies += "com.github.marschall" % "junit4-jfr" % "0.1.0"
[com.github.marschall/junit4-jfr "0.1.0"]

Dependencies

provided (1)

Group / Artifact Type Version
junit : junit jar 4.12

Project Modules

There are no modules declared in this project.

JUnit 4 JFR Maven Central Javadocs

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.

Flight Recording of a JUnit Test

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
  }

}

Versions

Version
0.1.0