Package org.junit.runners

Examples of org.junit.runners.ParentRunner


    private CountingRunListener runTestWithParentRunner(Class<?> testClass) throws InitializationError {
        CountingRunListener listener = new CountingRunListener();
        RunNotifier runNotifier = new RunNotifier();
        runNotifier.addListener(listener);
        ParentRunner runner = new BlockJUnit4ClassRunner(testClass);
        runner.run(runNotifier);
        return listener;
    }
View Full Code Here


        }

        private void populateChildrenFromSuites() {
            Filter filter = new SuiteFilter();
            for (Iterator<ParentRunner> it = suites.iterator(); it.hasNext();) {
                ParentRunner suite = it.next();
                try {
                    suite.filter(filter);
                } catch (NoTestsRemainException e) {
                    it.remove();
                }
            }
        }
View Full Code Here

            int parallelMethods = allGroups.get(Type.METHODS);
            int poolSize = totalPoolSize();
            ExecutorService commonPool = splitPool || poolSize == 0 ? null : createPool(poolSize);
            master = createMaster(commonPool, poolSize);

            ParentRunner suiteSuites = wrapRunners( suites );
            if ( suiteSuites != null )
            {
                // a scheduler for parallel suites
                if ( commonPool != null && parallelSuites > 0 )
                {
                    Balancer balancer = BalancerFactory.createBalancerWithFairness( parallelSuites );
                    suiteSuites.setScheduler( createScheduler( null, commonPool, true, balancer ) );
                }
                else
                {
                    suiteSuites.setScheduler( createScheduler( parallelSuites ) );
                }
            }

            // schedulers for parallel classes
            ParentRunner suiteClasses = wrapRunners( classes );
            ArrayList<ParentRunner> allSuites = new ArrayList<ParentRunner>( suites );
            allSuites.addAll( nestedSuites );
            if ( suiteClasses != null )
            {
                allSuites.add( suiteClasses );
            }
            if ( !allSuites.isEmpty() )
            {
                setSchedulers( allSuites, parallelClasses, commonPool );
            }

            // schedulers for parallel methods
            ArrayList<ParentRunner> allClasses = new ArrayList<ParentRunner>( classes );
            allClasses.addAll( nestedClasses );
            if ( !allClasses.isEmpty() )
            {
                setSchedulers( allClasses, parallelMethods, commonPool );
            }

            // resulting runner for Computer#getSuite() scheduled by master scheduler
            ParentRunner all = createFinalRunner( suiteSuites, suiteClasses );
            all.setScheduler( master );
            return all;
        }
View Full Code Here

        {
            // Do NOT use allGroups here.
            Filter filter = new SuiteFilter();
            for ( Iterator<ParentRunner> it = suites.iterator(); it.hasNext(); )
            {
                ParentRunner suite = it.next();
                try
                {
                    suite.filter( filter );
                }
                catch ( NoTestsRemainException e )
                {
                    it.remove();
                }
View Full Code Here

            {
                setSchedulers( allClasses, parallelMethods, commonPool );
            }

            // resulting runner for Computer#getSuite() scheduled by master scheduler
            ParentRunner all = createFinalRunner( suiteSuites, suiteClasses );
            all.setScheduler( master );
            return all;
        }
View Full Code Here

                {
                    nestedSuites.add( (Suite) child );
                }
                else if ( child instanceof ParentRunner )
                {
                    ParentRunner parentRunner = (ParentRunner) child;
                    nestedClasses.add( parentRunner );
                    nestedClassesChildren += parentRunner.getDescription().getChildren().size();
                }
            }
View Full Code Here

        {
            // Do NOT use allGroups here.
            Filter filter = new SuiteFilter();
            for ( Iterator<ParentRunner> it = suites.iterator(); it.hasNext(); )
            {
                ParentRunner suite = it.next();
                try
                {
                    suite.filter( filter );
                }
                catch ( NoTestsRemainException e )
                {
                    it.remove();
                }
View Full Code Here

            {
                setSchedulers( allClasses, parallelMethods, commonPool );
            }

            // resulting runner for Computer#getSuite() scheduled by master scheduler
            ParentRunner all = createFinalRunner( removeNullRunners(
                Arrays.<Runner>asList( suiteSuites, suiteClasses, createSuite( notParallelRunners ) )
            ) );
            all.setScheduler( master );
            return all;
        }
View Full Code Here

                throws NoTestsRemainException
            {
                super.apply( child );
                if ( child instanceof ParentRunner )
                {
                    ParentRunner runner = ( ParentRunner ) child;
                    if ( !isThreadSafe( runner ) )
                    {
                        runner.setScheduler( notThreadSafeTests.newRunnerScheduler() );
                    }
                    else if ( child instanceof Suite )
                    {
                        nestedSuites.add( (Suite) child );
                    }
                    else
                    {
                        ParentRunner parentRunner = (ParentRunner) child;
                        nestedClasses.add( parentRunner );
                        nestedClassesChildren += parentRunner.getDescription().getChildren().size();
                    }
                }
            }
View Full Code Here

TOP

Related Classes of org.junit.runners.ParentRunner

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.