1 package junit.tests.extensions; 2 3 import junit.framework.*; 4 import junit.extensions.*; 5 6 9 10 public class ActiveTestTest extends TestCase { 11 12 public static class SuccessTest extends TestCase { 13 public void runTest() { 14 } 15 } 16 17 public void testActiveTest() { 18 Test test= createActiveTestSuite(); 19 TestResult result= new TestResult(); 20 test.run(result); 21 assertEquals(100, result.runCount()); 22 assertEquals(0, result.failureCount()); 23 assertEquals(0, result.errorCount()); 24 } 25 26 public void testActiveRepeatedTest() { 27 Test test= new RepeatedTest(createActiveTestSuite(), 5); 28 TestResult result= new TestResult(); 29 test.run(result); 30 assertEquals(500, result.runCount()); 31 assertEquals(0, result.failureCount()); 32 assertEquals(0, result.errorCount()); 33 } 34 35 public void testActiveRepeatedTest0() { 36 Test test= new RepeatedTest(createActiveTestSuite(), 0); 37 TestResult result= new TestResult(); 38 test.run(result); 39 assertEquals(0, result.runCount()); 40 assertEquals(0, result.failureCount()); 41 assertEquals(0, result.errorCount()); 42 } 43 44 public void testActiveRepeatedTest1() { 45 Test test= new RepeatedTest(createActiveTestSuite(), 1); 46 TestResult result= new TestResult(); 47 test.run(result); 48 assertEquals(100, result.runCount()); 49 assertEquals(0, result.failureCount()); 50 assertEquals(0, result.errorCount()); 51 } 52 53 ActiveTestSuite createActiveTestSuite() { 54 ActiveTestSuite suite= new ActiveTestSuite(); 55 for (int i= 0; i < 100; i++) 56 suite.addTest(new SuccessTest()); 57 return suite; 58 } 59 60 } | Popular Tags |