Package edu.berkeley.cs.jqf.fuzz
Class FuzzRunner
java.lang.Object
edu.berkeley.cs.jqf.fuzz.FuzzRunner
The fuzzing loop, independent of any test framework.
For each input offered by the Guidance, the loop generates arguments
through an ArgumentsGenerator, runs one trial through a
TrialExecutor, classifies the outcome with a ResultClassifier,
and reports it back to the guidance. None of these collaborators expose a
test-framework type, so the loop carries no dependency on JUnit or any
generator library.
When the campaign ends, the loop rethrows a single collected failure as-is,
or wraps several in a MultipleFailuresError.
-
Constructor Summary
ConstructorsConstructorDescriptionFuzzRunner(ArgumentsGenerator argumentsGenerator, TrialExecutor trialExecutor, Guidance guidance, ResultClassifier classifier, List<Class<?>> expectedExceptions, Observability observability, boolean skipExceptionSwallow) Creates a runner for one test method. -
Method Summary
Modifier and TypeMethodDescriptionvoidrun()Runs the fuzzing loop until the guidance stops offering input.static FuzzResultRuns a fuzzing campaign for a resolved test method.static FuzzResultRuns a fuzzing campaign for a test method, loading the class with the system class loader.static FuzzResultrun(String testClassName, String testMethod, ClassLoader loader, Guidance guidance) Runs a fuzzing campaign for a test method, loading the class with the given class loader.
-
Constructor Details
-
FuzzRunner
public FuzzRunner(ArgumentsGenerator argumentsGenerator, TrialExecutor trialExecutor, Guidance guidance, ResultClassifier classifier, List<Class<?>> expectedExceptions, Observability observability, boolean skipExceptionSwallow) Creates a runner for one test method.- Parameters:
argumentsGenerator- generates each trial's argumentstrialExecutor- runs a single trial with proper lifecycleguidance- drives input selection and observes resultsclassifier- maps trial throwables onto engine outcomesexpectedExceptions- exception types declared by the test method; a thrown subtype counts as successobservability- collector for optional observability loggingskipExceptionSwallow- iftrue, declared exceptions count as failures rather than success
-
-
Method Details
-
run
Runs the fuzzing loop until the guidance stops offering input.- Throws:
Throwable- a single trial failure, aMultipleFailuresErrorfor several, or aGuidanceExceptionif fuzzing was interrupted
-
run
public static FuzzResult run(String testClassName, String testMethod, Guidance guidance) throws ClassNotFoundException Runs a fuzzing campaign for a test method, loading the class with the system class loader.- Parameters:
testClassName- the fully qualified test class nametestMethod- the@Fuzzor@DiffFuzzmethod to runguidance- the fuzzing guidance- Returns:
- the campaign result
- Throws:
ClassNotFoundException- if the test class cannot be loaded
-
run
public static FuzzResult run(String testClassName, String testMethod, ClassLoader loader, Guidance guidance) throws ClassNotFoundException Runs a fuzzing campaign for a test method, loading the class with the given class loader.- Parameters:
testClassName- the fully qualified test class nametestMethod- the@Fuzzor@DiffFuzzmethod to runloader- the class loader for the test class (e.g. an instrumenting loader)guidance- the fuzzing guidance- Returns:
- the campaign result
- Throws:
ClassNotFoundException- if the test class cannot be loaded
-
run
Runs a fuzzing campaign for a resolved test method.The argument generator and the trial executor are discovered through
ServiceLoader, so this entry point depends on no test framework. The guidance's instrumentation callback is registered before the entry point is traced, mirroring the JUnit 4 orchestrator.- Parameters:
testClass- the test classtestMethod- the@Fuzzor@DiffFuzzmethod to runguidance- the fuzzing guidance- Returns:
- the campaign result
-