@Override protected List<FrameworkMethod> getChildren() { return computeTestMethods(); }
@Override protected List<FrameworkMethod> getChildren() { return computeTestMethods(); }
@Override protected List<FrameworkMethod> computeTestMethods() { List<FrameworkMethod> testMethods = new ArrayList<FrameworkMethod>(super.computeTestMethods()); List<FrameworkMethod> theoryMethods = getTestClass().getAnnotatedMethods(Theory.class); testMethods.removeAll(theoryMethods); testMethods.addAll(theoryMethods); return testMethods; }
/** * Generates the exploded list of methods that run tests. All methods annotated with {@code @Test} on this class and * super classes that are not overridden are checked if they use a {@code @}{@link DataProvider} or not. If yes, for * each row of the {@link DataProvider}s result a specific, parameterized test method will be added. If not, the * original test method is added. * <p> * Additionally, caches the result as {@link #computeTestMethods()} is call multiple times while test execution by * the JUnit framework (to validate, to filter, to execute, ...). * * @return the exploded list of test methods (never {@code null}) */ @Override protected List<FrameworkMethod> computeTestMethods() { if (computedTestMethods == null) { // Further method for generation is required due to stubbing of "super.computeTestMethods()" is not possible computedTestMethods = generateExplodedTestMethodsFor(super.computeTestMethods()); } return computedTestMethods; }
@Override protected List<FrameworkMethod> computeTestMethods() { List<FrameworkMethod> testMethods = super.computeTestMethods(); List<FrameworkMethod> theoryMethods = getTestClass().getAnnotatedMethods(Theory.class); testMethods.removeAll(theoryMethods); testMethods.addAll(theoryMethods); return testMethods; }
/** * Adds to {@code errors} for each method annotated with {@code @Test}, * {@code @Before}, or {@code @After} that is not a public, void instance * method with no arguments. * @deprecated */ @Deprecated protected void validateInstanceMethods(List<Throwable> errors) { validatePublicVoidNoArgMethods(After.class, false, errors); validatePublicVoidNoArgMethods(Before.class, false, errors); validateTestMethods(errors); if (computeTestMethods().isEmpty()) { errors.add(new Exception("No runnable methods")); } }
/** * Adds to {@code errors} for each method annotated with {@code @Test}, * {@code @Before}, or {@code @After} that is not a public, void instance * method with no arguments. * * @deprecated unused API, will go away in future version */ @Deprecated protected void validateInstanceMethods(List<Throwable> errors) { validatePublicVoidNoArgMethods(After.class, false, errors); validatePublicVoidNoArgMethods(Before.class, false, errors); validateTestMethods(errors); if (computeTestMethods().size() == 0) { errors.add(new Exception("No runnable methods")); } }
/** * Create a new runner for given test class. * * @param clazz test class * @throws Throwable */ public ConcurrentRunner(Class<?> clazz) throws Throwable { super(clazz); concurrentTestMethods = new LinkedList<>(super.computeTestMethods()); concurrentTestMethods.removeAll(getTestClass().getAnnotatedMethods(RunSeparately.class)); final List<FrameworkMethod> ignored = getTestClass().getAnnotatedMethods(Ignore.class); concurrentTestMethods.removeAll(ignored); }
protected List<FrameworkMethod> doComputation() { // Next, get all the test methods as understood by JUnit final List<FrameworkMethod> methods = super.computeTestMethods(); // Now process that full list of test methods and build our custom result final List<FrameworkMethod> result = new ArrayList<FrameworkMethod>(); final boolean doValidation = Boolean.getBoolean( Helper.VALIDATE_FAILURE_EXPECTED ); int testCount = 0; Ignore virtualIgnore; for ( FrameworkMethod frameworkMethod : methods ) { // potentially ignore based on expected failure final FailureExpected failureExpected = Helper.locateAnnotation( FailureExpected.class, frameworkMethod, getTestClass() ); if ( failureExpected != null && !doValidation ) { virtualIgnore = new IgnoreImpl( Helper.extractIgnoreMessage( failureExpected, frameworkMethod ) ); } else { virtualIgnore = convertSkipToIgnore( frameworkMethod ); } testCount++; log.trace( "adding test " + Helper.extractTestName( frameworkMethod ) + " [#" + testCount + "]" ); result.add( new ExtendedFrameworkMethod( frameworkMethod, virtualIgnore, failureExpected ) ); } return result; }
@Override protected List<FrameworkMethod> computeTestMethods() { return computeTestMethodsForClass(getTestClass().getJavaClass(), super.computeTestMethods()); }
@Override protected List<FrameworkMethod> getChildren() { return computeTestMethods(); }
@Override protected List<FrameworkMethod> computeTestMethods() { List<FrameworkMethod> testMethods = super.computeTestMethods(); List<FrameworkMethod> theoryMethods = getTestClass().getAnnotatedMethods(Theory.class); testMethods.removeAll(theoryMethods); testMethods.addAll(theoryMethods); return testMethods; }
/** * Adds to {@code errors} for each method annotated with {@code @Test}, * {@code @Before}, or {@code @After} that is not a public, void instance * method with no arguments. * * @deprecated unused API, will go away in future version */ @Deprecated protected void validateInstanceMethods(List<Throwable> errors) { validatePublicVoidNoArgMethods(After.class, false, errors); validatePublicVoidNoArgMethods(Before.class, false, errors); validateTestMethods(errors); if (computeTestMethods().size() == 0) { errors.add(new Exception("No runnable methods")); } }
@Override protected List<FrameworkMethod> computeTestMethods() { List<FrameworkMethod> methods = super.computeTestMethods(); List<FrameworkMethod> result; Class<?> testClass = getTestClass().getJavaClass(); if (isFlakyClass(testClass)) { result = computeTestMehods(methods, testClass); } else { result = computeTestMethods(methods); } return result; }
@Override protected List<FrameworkMethod> computeTestMethods() { final List<FrameworkMethod> methods = new ArrayList<>(super.computeTestMethods()); // copy cause of junit 4.12 which is umodifiable Collections.shuffle(methods); // real tests should manage shuffle ordering return methods; }
@Override protected List<FrameworkMethod> computeTestMethods() { List<FrameworkMethod> methods = super.computeTestMethods(); // sort a copy methods = new ArrayList<>(methods); MethodSorter.sortMethodsUsingSourceOrder(methods); return methods; }
@Override protected List<FrameworkMethod> computeTestMethods() { return ListGenerator.getShuffleList( super.computeTestMethods() ); } }
@Override protected List<FrameworkMethod> computeTestMethods() { List<FrameworkMethod> testMethods = new ArrayList<FrameworkMethod>(super.computeTestMethods()); List<FrameworkMethod> theoryMethods = getTestClass().getAnnotatedMethods(Theory.class); testMethods.removeAll(theoryMethods); testMethods.addAll(theoryMethods); return testMethods; }
@Override protected List<FrameworkMethod> computeTestMethods() { List<FrameworkMethod> testMethods = super.computeTestMethods(); List<FrameworkMethod> theoryMethods = getTestClass().getAnnotatedMethods(Theory.class); testMethods.removeAll(theoryMethods); testMethods.addAll(theoryMethods); return testMethods; }
protected List<FrameworkMethod> computeTestMethods() { if (isTestWithFile()) { List frameworkMethodList = new ArrayList(); addTestCase(frameworkMethodList, this.testSuite.getBackGrounds()); addTestCase(frameworkMethodList, this.testSuite.getBeforeSuite()); withBeforeAndAfterCommand(frameworkMethodList); addTestCase(frameworkMethodList, this.testSuite.getAfterSuite()); return frameworkMethodList; } return super.computeTestMethods(); }