org.junit.runner.Runner Java Examples

The following examples show how to use org.junit.runner.Runner. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source Project: pinpoint   Author: naver   File: AbstractPinpointPluginTestSuite.java    License: Apache License 2.0 6 votes vote down vote up
public AbstractPinpointPluginTestSuite(Class<?> testClass) throws InitializationError, ArtifactResolutionException, DependencyResolutionException {
    super(testClass, Collections.<Runner> emptyList());

    PinpointAgent agent = testClass.getAnnotation(PinpointAgent.class);
    this.agentJar = resolveAgentPath(agent);

    PinpointConfig config = testClass.getAnnotation(PinpointConfig.class);
    this.configFile = config == null ? null : resolveConfigFileLocation(config.value());

    PinpointProfile profile = testClass.getAnnotation(PinpointProfile.class);
    this.profile = resolveProfile(profile);

    JvmArgument jvmArgument = testClass.getAnnotation(JvmArgument.class);
    this.jvmArguments = getJvmArguments(jvmArgument);

    JvmVersion jvmVersion = testClass.getAnnotation(JvmVersion.class);
    this.jvmVersions = jvmVersion == null ? new int[] { NO_JVM_VERSION } : jvmVersion.value();

    ImportPlugin importPlugin = testClass.getAnnotation(ImportPlugin.class);
    this.importPluginIds = getImportPlugin(importPlugin);

    this.requiredLibraries = getClassPathList(REQUIRED_CLASS_PATHS);
    this.mavenDependencyLibraries = getClassPathList(MAVEN_DEPENDENCY_CLASS_PATHS);
    this.testClassLocation = resolveTestClassLocation(testClass);
    this.debug = isDebugMode();
}
 
Example #2
Source Project: JTAF-XCore   Author: FINRAOS   File: MasterSuiteRunnersBuilder.java    License: Apache License 2.0 6 votes vote down vote up
public List<Runner> runners()
		throws InitializationError, ParsingException, SAXException, IOException, IllegalArgumentException, SecurityException, IllegalAccessException, InvocationTargetException, NoSuchMethodException, InstantiationException {
	
	
	AutomationEngine engine = AutomationEngine.getInstance();
	ArrayList<Runner> tests = new ArrayList<Runner>();
	
	engine.buildModel(new File("testlibrary"), new File("testscripts"));
	TestAgenda testAgenda = engine.getTestAgenda();

	for (TestScript testScript : testAgenda.getTestScripts()) {
		TestCaseRunner theRunner = new TestCaseRunner(ParallelScriptRunner.class, new ParallelScriptRunner(testScript));
		tests.add(theRunner);
		ConcurrentScheduler.registerTestName(testScript.getName());
	}
	
	return tests;
}
 
Example #3
Source Project: pitest   Author: hcoles   File: RunnerSuiteFinder.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public List<Class<?>> apply(final Class<?> a) {
  try {
    final Runner runner = AdaptedJUnitTestUnit.createRunner(a);

    final List<Description> allChildren = new ArrayList<>();
    flattenChildren(allChildren, runner.getDescription());

    final List<Description> suites = FCollection.filter(allChildren,
        Prelude.or(isSuiteMethodRunner(runner), isSuite()));
    final Set<Class<?>> classes = suites.stream().flatMap(descriptionToTestClass()).collect(Collectors.toSet());

    classes.remove(a);
    return new ArrayList<>(classes);
  } catch (final RuntimeException ex) {
    // some runners (looking at you spock) can throw a runtime exception
    // when the getDescription method is called.
    return Collections.emptyList();
  }

}
 
Example #4
Source Project: android-test   Author: android   File: AndroidSuiteBuilder.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public Runner runnerForClass(Class<?> testClass) throws Throwable {
  if (androidRunnerParams.isIgnoreSuiteMethods()) {
    return null;
  }
  try {
    if (hasSuiteMethod(testClass)) {
      Test t = SuiteMethod.testFromSuiteMethod(testClass);
      if (!(t instanceof TestSuite)) {
        // this should not be possible
        throw new IllegalArgumentException(
            testClass.getName() + "#suite() did not return a TestSuite");
      }
      return new JUnit38ClassRunner(new AndroidTestSuite((TestSuite) t, androidRunnerParams));
    }
  } catch (Throwable e) {
    // log error message including stack trace before throwing to help with debugging.
    Log.e(LOG_TAG, "Error constructing runner", e);
    throw e;
  }
  return null;
}
 
Example #5
Source Project: android-test   Author: android   File: AndroidAnnotatedBuilderTest.java    License: Apache License 2.0 6 votes vote down vote up
@Test
public void successfullyCreateAndroidRunner() throws Exception {
  final Runner mockedRunner = mock(Runner.class);
  AndroidAnnotatedBuilder ab =
      new AndroidAnnotatedBuilder(mockRunnerBuilder, mockAndroidRunnerParams) {
        @Override
        public Runner buildAndroidRunner(Class<? extends Runner> runnerClass, Class<?> testClass)
            throws Exception {
          assertEquals(runnerClass, AndroidJUnit4.class);
          assertEquals(testClass, RunWithAndroidJUnit4Class.class);
          return mockedRunner;
        }
      };
  // attempt to create a runner for a class annotated with @RunWith(AndroidJUnit4.class)
  Runner runner = ab.runnerForClass(RunWithAndroidJUnit4Class.class);
  assertEquals(0, runner.testCount());
}
 
Example #6
Source Project: registry   Author: hortonworks   File: CustomParameterizedRunner.java    License: Apache License 2.0 6 votes vote down vote up
private List<Runner> createRunnersForParameters(
        Iterable<Object> allParameters, String namePattern,
        ParametersRunnerFactory runnerFactory) throws Exception {
    try {
        List<TestWithParameters> tests = createTestsForParameters(
                allParameters, namePattern);
        List<Runner> runners = new ArrayList<Runner>();
        for (TestWithParameters test : tests) {
            runners.add(runnerFactory
                    .createRunnerForTestWithParameters(test));
        }
        return runners;
    } catch (ClassCastException e) {
        throw parametersMethodReturnedWrongType();
    }
}
 
Example #7
Source Project: pitest   Author: hcoles   File: AdaptedJUnitTestUnit.java    License: Apache License 2.0 6 votes vote down vote up
private void filterIfRequired(final ResultCollector rc, final Runner runner) {
  if (this.filter.isPresent()) {
    if (!(runner instanceof Filterable)) {
      LOG.warning("Not able to filter " + runner.getDescription()
          + ". Mutation may have prevented JUnit from constructing test");
      return;
    }
    final Filterable f = (Filterable) runner;
    try {
      f.filter(this.filter.get());
    } catch (final NoTestsRemainException e1) {
      rc.notifySkipped(this.getDescription());
      return;
    }
  }
}
 
Example #8
Source Project: pitest   Author: hcoles   File: JUnitCustomRunnerTestUnitFinder.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public List<TestUnit> findTestUnits(final Class<?> clazz) {

  final Runner runner = AdaptedJUnitTestUnit.createRunner(clazz);

  if (isExcluded(runner) || isNotARunnableTest(runner, clazz.getName()) || !isIncluded(clazz)) {
    return Collections.emptyList();
  }

  if (Filterable.class.isAssignableFrom(runner.getClass())
      && !shouldTreatAsOneUnit(clazz, runner)) {
    final List<TestUnit> filteredUnits = splitIntoFilteredUnits(runner.getDescription());
    return filterUnitsByMethod(filteredUnits);
  } else {
    return Collections.<TestUnit> singletonList(new AdaptedJUnitTestUnit(
        clazz, Optional.<Filter> empty()));
  }
}
 
Example #9
Source Project: sql-layer   Author: jaytaylor   File: NamedParameterizedRunnerTest.java    License: GNU Affero General Public License v3.0 6 votes vote down vote up
/**
 * Confirms that each given name has a {@linkplain ReifiedParamRunner} associated with it, and returns the
 * name -> runner map
 * @param runner the parameterized runner
 * @param names the expected names
 * @return a map of names to reified runners
 */
private static Map<String,ReifiedParamRunner> testParameterizations(NamedParameterizedRunner runner, String... names)
{
    List<Runner> children = runner.getChildren();
    assertEquals("children.size()", names.length, children.size());

    Set<String> expectedNames = new HashSet<>(names.length, 1.0f);
    for (String name : names) {
        assertTrue("unexpected error, duplicate name: " + name, expectedNames.add(name));
    }

    Map<String,ReifiedParamRunner> foundRunners = new HashMap<>();
    for (Runner child : children)
    {
        ReifiedParamRunner reified = (ReifiedParamRunner)child;
        String paramToString = reified.paramToString();
        assertNull("duplicate name: " + paramToString, foundRunners.put(paramToString, reified));
    }

    for (String expected : expectedNames)
    {
        assertTrue("didn't find expected param: " + expected, foundRunners.containsKey(expected));
    }

    return foundRunners;
}
 
Example #10
Source Project: pitest   Author: hcoles   File: AdaptedJUnitTestUnit.java    License: Apache License 2.0 5 votes vote down vote up
public static Runner createRunner(final Class<?> clazz) {
  final RunnerBuilder builder = createRunnerBuilder();
  try {
    return builder.runnerForClass(clazz);
  } catch (final Throwable ex) {
    LOG.log(Level.SEVERE, "Error while creating runner for " + clazz, ex);
    throw translateCheckedException(ex);
  }

}
 
Example #11
Source Project: pitest   Author: hcoles   File: JUnitCustomRunnerTestUnitFinder.java    License: Apache License 2.0 5 votes vote down vote up
private boolean shouldTreatAsOneUnit(final Class<?> clazz, final Runner runner) {
  final Set<Method> methods = Reflection.allMethods(clazz);
  return runnerCannotBeSplit(runner)
      || hasAnnotation(methods, BeforeClass.class)
      || hasAnnotation(methods, AfterClass.class)
      || hasClassRuleAnnotations(clazz, methods);
}
 
Example #12
Source Project: android-test   Author: android   File: AndroidAnnotatedBuilderTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void testNoRunWith() throws Exception {
  AndroidAnnotatedBuilder ab =
      new AndroidAnnotatedBuilder(mockRunnerBuilder, mockAndroidRunnerParams) {
        @Override
        public Runner buildAndroidRunner(Class<? extends Runner> runnerClass, Class<?> testClass)
            throws Exception {
          Assert.fail(
              "Should not attempt to build Android Runner no @RunWith " + "annotation is used");
          return null;
        }
      };
  // attempt to create a runner for a class with no @RunWith annotation
  ab.runnerForClass(NoRunWithClass.class);
}
 
Example #13
Source Project: tds   Author: Unidata   File: SpringJUnit4ParameterizedClassRunner.java    License: BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/**
 * Only called reflectively. Do not use programmatically.
 */
public SpringJUnit4ParameterizedClassRunner(Class<?> klass) throws Throwable {
  super(klass, Collections.<Runner>emptyList());
  List<Object[]> parametersList = getParametersList(getTestClass());
  for (int i = 0; i < parametersList.size(); i++)
    runners.add(new TestClassRunnerForParameters(getTestClass().getJavaClass(), parametersList, i));
}
 
Example #14
Source Project: pinpoint   Author: naver   File: PinpointPluginTestSuite.java    License: Apache License 2.0 5 votes vote down vote up
private boolean shouldRun(Filter filter, Runner each) {
    if (filter.shouldRun(describeChild(each))) {
        return true;
    }

    if (each instanceof PinpointPluginTestRunner) {
        return ((PinpointPluginTestRunner) each).isAvaiable(filter);
    }

    return false;
}
 
Example #15
Source Project: metamutator   Author: SpoonLabs   File: UniqueTestGenerator.java    License: GNU General Public License v3.0 5 votes vote down vote up
private CtCodeSnippetStatement createTestSnippet(CtClass element, Class<? extends Runner> runner) {
	CtCodeSnippetStatement e = getFactory().Core()
			.createCodeSnippetStatement();
	String val = "	new "+runner.getCanonicalName()+"("
			+ element.getQualifiedName()
			+ ".class).run(new org.junit.runner.notification.RunNotifier() {\n"
			+ "		@Override\n"
			+ "		public void fireTestFailure(org.junit.runner.notification.Failure failure) {\n"
			+ "			if (failure.getException() instanceof RuntimeException) throw (RuntimeException)failure.getException(); \n"
			+ "			if (failure.getException() instanceof Error) throw (Error)failure.getException(); \n"
			+ "         throw new RuntimeException(failure.getException());\n"
			+ "		}\n" + "	})";
	e.setValue(val);
	return e;
}
 
Example #16
Source Project: bazel   Author: bazelbuild   File: MemoizingRequestTest.java    License: Apache License 2.0 5 votes vote down vote up
public void testMemoizesRunner() {
  MemoizingRequest memoizingRequest = new MemoizingRequest(mockRequestDelegate);

  Runner firstRunner = memoizingRequest.getRunner();
  Runner secondRunner = memoizingRequest.getRunner();

  assertThat(secondRunner).isSameInstanceAs(firstRunner);
  verify(mockRequestDelegate).getRunner();
  verifyNoMoreInteractions(mockRequestDelegate);
}
 
Example #17
Source Project: android-test   Author: android   File: AndroidRunnerBuilder.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public Runner runnerForClass(Class<?> testClass) throws Throwable {
  // Try the custom RunnerBuilder instances first.
  for (RunnerBuilder customRunnerBuilder : customRunnerBuilders) {
    Runner runner = customRunnerBuilder.safeRunnerForClass(testClass);
    if (runner != null) {
      return runner;
    }
  }

  return super.runnerForClass(testClass);
}
 
Example #18
Source Project: bazel   Author: bazelbuild   File: MemoizingRequest.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public final synchronized Runner getRunner() {
  if (runnerDelegate == null) {
    runnerDelegate = createRunner(requestDelegate);
  }
  return runnerDelegate;
}
 
Example #19
Source Project: pushfish-android   Author: PushFish   File: AbstractMultiTestRunner.java    License: BSD 2-Clause "Simplified" License 5 votes vote down vote up
private void initExecutions() {
    if (executions.isEmpty()) {
        try {
            Runner descriptionProvider = createRunnerFor(Arrays.asList(target), Collections.<Filter>emptyList());
            templateDescription = descriptionProvider.getDescription();
        } catch (InitializationError initializationError) {
            throw UncheckedException.throwAsUncheckedException(initializationError);
        }
        createExecutions();
        for (Execution execution : executions) {
            execution.init(target, templateDescription);
        }
    }
}
 
Example #20
Source Project: denominator   Author: Netflix   File: Live.java    License: Apache License 2.0 5 votes vote down vote up
public Live(Class<?> klass) throws InitializationError {
  super(klass, Collections.<Runner>emptyList());
  graph = testGraph(klass);
  if (graph.manager() != null && graph.manager().checkConnection()) {
    runners = createRunners(klass);
  } else {
    runners = Collections.emptyList();
  }
}
 
Example #21
Source Project: pushfish-android   Author: PushFish   File: JUnitTestClassExecuter.java    License: BSD 2-Clause "Simplified" License 5 votes vote down vote up
private void runTestClass(String testClassName) throws ClassNotFoundException {
    final Class<?> testClass = Class.forName(testClassName, false, applicationClassLoader);
    Request request = Request.aClass(testClass);
    if (options.hasCategoryConfiguration()) {
        Transformer<Class<?>, String> transformer = new Transformer<Class<?>, String>() {
            public Class<?> transform(final String original) {
                try {
                    return applicationClassLoader.loadClass(original);
                } catch (ClassNotFoundException e) {
                    throw new InvalidUserDataException(String.format("Can't load category class [%s].", original), e);
                }
            }
        };
        request = request.filterWith(new CategoryFilter(
                CollectionUtils.collect(options.getIncludeCategories(), transformer),
                CollectionUtils.collect(options.getExcludeCategories(), transformer)
        ));
    }

    if (!options.getIncludedTests().isEmpty()) {
        request = request.filterWith(new MethodNameFilter(options.getIncludedTests()));
    }

    Runner runner = request.getRunner();
    //In case of no matching methods junit will return a ErrorReportingRunner for org.junit.runner.manipulation.Filter.class.
    //Will be fixed with adding class filters
    if (!org.junit.runner.manipulation.Filter.class.getName().equals(runner.getDescription().getDisplayName())) {
        RunNotifier notifier = new RunNotifier();
        notifier.addListener(listener);
        runner.run(notifier);
    }
}
 
Example #22
public Runner runnerForClass(Class<?> testClass) throws Throwable {
    try {
        return new BlockJUnit4ClassRunner(testClass);
    } catch (Throwable t) {
        //failed to instantiate BlockJUnitRunner. try deprecated JUnitRunner (for JUnit < 4.5)
        try {
            Class<Runner> runnerClass = (Class<Runner>) Thread.currentThread().getContextClassLoader().loadClass("org.junit.internal.runners.JUnit4ClassRunner");
            final Constructor<Runner> constructor = runnerClass.getConstructor(Class.class);
            return constructor.newInstance(testClass);
        } catch (Throwable e) {
            LoggerFactory.getLogger(getClass()).warn("Unable to load JUnit4 runner to calculate Ignored test cases", e);
        }
    }
    return null;
}
 
Example #23
Source Project: pushfish-android   Author: PushFish   File: AbstractMultiTestRunner.java    License: BSD 2-Clause "Simplified" License 5 votes vote down vote up
private void runEnabledTests(RunNotifier nested) {
    if (enabledTests.isEmpty()) {
        return;
    }

    Runner runner;
    try {
        runner = createExecutionRunner();
    } catch (Throwable t) {
        runner = new CannotExecuteRunner(getDisplayName(), target, t);
    }

    try {
        if (!disabledTests.isEmpty()) {
            ((Filterable) runner).filter(new Filter() {
                @Override
                public boolean shouldRun(Description description) {
                    return !disabledTests.contains(description);
                }

                @Override
                public String describe() {
                    return "disabled tests";
                }
            });
        }
    } catch (NoTestsRemainException e) {
        return;
    }

    runner.run(nested);
}
 
Example #24
Source Project: pushfish-android   Author: PushFish   File: JUnitTestClassExecuter.java    License: BSD 2-Clause "Simplified" License 5 votes vote down vote up
private void runTestClass(String testClassName) throws ClassNotFoundException {
    final Class<?> testClass = Class.forName(testClassName, true, applicationClassLoader);
    Request request = Request.aClass(testClass);
    if (options.hasCategoryConfiguration()) {
        Transformer<Class<?>, String> transformer = new Transformer<Class<?>, String>() {
            public Class<?> transform(final String original) {
                try {
                    return applicationClassLoader.loadClass(original);
                } catch (ClassNotFoundException e) {
                    throw new InvalidUserDataException(String.format("Can't load category class [%s].", original), e);
                }
            }
        };
        request = request.filterWith(new CategoryFilter(
                CollectionUtils.collect(options.getIncludeCategories(), transformer),
                CollectionUtils.collect(options.getExcludeCategories(), transformer)
        ));
    }

    if (!options.getIncludedTests().isEmpty()) {
        request = request.filterWith(new MethodNameFilter(options.getIncludedTests()));
    }

    Runner runner = request.getRunner();
    //In case of no matching methods junit will return a ErrorReportingRunner for org.junit.runner.manipulation.Filter.class.
    //Will be fixed with adding class filters
    if (!org.junit.runner.manipulation.Filter.class.getName().equals(runner.getDescription().getDisplayName())) {
        RunNotifier notifier = new RunNotifier();
        notifier.addListener(listener);
        runner.run(notifier);
    }
}
 
Example #25
Source Project: pushfish-android   Author: PushFish   File: IgnoredTestDescriptorProvider.java    License: BSD 2-Clause "Simplified" License 5 votes vote down vote up
List<Description> getAllDescriptions(Description description, String className) {
    final AllExceptIgnoredTestRunnerBuilder allExceptIgnoredTestRunnerBuilder = new AllExceptIgnoredTestRunnerBuilder();
    try {
        final Class<?> testClass = description.getClass().getClassLoader().loadClass(className);
        Runner runner = allExceptIgnoredTestRunnerBuilder.runnerForClass(testClass);
        if (runner == null) {
            //fall back to default runner
            runner = Request.aClass(testClass).getRunner();
        }
        final Description runnerDescription = runner.getDescription();
        return runnerDescription.getChildren();
    } catch (Throwable throwable) {
        throw new TestSuiteExecutionException(String.format("Unable to process Ignored class %s.", className), throwable);
    }
}
 
Example #26
public Runner runnerForClass(Class<?> testClass) throws Throwable {
    try {
        return new BlockJUnit4ClassRunner(testClass);
    } catch (Throwable t) {
        //failed to instantiate BlockJUnitRunner. try deprecated JUnitRunner (for JUnit < 4.5)
        try {
            Class<Runner> runnerClass = (Class<Runner>) Thread.currentThread().getContextClassLoader().loadClass("org.junit.internal.runners.JUnit4ClassRunner");
            final Constructor<Runner> constructor = runnerClass.getConstructor(Class.class);
            return constructor.newInstance(testClass);
        } catch (Throwable e) {
            LoggerFactory.getLogger(getClass()).warn("Unable to load JUnit4 runner to calculate Ignored test cases", e);
        }
    }
    return null;
}
 
Example #27
Source Project: at.info-knowledge-base   Author: atinfo   File: ConcurrentParameterized.java    License: MIT License 5 votes vote down vote up
@Override
protected List<Runner> getChildren() {
    for (Runner runner : super.getChildren()) {
        BlockJUnit4ClassRunner classRunner = (BlockJUnit4ClassRunner) runner;
        classRunner.setScheduler(scheduler);
    }
    return super.getChildren();
}
 
Example #28
Source Project: android-test   Author: android   File: AndroidLogOnlyBuilderTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void builderHandlesJUnit3Tests() throws Throwable {
  Runner selectedRunner = androidLogOnlyBuilder.runnerForClass(JUnit3FailingTestCase.class);
  assertThat(selectedRunner, notNullValue());
  assertThat(selectedRunner.getClass(), typeCompatibleWith(JUnit38ClassRunner.class));
  runWithRunner(selectedRunner, 1, 0);
}
 
Example #29
public Runner runnerForClass(Class<?> testClass) throws Throwable {
    try {
        return new BlockJUnit4ClassRunner(testClass);
    } catch (Throwable t) {
        //failed to instantiate BlockJUnitRunner. try deprecated JUnitRunner (for JUnit < 4.5)
        try {
            Class<Runner> runnerClass = (Class<Runner>) Thread.currentThread().getContextClassLoader().loadClass("org.junit.internal.runners.JUnit4ClassRunner");
            final Constructor<Runner> constructor = runnerClass.getConstructor(Class.class);
            return constructor.newInstance(testClass);
        } catch (Throwable e) {
            LoggerFactory.getLogger(getClass()).warn("Unable to load JUnit4 runner to calculate Ignored test cases", e);
        }
    }
    return null;
}
 
Example #30
Source Project: JQF   Author: rohanpadhye   File: GuidedFuzzing.java    License: BSD 2-Clause "Simplified" License 5 votes vote down vote up
/**
 * Runs the guided fuzzing loop for a resolved class.
 *
 * <p>The test class must be annotated with <tt>@RunWith(JQF.class)</tt>
 * and the test method must be annotated with <tt>@Fuzz</tt>.</p>
 *
 * <p>Once this method is invoked, the guided fuzzing loop runs continuously
 * until the guidance instance decides to stop by returning <tt>false</tt>
 * for {@link Guidance#hasInput()}. Until the fuzzing stops, this method
 * cannot be invoked again (i.e. at most one guided fuzzing can be running
 * at any time in a single JVM instance).</p>
 *
 * @param testClass     the test class containing the test method
 * @param testMethod    the test method to execute in the fuzzing loop
 * @param guidance      the fuzzing guidance
 * @param out           an output stream to log Junit messages
 * @throws IllegalStateException if a guided fuzzing run is currently executing
 * @return the Junit-style test result
 */
public synchronized static Result run(Class<?> testClass, String testMethod,
                                      Guidance guidance, PrintStream out) throws IllegalStateException {

    // Ensure that the class uses the right test runner
    RunWith annotation = testClass.getAnnotation(RunWith.class);
    if (annotation == null || !annotation.value().equals(JQF.class)) {
        throw new IllegalArgumentException(testClass.getName() + " is not annotated with @RunWith(JQF.class)");
    }


    // Set the static guided instance
    setGuidance(guidance);

    // Register callback
    SingleSnoop.setCallbackGenerator(guidance::generateCallBack);

    // Create a JUnit Request
    Request testRequest = Request.method(testClass, testMethod);

    // Instantiate a runner (may return an error)
    Runner testRunner = testRequest.getRunner();

    // Start tracing for the test method
    SingleSnoop.startSnooping(testClass.getName() + "#" + testMethod);

    // Run the test and make sure to de-register the guidance before returning
    try {
        JUnitCore junit = new JUnitCore();
        if (out != null) {
            junit.addListener(new TextListener(out));
        }
        return junit.run(testRunner);
    } finally {
        unsetGuidance();
    }



}