Java Code Examples for junit.framework.TestSuite#tests()

The following examples show how to use junit.framework.TestSuite#tests() . 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 File: MarathonTestProvider.java    From marathonv5 with Apache License 2.0 6 votes vote down vote up
private static void collectTests(Test test, ArrayList<Object[]> tests) {
    if (test instanceof TestSuite) {
        TestSuite suite = (TestSuite) test;
        Enumeration<Test> tests2 = suite.tests();
        while (tests2.hasMoreElements()) {
            Test test2 = tests2.nextElement();
            collectTests(test2, tests);
        }
    } else {
        String name;
        if (test instanceof IHasFullname) {
            name = ((IHasFullname) test).getFullName();
        } else {
            name = ((TestCase) test).getName();
        }
        tests.add(new Object[] { test, name });
    }
}
 
Example 2
Source File: ExpandFolderTest.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private void iterateTests(TestResult result, StringBuffer times, TestSuite suite, AtomicLong min, AtomicLong max) {
    Enumeration en = suite.tests();
    while (en.hasMoreElements()) {
        Test t = (Test)en.nextElement();
        if (t instanceof Callable) {
            try {
                Long v = (Long)((Callable) t).call();
                long time = v.longValue();
                if (time < min.longValue()) {
                    min.set(time);
                }
                if (time > max.longValue()) {
                    max.set(time);
                }
                // append(t.toString()).append(" value: ")
                times.append("Run: ").append(v).append('\n');
            } catch (Exception ex) {
                result.addError(this, ex);
            }
        }
        if (t instanceof TestSuite) {
            iterateTests(result, times, (TestSuite)t, min, max);
        }
    }
}
 
Example 3
Source File: Bigdata2ASTSPARQL11SyntaxTest.java    From database with GNU General Public License v2.0 6 votes vote down vote up
static TestSuite filterOutTests(final TestSuite suite1, final Collection<String> testURIs) {

        final TestSuite suite2 = new TestSuite(suite1.getName());
        final Enumeration<Test> e = suite1.tests();
        while (e.hasMoreElements()) {
            final Test aTest = e.nextElement();
            if (aTest instanceof TestSuite) {
                final TestSuite aTestSuite = (TestSuite) aTest;
                suite2.addTest(filterOutTests(aTestSuite, testURIs));
            } else if (aTest instanceof Bigdata2ASTSPARQL11SyntaxTest) {
                final Bigdata2ASTSPARQL11SyntaxTest test = (Bigdata2ASTSPARQL11SyntaxTest) aTest;
                if (!testURIs.contains(test.testURI)) {
                    suite2.addTest(test);
                }
            }

        }
        return suite2;
       
    }
 
Example 4
Source File: BigdataSparqlTest.java    From database with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Hack filters out the "dataset" tests.
 * 
 * @param suite1
 *            The test suite.
 * 
 * @return The test suite without the data set tests.
 */
static protected TestSuite filterOutTests(final TestSuite suite1, final String name) {

    final TestSuite suite2 = new TestSuite(suite1.getName());
    final Enumeration<Test> e = suite1.tests();
    while (e.hasMoreElements()) {
        final Test aTest = e.nextElement();
        if (aTest instanceof TestSuite) {
            final TestSuite aTestSuite = (TestSuite) aTest;
            if (!aTestSuite.getName().equals(name)) {
                suite2.addTest(filterOutTests(aTestSuite,name));
            }
        } else {
            suite2.addTest(aTest);
        }
    }
    return suite2;
   
}
 
Example 5
Source File: BigdataSparqlTest.java    From database with GNU General Public License v2.0 6 votes vote down vote up
static protected TestSuite filterOutTests(final TestSuite suite1, final Collection<String> testURIs) {

        final TestSuite suite2 = new TestSuite(suite1.getName());
        final Enumeration<Test> e = suite1.tests();
        while (e.hasMoreElements()) {
            final Test aTest = e.nextElement();
            if (aTest instanceof TestSuite) {
            	final TestSuite aTestSuite = (TestSuite) aTest;
                suite2.addTest(filterOutTests(aTestSuite, testURIs));
            } else if (aTest instanceof BigdataSparqlTest) {
                final BigdataSparqlTest test = (BigdataSparqlTest) aTest;
                if (!testURIs.contains(test.testURI)) {
                    suite2.addTest(test);
                }
            }

        }
        return suite2;
       
    }
 
Example 6
Source File: BigdataSPARQLUpdateConformanceTest.java    From database with GNU General Public License v2.0 6 votes vote down vote up
static TestSuite filterOutTests(final TestSuite suite1, final Collection<String> testURIs) {

        final TestSuite suite2 = new TestSuite(suite1.getName());
        @SuppressWarnings("unchecked")
        final Enumeration<Test> e = suite1.tests();
        while (e.hasMoreElements()) {
            final Test aTest = e.nextElement();
            if (aTest instanceof TestSuite) {
                final TestSuite aTestSuite = (TestSuite) aTest;
                suite2.addTest(filterOutTests(aTestSuite, testURIs));
            } else if (aTest instanceof BigdataSPARQLUpdateConformanceTest) {
                final BigdataSPARQLUpdateConformanceTest test = 
                        (BigdataSPARQLUpdateConformanceTest) aTest;
                if (!testURIs.contains(test.testURI)) {
                    suite2.addTest(test);
                }
            }

        }
        return suite2;
       
    }
 
Example 7
Source File: TestSuiteVisitor.java    From cacheonix-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
public void visit(TestSuite testSuite) {
	handler.startingTestSuite( testSuite );
	Enumeration tests = testSuite.tests();
	while ( tests.hasMoreElements() ) {
		Test test = ( Test ) tests.nextElement();
		if ( test instanceof TestSuite ) {
			visit( ( TestSuite ) test );
		}
		else {
			handler.handleTestCase( test );
		}
	}
	handler.completedTestSuite( testSuite );
}
 
Example 8
Source File: ProxySuiteHelper.java    From database with GNU General Public License v2.0 5 votes vote down vote up
private static Test cloneSuite(final Test delegate, final TestSuite suite) {
	final TestSuite rslt =  new CloningTestSuite(delegate,suite.getName());
	final Enumeration<Test> enumerate = suite.tests();
	while( enumerate.hasMoreElements() ) {
		rslt.addTest(enumerate.nextElement());
	}
	return rslt;
}
 
Example 9
Source File: ProxyTestSuite.java    From database with GNU General Public License v2.0 4 votes vote down vote up
/**
    * <p>
    * Sets the delegate on each instantiated {@link Test} that implements
    * {@link IProxyTest}.
    * </p>
    */

   @SuppressWarnings("unchecked")
   protected void flowDown( final TestSuite suite ) {
       
       if( m_delegate == null ) {
       
           throw new AssertionError("delegate is not set.");
           
       }
       
for( java.util.Enumeration e= suite.tests(); e.hasMoreElements(); ) {

	    Test t = (Test)e.nextElement();

	    flowDown( t );
	    
}

   }