Package junit.framework

Examples of junit.framework.TestCase


  static public Test suite() {
    TestSuite s = new TestSuite("TimedTest");
    s.addTest(WGTests.suite());
    final long startTime[] = new long[1];
    s.addTest(new TestCase("start timer") {
      public void runTest() {
        startTime[0] = System.currentTimeMillis();
      }
    });
    WGTests.doLargeTests = true;
    s.addTest(WGTests.suite());
    s.addTest(new TestCase("end timer") {
      public void runTest() {
        System.err.println(
(        System.currentTimeMillis() - startTime[0])
+ " ms");
      }
View Full Code Here


      this.methods = new ArrayList(methods);
      this.methods.add("warning");

      for(Enumeration e = original.tests(); e.hasMoreElements();)
      {
         TestCase tc = (TestCase)e.nextElement();
         if (methods.contains(tc.getName()))
         {
            tests.add(tc);
         }
      }

      if (tests.isEmpty())
      {
         tests.add(new TestCase("warning")
         {
            protected void runTest()
            {
               fail("The SelectiveTestSuite did not select any test.");
            }
View Full Code Here

                        Attr att = (Attr) atts.item(j);
                        configParams.put(att.getName(), att.getValue());
                    }
                }
                if (n.getNodeName().equals("testcase")) {
                    TestCase tc = createTestCaseFromNode((Element) n);
                    addTest(tc);
                }
            }
        }
    }
View Full Code Here

  private static Method extractMethod(Test test) {
    if (test instanceof AbstractTester) {
      AbstractTester<?> tester = (AbstractTester<?>) test;
      return Platform.getMethod(tester.getClass(), tester.getTestMethodName());
    } else if (test instanceof TestCase) {
      TestCase testCase = (TestCase) test;
      return Platform.getMethod(testCase.getClass(), testCase.getName());
    } else {
      throw new IllegalArgumentException(
          "unable to extract method from test: not a TestCase.");
    }
  }
View Full Code Here

        
         // get the external tests
         Enumeration<TestCase> e = getTests();
         while(e.hasMoreElements())
         {
            TestCase t = e.nextElement();
            // run the external test
            result.runProtected(this, getProctectable(t));
         }

         // run the test case as usual
         super.run(result);

         //
         e = getTests();
         while(e.hasMoreElements())
         {
            TestCase t = e.nextElement();
            // run the external test again
            result.runProtected(this, getProctectable(t));
         }
      }
      catch(Exception e)
View Full Code Here

      while(testCases.hasMoreElements())
      {
         Test t = testCases.nextElement();
         if (t instanceof TestCase)
         {
            TestCase tc = (TestCase)t;
            if(!excludes.contains(tc.getName()))
               filtered.add(tc);
         }
      }
      return Collections.enumeration(filtered);
   }
View Full Code Here

}
   
    /** Bootstrap for the self-test code.
     */
    public static void main( String[] argc ) throws Exception {
        TestCase test = new TestJspTaglibs( "test-jsptaglibs.txt" );
        test.run();
    }
View Full Code Here

     */
    public static Test suite() {
        final TrackEnumerationTestSuite suite = new TrackEnumerationTestSuite();
        final RandomSelectionTest test = new RandomSelectionTest("Random",
                suite.copyDir);
        suite.addTest(new TestCase("Setup") {
            protected void runTest() throws Throwable {
                suite.initialize();
                test.dir = suite.copyDir;
            }
        });
        suite.addTest(test);
        suite.addTest(new OfFunctionTest(suite));
        suite.addTest(new SaveRunTest(suite));
        suite.addTest(new TestCase("Delete") {
            protected void runTest() throws Throwable {
                Assert.assertTrue("Delete copy "
                        + suite.copyDir.getAbsolutePath(), Utils
                        .deleteDirectory(suite.copyDir));
            }
View Full Code Here

        return fileNames;
    }

    private static TestCase createTestCase(HttpTestContainer container, HttpTestEntry entry) {
        final HttpTestRunner runner = new HttpTestRunner(container, entry);
        return new TestCase(entry.getName()) {
            protected void setUp() throws Exception {
                runner.setUp();
            }

            @Override
View Full Code Here

     *                    anything
     */
    public static Test suite() throws Throwable {
        final FileRenamerTestSuite suite = new FileRenamerTestSuite();
        final RenameFromTagTest renameFromTagTest = new RenameFromTagTest("testFileRenaming");
        suite.addTest(new TestCase("Setup") {
            protected void runTest() throws Throwable {
                suite.initialize();
                renameFromTagTest.taggedFile = suite.taggedFile;
            }
        });
        suite.addTest(renameFromTagTest);
        suite.addTest(new FileRenamerTest("testTransformations"));
        //suite.addTest(new OfFunctionTest(suite));
        //suite.addTest(new SaveRunTest(suite));
        suite.addTest(new TestCase("Delete") {
            protected void runTest() throws Throwable {
                Assert.assertTrue("Delete copy "
                        + suite.copyDir.getAbsolutePath(), Utils
                        .deleteDirectory(suite.copyDir));
            }
View Full Code Here

TOP

Related Classes of junit.framework.TestCase

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.