当前位置: 首页>>代码示例>>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;未经允许,请勿转载。