本文整理汇总了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[:;].*"));
}
示例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"));
}
示例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();
}
示例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]);
}
示例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 );
}
}
示例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());
}