Package groovy.junit6.plugin
Class ForkedJvmTestRunner
java.lang.Object
groovy.junit6.plugin.ForkedJvmTestRunner
Child-JVM entry point for
ForkedJvm-annotated tests.
Invoked by ForkedJvmExtension with the qualified test class name
and method name as command-line arguments. Runs exactly that one test method
via the JUnit Platform Launcher, then reports outcome to the parent
via the file referenced by the system property
groovy.junit6.forked.result: empty file on success, serialized
Throwable (with text fallback) on failure.
- Since:
- 6.0.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intExit code used when the child reports an aborted test.static final byteMarker byte at the start of the result file for an aborted test.static final StringSet on the child JVM soForkedJvmExtensiondoesn't re-fork.static final StringPath of the result file the child writes into.static final byteMarker byte at the start of the result file when the failure had to be written as text instead of a serializedThrowable. -
Method Summary
Modifier and TypeMethodDescriptionstatic voidRuns the single test named byargsand writes the result file named byRESULT_FILE_PROP.
-
Field Details
-
FORKED_FLAG
Set on the child JVM soForkedJvmExtensiondoesn't re-fork.- See Also:
-
RESULT_FILE_PROP
Path of the result file the child writes into.- See Also:
-
TEXT_FALLBACK_MARKER
public static final byte TEXT_FALLBACK_MARKERMarker byte at the start of the result file when the failure had to be written as text instead of a serializedThrowable. Distinguishable becauseObjectOutputStream's STREAM_MAGIC is0xACED, never starts with0x00.- See Also:
-
ABORTED_MARKER
public static final byte ABORTED_MARKERMarker byte at the start of the result file for an aborted test.- See Also:
-
ABORTED_EXIT_CODE
public static final int ABORTED_EXIT_CODEExit code used when the child reports an aborted test.- See Also:
-
-
Method Details
-
main
Runs the single test named byargsand writes the result file named byRESULT_FILE_PROP. Exits with status 2 when the arguments or that property are missing, 3 when no test is discovered,ABORTED_EXIT_CODEwhen the test aborts without failures, 0 after writing an empty file for success, and 1 after writing a failure.- Parameters:
args- the test class name and the method name- Throws:
Exception- when the test class cannot be loaded or the result file cannot be written
-