Class Junit4TrialExecutor

java.lang.Object
edu.berkeley.cs.jqf.fuzz.junit.Junit4TrialExecutor
All Implemented Interfaces:
TrialExecutor

public final class Junit4TrialExecutor extends Object implements TrialExecutor
Runs trials through a JUnit 4 TrialRunner.

A fresh TrialRunner per trial gives each one a new test instance and the standard @Before/@After lifecycle. It also captures the test method's return value, which differential fuzzing needs.

  • Constructor Details

    • Junit4TrialExecutor

      public Junit4TrialExecutor(Class<?> testClass, Method method)
  • Method Details

    • runTrial

      public void runTrial(Object[] args) throws Throwable
      Description copied from interface: TrialExecutor
      Runs one trial with the given arguments.

      Throwables raised by the test body propagate unchanged so the engine can classify them (failure, unmet assumption, timeout). Implementations must not swallow them.

      Specified by:
      runTrial in interface TrialExecutor
      Parameters:
      args - the arguments for this trial
      Throws:
      Throwable - whatever the test body raises
    • getLastOutput

      public Object getLastOutput()
      Description copied from interface: TrialExecutor
      Returns the value returned by the most recent trial's test method.

      Differential fuzzing compares these return values across runs; ordinary test runners discard them. The default returns null for executors that do not capture the return value.

      Specified by:
      getLastOutput in interface TrialExecutor
      Returns:
      the most recent return value, or null