當前位置: 首頁>>代碼示例>>Java>>正文


Java Test.run方法代碼示例

本文整理匯總了Java中junit.framework.Test.run方法的典型用法代碼示例。如果您正苦於以下問題:Java Test.run方法的具體用法?Java Test.run怎麽用?Java Test.run使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在junit.framework.Test的用法示例。


在下文中一共展示了Test.run方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: testClusterPathFinal

import junit.framework.Test; //導入方法依賴的package包/類
public void testClusterPathFinal() throws Exception {
    if (!NbModuleSuiteTest.isCluster("ide")) {
        // skip
        return;
    }
    LinkedList<File> clusters = new LinkedList<File>();
    NbModuleSuite.S.findClusters(clusters, Collections.singletonList("ide"));
    assertFalse("Something found", clusters.isEmpty());
    assertEquals("One element found", 1, clusters.size());
    final File ideCluster = clusters.get(0);
    System.setProperty("cluster.path.final", ideCluster.getPath() + ":" + new File(ideCluster.getParent(), "nonexistent"));
    Configuration conf = NbModuleSuite.createConfiguration(NbModuleSuiteClusterPath.class).gui(false).clusters(".*");
    Test test = conf.suite();
    test.run(new TestResult());
    String val = System.getProperty("my.clusters");
    assertNotNull("The test was running", clusters);
    assertNotNull("Value has been set", val);
    assertTrue("ide cluster shall be included: " + val, val.contains(ideCluster.getPath()));
    assertFalse("no java cluster shall be included: " + val, val.matches(".*java[:;].*"));
    assertFalse("no apisupport cluster shall be included: " + val, val.matches(".*apisupport[:;].*"));
    assertFalse("no ergonomics cluster shall be included: " + val, val.matches(".*ergonomics[:;].*"));
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:23,代碼來源:NbModuleSuiteClusterPathFinalTest.java

示例2: testServices

import junit.framework.Test; //導入方法依賴的package包/類
public void testServices() throws Exception{
    Configuration conf = NbModuleSuite.createConfiguration(NbModuleSuiteMeta.class).gui(false);
    Test test = conf.suite();
    test.run(new TestResult());
    assertNotNull("The test was running", System.getProperty("meta"));
    assertEquals("result" + System.getProperty("meta"), "ok", System.getProperty("meta"));
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:8,代碼來源:NbModuleSuite2Test.java

示例3: suite

import junit.framework.Test; //導入方法依賴的package包/類
public static Test suite() {
    System.setProperty("ignore.random.failures", "false");
    final Test t = NbTestSuite.linearSpeedSuite(LinearSpeedTest.class, 2,2);

    class ThisHasToFail extends TestCase {
        
        public int countTestCases() {
            return 1;
        }

        public String getName() {
            return "LinearSpeedTest";
        }

        public void run(TestResult testResult) {
            TestResult r = new TestResult();
            t.run(r);
            
            int count = r.errorCount() + r.failureCount();
            if (count == 0) {
                testResult.startTest(this);
                testResult.addFailure(this, new AssertionFailedError("LinearSpeedTest must fail: " + count));
                testResult.endTest(this);
            } else {
                testResult.startTest(this);
                testResult.endTest(this);
            }
        }
    }
    return new ThisHasToFail();
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:32,代碼來源:LinearSpeedTest.java

示例4: testLifecycle

import junit.framework.Test; //導入方法依賴的package包/類
public void testLifecycle() {
  final boolean setUp[] = {false};
  Runnable setUpRunnable = new Runnable() {
    @Override
    public void run() {
      setUp[0] = true;
    }
  };

  final boolean tearDown[] = {false};
  Runnable tearDownRunnable = new Runnable() {
    @Override
    public void run() {
      tearDown[0] = true;
    }
  };

  MyTestSuiteBuilder builder = new MyTestSuiteBuilder();
  Test test = builder.usingGenerator("yam").named("yam")
      .withFeatures(CollectionFeature.NONE).withSetUp(setUpRunnable)
      .withTearDown(tearDownRunnable).createTestSuite();
  TestResult result = new TestResult();
  test.run(result);
  assertTrue(testWasRun);
  assertTrue(setUp[0]);
  assertTrue(tearDown[0]);
}
 
開發者ID:zugzug90,項目名稱:guava-mock,代碼行數:28,代碼來源:FeatureSpecificTestSuiteBuilderTest.java

示例5: runTestSuite

import junit.framework.Test; //導入方法依賴的package包/類
void runTestSuite( String testClassName ) {
    Test suite = getTest( testClassName );

    if (suite != null) {
        TestResult testResult = new TestResult();
        testResult.addListener( this );
        long startTime= System.currentTimeMillis();
        suite.run( testResult );
        long endTime= System.currentTimeMillis();
        _formatter.displayResults( _writer, testClassName, elapsedTimeAsString( endTime-startTime ), testResult );
    }
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:13,代碼來源:JUnitServlet.java

示例6: testTestCount

import junit.framework.Test; //導入方法依賴的package包/類
public void testTestCount() throws Exception{
    Test test  = NbModuleSuite.createConfiguration(NbModuleSuiteT.class).gui(false).suite();
    assertEquals(0, test.countTestCases());
    test.run(new TestResult());
    assertEquals("one+fullhack+startuparg", 3, test.countTestCases());
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:7,代碼來源:NbModuleSuite2Test.java


注:本文中的junit.framework.Test.run方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。