Class FuzzRunner

java.lang.Object
edu.berkeley.cs.jqf.fuzz.FuzzRunner

public final class FuzzRunner extends Object
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 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 arguments
      trialExecutor - runs a single trial with proper lifecycle
      guidance - drives input selection and observes results
      classifier - maps trial throwables onto engine outcomes
      expectedExceptions - exception types declared by the test method; a thrown subtype counts as success
      observability - collector for optional observability logging
      skipExceptionSwallow - if true, declared exceptions count as failures rather than success
  • Method Details

    • run

      public void run() throws Throwable
      Runs the fuzzing loop until the guidance stops offering input.
      Throws:
      Throwable - a single trial failure, a MultipleFailuresError for several, or a GuidanceException if 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 name
      testMethod - the @Fuzz or @DiffFuzz method to run
      guidance - 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 name
      testMethod - the @Fuzz or @DiffFuzz method to run
      loader - 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

      public static FuzzResult run(Class<?> testClass, String testMethod, Guidance guidance)
      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 class
      testMethod - the @Fuzz or @DiffFuzz method to run
      guidance - the fuzzing guidance
      Returns:
      the campaign result