Class JUnit5FuzzRunner
It wires the framework-independent FuzzRunner to the JUnit 5
adapters: a Junit5TrialExecutor for trial execution and a
Junit5ResultClassifier for outcome classification. The argument
generator is resolved separately (so it stays pluggable). Both the Jupiter
extension and integration tests use this class.
-
Method Summary
Modifier and TypeMethodDescriptionstatic Object[]decode(ArgumentsGenerator generator, InputStream input) Decodes one input into the arguments for a single trial.static FuzzResultfuzz(Class<?> testClass, Method method, Guidance guidance, ArgumentsGenerator arguments) Runs a full fuzzing campaign for a fuzz-test method under the given guidance.static ArgumentsGeneratorresolveArguments(Class<?> testClass, Method testMethod) Resolves the argument generator for a fuzz-test method.
-
Method Details
-
resolveArguments
Resolves the argument generator for a fuzz-test method.If the method's
FuzzTest.arguments()names a concrete factory, that factory is used; otherwise the provider is discovered throughServiceLoader. Methods without a@FuzzTestannotation (for example a JUnit 4@Fuzzmethod reused by an integration test) always fall back toServiceLoader.- Parameters:
testClass- the test classtestMethod- the fuzz-test method- Returns:
- a generator bound to the method
- Throws:
IllegalStateException- if no provider is available
-
decode
Decodes one input into the arguments for a single trial.- Parameters:
generator- the argument generatorinput- the raw bytes of one saved or seed input- Returns:
- the decoded arguments
-
fuzz
public static FuzzResult fuzz(Class<?> testClass, Method method, Guidance guidance, ArgumentsGenerator arguments) Runs a full fuzzing campaign for a fuzz-test method under the given guidance.The guidance's instrumentation callback is registered, and any tracer left over from a previous campaign in this JVM is dropped, before snooping starts, mirroring
FuzzRunner.run(Class, String, Guidance).- Parameters:
testClass- the test classmethod- the fuzz-test methodguidance- the fuzzing guidancearguments- the argument generator- Returns:
- the campaign result
-