org.junit.runners.Suite#junit.framework.TestSuite源码实例Demo

下面列出了org.junit.runners.Suite#junit.framework.TestSuite 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: caffeine   文件: SingleConsumerQueueTests.java
private static TestSuite queueTest(boolean optimistic) {
  return QueueTestSuiteBuilder
      .using(new TestStringQueueGenerator() {
          @Override public Queue<String> create(String[] elements) {
            Queue<String> queue = optimistic
                ? SingleConsumerQueue.optimistic()
                : SingleConsumerQueue.linearizable();
            queue.addAll(MinimalCollection.of(elements));
            return queue;
          }
        })
      .named(SingleConsumerQueue.class.getSimpleName())
      .withFeatures(
          CollectionFeature.ALLOWS_NULL_QUERIES,
          CollectionFeature.GENERAL_PURPOSE,
          CollectionFeature.SERIALIZABLE,
          CollectionFeature.KNOWN_ORDER,
          CollectionSize.ANY)
      .createTestSuite();
}
 
源代码2 项目: cacheonix-core   文件: CoreTestSuite.java
/**
 * Constructs test suite.
 * @return test suite
 */
public static Test suite() {
    TestSuite s = new TestSuite();
    s.addTestSuite(LoggingEventTest.class);
    s.addTestSuite(org.apache.log4j.LevelTest.class);
    s.addTestSuite(org.apache.log4j.PriorityTest.class);
    s.addTestSuite(org.apache.log4j.CategoryTest.class);
    s.addTestSuite(org.apache.log4j.FileAppenderTest.class);
    s.addTestSuite(org.apache.log4j.LogManagerTest.class);
    s.addTestSuite(org.apache.log4j.helpers.LogLogTest.class);
    s.addTestSuite(org.apache.log4j.LayoutTest.class);
    s.addTestSuite(org.apache.log4j.helpers.DateLayoutTest.class);
    s.addTestSuite(org.apache.log4j.TTCCLayoutTest.class);
    s.addTestSuite(org.apache.log4j.xml.XMLLayoutTest.class);
    s.addTestSuite(org.apache.log4j.HTMLLayoutTest.class);
    s.addTestSuite(org.apache.log4j.PatternLayoutTest.class);
    s.addTestSuite(org.apache.log4j.spi.LoggingEventTest.class);
    s.addTestSuite(org.apache.log4j.spi.ThrowableInformationTest.class);
    s.addTestSuite(org.apache.log4j.spi.LocationInfoTest.class);
    s.addTestSuite(org.apache.log4j.PropertyConfiguratorTest.class);
    s.addTestSuite(org.apache.log4j.net.SMTPAppenderTest.class);
    s.addTestSuite(org.apache.log4j.net.TelnetAppenderTest.class);
    return s;
}
 
源代码3 项目: kfs   文件: TestSuiteBuilder.java
/**
 * Scans *Test.class files under org.kuali for matches against the given strategies.
 * 
 * @param classCriteria strategy for whether to include a given TestCase in the suite. If included, a test class acts like a
 *        sub-suite to include all its test methods. Classes not included may still include methods individually.
 * @param methodCriteria strategy for whether to include a given test method in the suite, if the whole class was not included.
 * @return a TestSuite containing the specified tests
 * @throws java.io.IOException if the directory containing this class file cannot be scanned for other test class files
 * @throws Exception if either of the given criteria throw it
 */
public static TestSuite build(ClassCriteria classCriteria, MethodCriteria methodCriteria) throws Exception {
    TestSuite suite = new TestSuite();
    for (Class<? extends TestCase> t : constructTestClasses(scanTestClassNames(getTestRootPackageDir()))) {
        if (t.isAnnotationPresent(Exclude.class)) {
            continue; // don't consider any methods of this test either
        }
        if (classCriteria.includes(t)) {
            suite.addTestSuite(t);
        }
        else {
            for (Method m : t.getMethods()) {
                if (isTestMethod(m) && methodCriteria.includes(m)) {
                    suite.addTest(TestSuite.createTest(t, m.getName()));
                }
            }
        }
    }
    suite.setName(getDefaultName());
    return suite;
}
 
源代码4 项目: gemfirexd-oss   文件: DboPowersTest.java
/**
 * Wraps the shutdown fixture in decorators to run with data
 * base owner and one other valid user.
 *
 * @param autLev security context to use
 */

private static Test wrapShutdownUserTests(int autLev)
{
    // add decorator for different users authenticated
    TestSuite usersSuite =
        new TestSuite("usersSuite: security level=" +
                      secLevelNames[autLev]);

    // First decorate with users, then with
    for (int userNo = 0; userNo < users.length; userNo++) {
        usersSuite.addTest
            (TestConfiguration.changeUserDecorator
             (new DboPowersTest("testShutDown", autLev),
              users[autLev-1][userNo],
              users[autLev-1][userNo].concat(pwSuffix)));
    }

    return DatabasePropertyTestSetup.
        builtinAuthentication(usersSuite, users[autLev-1], pwSuffix);
}
 
源代码5 项目: gemfirexd-oss   文件: DBInJarTest.java
protected static Test baseSuite(String name) {
    TestSuite suite = new TestSuite(name);
    suite.addTestSuite(DBInJarTest.class);
    // Don't run with security manager, we need access to user.dir to archive
    // the database.
    return new CleanDatabaseTestSetup(SecurityManagerSetup.noSecurityManager(suite)) 
    {
        /**
         * Creates the procedure used in the test cases.
         * @exception SQLException if a database error occurs
         */
        protected void decorateSQL(Statement stmt) throws SQLException
        {
            stmt.execute("create procedure CREATEARCHIVE(jarName VARCHAR(20)" +
                    " , path VARCHAR(20), dbName VARCHAR(20))" +
                    " LANGUAGE JAVA PARAMETER STYLE JAVA" +
                    " NO SQL" +
                    " EXTERNAL NAME 'org.apache.derbyTesting.functionTests.tests.lang.dbjarUtil.createArchive'");
            
            
        }
    };
}
 
源代码6 项目: j2objc   文件: TestUtil.java
public static TestSuite getPackageTests(String pkgName) {
  if (pkgName == null || pkgName.isEmpty()) {
    throw new IllegalArgumentException("package name not specified");
  }
  Class<?>[] allJreTests = null;
  try {
    Class<?> allJreTestsClass = Class.forName("AllJreTests");
    Annotation a = allJreTestsClass.getAnnotation(Suite.SuiteClasses.class);
    if (a == null) {
      throw new AssertionError(ALLJRETESTS_NOT_ACCESSIBLE);
    }
    Method valueAccessor = Suite.SuiteClasses.class.getDeclaredMethod("value");
    allJreTests = (Class<?>[]) valueAccessor.invoke(a);
  } catch (Exception e) {
    throw new AssertionError(ALLJRETESTS_NOT_ACCESSIBLE);
  }

  TestSuite packageTests = new TestSuite();
  for (Class<?> jreTest : allJreTests) {
    Package testPackage = jreTest.getPackage();
    if (testPackage != null && testPackage.getName().equals(pkgName) && !isSuiteClass(jreTest)) {
      packageTests.addTest(new TestSuite(jreTest));
    }
  }
  return packageTests;
}
 
源代码7 项目: gemfirexd-oss   文件: SURQueryMixTest.java
private static TestSuite createTestCases(final String modelName) {
    TestSuite suite = new TestSuite();
    for (int doPos = 0; doPos<2; doPos++) {
        boolean positioned = doPos>0; // true if to use positioned updates

        for (int i = 0; i < selectConditions.length; i++) {
            for (int j = 0; j < projectConditions.length; j++) {
                final String cursorName = "cursor_" + i + "_" + j;
                
                final String stmtString = "SELECT " + projectConditions[j] +
                        " FROM T1 " + selectConditions[i];
                suite.addTest(new SURQueryMixTest(modelName, stmtString, cursorName, 
                                          positioned));
            }
        }
    }
    return suite;
}
 
源代码8 项目: gemfirexd-oss   文件: LangProcedureTest.java
/**
 * Default suite for running this test (embedded and client).
 */
public static Test suite() {
    if (JDBC.vmSupportsJSR169())
        return new TestSuite("Empty LangProcedureTest. JSR169 does not support jdbc:default:connection");
    else
        return TestConfiguration.defaultSuite(LangProcedureTest.class);
}
 
源代码9 项目: android-test   文件: AndroidDeviceTestSuite.java
public static TestSuite suite() {
  String argvFromEnv = System.getProperty("argv");
  String[] cleanedFlags =
      Arrays.stream(argvFromEnv.split(" |="))
          .map(s -> s.replaceAll("^\"|\"$", ""))
          .toArray(String[]::new);
  return new Builder().withCommandLineArgs(cleanedFlags).build();
  // */
}
 
源代码10 项目: database   文件: JSR166TestCase.java
public static TestSuite newTestSuite(Object... suiteOrClasses) {
    TestSuite suite = new TestSuite();
    for (Object suiteOrClass : suiteOrClasses) {
        if (suiteOrClass instanceof TestSuite)
            suite.addTest((TestSuite) suiteOrClass);
        else if (suiteOrClass instanceof Class)
            suite.addTest(new TestSuite((Class<?>) suiteOrClass));
        else
            throw new ClassCastException("not a test suite or class");
    }
    return suite;
}
 
源代码11 项目: netbeans   文件: FxmlParserTest.java
public static TestSuite suite() {
    TestSuite s = new TestSuite();
    s.addTest(new FxmlParserTest("testUnresolvedThings"));
    s.addTest(new FxmlParserTest("testDefinitionsResolved"));
    s.addTest(new FxmlParserTest("testInlineScript"));
    return s;
}
 
源代码12 项目: gemfirexd-oss   文件: ResultSetTest.java
/************************************************************************
 **                        T E S T  S E T U P                           *
 ************************************************************************/

public static Test suite() {
    TestSuite rsSuite = new TestSuite("ResultSetTest suite");
    rsSuite.addTest(decorateTestSuite(TestConfiguration.defaultSuite
        (ResultSetTest.class,false)));
    return rsSuite;
}
 
源代码13 项目: oopsla15-artifact   文件: AllTests.java
private static void addReferenceTests(TestSuite suite) {
	suite.addTestSuite(org.eclipse.imp.pdb.test.reference.TestAnnotations.class);
	suite.addTestSuite(org.eclipse.imp.pdb.test.reference.TestBasicValues.class);
	suite.addTestSuite(org.eclipse.imp.pdb.test.reference.TestEquality.class);
	suite.addTestSuite(org.eclipse.imp.pdb.test.reference.TestList.class);
	suite.addTestSuite(org.eclipse.imp.pdb.test.reference.TestListRelation.class);
	suite.addTestSuite(org.eclipse.imp.pdb.test.reference.TestMap.class);
	suite.addTestSuite(org.eclipse.imp.pdb.test.reference.TestRandomValues.class);
	suite.addTestSuite(org.eclipse.imp.pdb.test.reference.TestRelation.class);
	suite.addTestSuite(org.eclipse.imp.pdb.test.reference.TestSet.class);
	suite.addTestSuite(org.eclipse.imp.pdb.test.reference.TestValueFactory.class);
}
 
源代码14 项目: marathonv5   文件: DisplayWindow.java
@Override
public void openTest(Test suite) {
    Test test = null;
    if (suite instanceof TestSuite) {
        test = ((TestSuite) suite).testAt(0);
    } else {
        test = suite;
    }
    if (test != null && test instanceof MarathonTestCase) {
        openFile(((MarathonTestCase) test).getFile());
    }
}
 
public static Test suite() {
	return new TestSetup(new TestSuite(博客测试2.class)) {
		protected void setUp() {
			System.out.println("用户登录");
		}
		
		protected void tearDown() {
			System.out.println("用户注销");
		}
	};
}
 
源代码16 项目: gemfirexd-oss   文件: NullSQLTextTest.java
private static Test baseSuite(String name) {
    TestSuite suite = new TestSuite(name);

    suite.addTestSuite(NullSQLTextTest.class);

    return new CleanDatabaseTestSetup(suite) {
        /**
         * Creates the tables and the stored procedures used in the test
         * cases.
         *
         * @exception SQLException if a database error occurs
         */
        protected void decorateSQL(Statement stmt) throws SQLException {

            Connection conn = getConnection();

            /**
             * Creates the table used in the test cases.
             *
             */
            stmt.execute("create table t1 (i int)");
            stmt.execute("insert into t1 values 1, 2, 3, 4, 5, 6, 7");
            stmt.execute("create procedure za() language java external name " +
                         "'org.apache.derbyTesting.functionTests.tests.jdbcapi.NullSQLTextTest.zeroArg'" +
                         " parameter style java");
        }
    };
}
 
源代码17 项目: cacheonix-core   文件: SuiteTest.java
public void testCreateSuiteFromArray() {
	Class[] testClassArray = { OneTestCase.class, DoublePrecisionAssertTest.class };
	TestSuite suite = new TestSuite(testClassArray);
	assertEquals(2, suite.testCount());
	assertEquals("junit.tests.framework.DoublePrecisionAssertTest" , ((TestSuite)suite.testAt(1)).getName());
	assertEquals("junit.tests.framework.OneTestCase" , ((TestSuite)suite.testAt(0)).getName());
}
 
源代码18 项目: gemfirexd-oss   文件: DboPowersTest.java
/**
 * Wraps the encryption fixtures in decorators to run with data
 * base owner and one other valid user.
 *
 * @param autLev security context to use
 */

private static Test wrapEncryptionUserTests(int autLev)
{
    // add decorator for different users authenticated
    TestSuite usersSuite =
        new TestSuite("usersSuite: security level=" +
                      secLevelNames[autLev]);

    // First decorate with users, then with authentication.  Note
    // use of no teardown / no shutdown decorator variants:
    // Necessary since framework doesnt know bootPassword
    for (int userNo = 0; userNo < users.length; userNo++) {
        for (int tNo = 0; tNo < encryptionTests.length; tNo++) {
            Test test = TestConfiguration.changeUserDecorator
                (new DboPowersTest(encryptionTests[tNo],
                                   autLev,
                                   users[autLev-1][0], // dbo
                                   users[autLev-1][0].concat(pwSuffix)),
                 users[autLev-1][userNo],
                 users[autLev-1][userNo].concat(pwSuffix));
            test = DatabasePropertyTestSetup.builtinAuthenticationNoTeardown
                (test, users[autLev-1], pwSuffix);
            if (autLev == AUTHENTICATION) {
                test = TestConfiguration.
                    singleUseDatabaseDecoratorNoShutdown(test);
            } else {
                test = TestConfiguration.
                    sqlAuthorizationDecoratorSingleUse(test);
            }
            usersSuite.addTest(test);
        }
    }
    return usersSuite;
}
 
源代码19 项目: gemfirexd-oss   文件: Derby3625Test.java
protected static Test baseSuite(String name) 
{
    TestSuite suite = new TestSuite(name);
    suite.addTestSuite(Derby3625Test.class);
    return new CleanDatabaseTestSetup(
            DatabasePropertyTestSetup.setLockTimeouts(suite, 2, 4)) 
    {
        /**
         * Creates the tables used in the test cases.
         * @exception SQLException if a database error occurs
         */
        protected void decorateSQL(Statement stmt) throws SQLException
        {
            Connection conn = stmt.getConnection();

            CallableStatement set_dbprop =  conn.prepareCall(
                "CALL SYSCS_UTIL.SET_DATABASE_PROPERTY(?, ?)");
            set_dbprop.setString(1,"gemfirexd.storage.pageReservedSpace");
            set_dbprop.setString(2,"0");
            set_dbprop.executeUpdate();
            
            // create a table, with blob it will be 32k page size
            stmt.executeUpdate(
                "CREATE TABLE testCompress " +
                    "(id int, padcol blob(1M), c varchar(200))");

            set_dbprop.setString(2, null);
            set_dbprop.executeUpdate();

            set_dbprop.close();

            conn.setAutoCommit(false);
        }
    };
}
 
源代码20 项目: spliceengine   文件: OSReadOnlyTest.java
protected static Test baseSuite(String name) 
{
    TestSuite readonly = new TestSuite("OSReadOnly");
    TestSuite suite = new TestSuite(name);
    readonly.addTestSuite(OSReadOnlyTest.class);
    suite.addTest(TestConfiguration.singleUseDatabaseDecorator(newCleanDatabase(readonly)));
    
    return suite;
}
 
源代码21 项目: database   文件: TestTCK.java
/**
 * Execute the stress tests a couple of times.
 * 
 * @throws Exception
 */
public void test_stressTests() throws Exception {

    for (int i = 0; i < 100; i++) {
        final TestSuite suite = new TestSuite(
            TCKStressTests.class.getSimpleName());

        suite.addTestSuite(TCKStressTests.class);
        suite.run(new TestResult());
    }
}
 
源代码22 项目: cacheonix-core   文件: TestSuiteVisitor.java
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 );
}
 
源代码23 项目: Camera2   文件: CameraTestRunner.java
@Override
public TestSuite getAllTests()
{
    TestSuite suite = new InstrumentationTestSuite(this);
    suite.addTestSuite(CameraTest.class);
    suite.addTestSuite(ImageCaptureIntentTest.class);
    suite.addTestSuite(VideoCaptureIntentTest.class);
    suite.addTestSuite(CameraUnitTest.class);
    return suite;
}
 
源代码24 项目: spliceengine   文件: TestConfiguration.java
/**
 * Create a test suite with all the test cases in the specified class. The
 * test cases should be ordered lexicographically by their names.
 *
 * @param testClass the class with the test cases
 * @return a lexicographically ordered test suite
 */
public static Test orderedSuite(Class testClass) {
    // Extract all tests from the test class and order them.
    ArrayList tests = Collections.list(new TestSuite(testClass).tests());
    Collections.sort(tests, TEST_ORDERER);

    // Build a new test suite with the tests in lexicographic order.
    TestSuite suite = new TestSuite(suiteName(testClass));
    for (Iterator it = tests.iterator(); it.hasNext(); ) {
        suite.addTest((Test) it.next());
    }

    return suite;
}
 
源代码25 项目: xtext-lib   文件: MapExtensionsTest.java
public static TestSuite suite() {
	return MapTestSuiteBuilder
			// The create method is called with an array of elements
			// that should populate the collection.
			.using(new TestStringMapGenerator() {
				@Override
				protected Map<String, String> create(Entry<String, String>[] source) {
					Map<String, String> left = Maps.newHashMap();
					Map<String, String> right = Maps.newHashMap();
					for(int i = 0; i < source.length; i++) {
						Entry<String, String> entry = source[i];
						if (right.containsKey(entry.getKey())) {
							left.put(entry.getKey(), right.get(entry.getKey()));
							right.put(entry.getKey(), entry.getValue());
						} else if (i % 2 != 0) {
							left.put(entry.getKey(), entry.getValue());	
						} else {
							right.put(entry.getKey(), entry.getValue());
							if (i % 4 != 0) {
								left.put(entry.getKey(), "will be ignored");
							}
						}
					}
					return new UnmodifiableMergingMapView(left, right);
				}
			}).named("Guava-based UnmodifiableMergingMapView tests")
			.withFeatures(
					MapFeature.ALLOWS_NULL_KEYS,
					MapFeature.ALLOWS_NULL_VALUES,
					MapFeature.ALLOWS_ANY_NULL_QUERIES,
					MapFeature.FAILS_FAST_ON_CONCURRENT_MODIFICATION,
					CollectionFeature.ALLOWS_NULL_QUERIES,
					CollectionFeature.FAILS_FAST_ON_CONCURRENT_MODIFICATION,
					CollectionSize.ANY)
			.createTestSuite();
}
 
源代码26 项目: astor   文件: TestMutableDateTime_Properties.java
public static TestSuite suite() {
    return new TestSuite(TestMutableDateTime_Properties.class);
}
 
源代码27 项目: tracecompass   文件: SWTBotStressTests.java
/**
 * @return Test suite definition
 */
public static TestSuite suite() {
    TestSuite s = new TestSuite(String.format("Stress Test [%d runs]", NB_RUNS));
    s.addTest(new RepeatedTest(new JUnit4TestAdapter(RunAllSWTBotTests.class), NB_RUNS));
    return s;
}
 
源代码28 项目: openjdk-jdk9   文件: ExecutorsTest.java
public static Test suite() {
    return new TestSuite(ExecutorsTest.class);
}
 
源代码29 项目: astor   文件: VectorialMeanTest.java
public static Test suite() {
    return new TestSuite(VectorialMeanTest.class);
}
 
源代码30 项目: rdf4j   文件: TurtleParserTestCase.java
private void parsePositiveTurtleEvalTests(TestSuite suite, String fileBasePath, String testBaseUrl,
		String manifestBaseUrl, RepositoryConnection con) throws Exception {
	StringBuilder positiveEvalQuery = new StringBuilder();
	positiveEvalQuery.append(" PREFIX mf:   <http://www.w3.org/2001/sw/DataAccess/tests/test-manifest#>\n");
	positiveEvalQuery.append(" PREFIX qt:   <http://www.w3.org/2001/sw/DataAccess/tests/test-query#>\n");
	positiveEvalQuery.append(" PREFIX rdft: <http://www.w3.org/ns/rdftest#>\n");
	positiveEvalQuery.append(" SELECT ?test ?testName ?inputURL ?outputURL \n");
	positiveEvalQuery.append(" WHERE { \n");
	positiveEvalQuery.append("     ?test a rdft:TestTurtleEval . ");
	positiveEvalQuery.append("     ?test mf:name ?testName . ");
	positiveEvalQuery.append("     ?test mf:action ?inputURL . ");
	positiveEvalQuery.append("     ?test mf:result ?outputURL . ");
	positiveEvalQuery.append(" }");

	TupleQueryResult queryResult = con.prepareTupleQuery(QueryLanguage.SPARQL, positiveEvalQuery.toString())
			.evaluate();

	// Add all positive eval tests to the test suite
	while (queryResult.hasNext()) {
		BindingSet bindingSet = queryResult.next();
		IRI nextTestUri = (IRI) bindingSet.getValue("test");
		String nextTestName = ((Literal) bindingSet.getValue("testName")).getLabel();
		String nextTestFile = removeBase(((IRI) bindingSet.getValue("inputURL")).toString(), manifestBaseUrl);
		String nextInputURL = fileBasePath + nextTestFile;
		String nextOutputURL = fileBasePath
				+ removeBase(((IRI) bindingSet.getValue("outputURL")).toString(), manifestBaseUrl);

		String nextBaseUrl = testBaseUrl + nextTestFile;

		// if (nextTestName.contains("CARRIAGE_RETURN")) {
		// // FIXME: Sesame seems not to preserve the CARRIAGE_RETURN character
		// // right now
		// System.err.println("Ignoring Turtle Positive Parser Eval Test: " + nextInputURL);
		// continue;
		// }

		suite.addTest(new PositiveParserTest(nextTestUri, nextTestName, nextInputURL, nextOutputURL, nextBaseUrl,
				createTurtleParser(), createNTriplesParser()));
	}

	queryResult.close();
}