Package junit.framework

Examples of junit.framework.TestCase


      testClass.getTestMethodList().add(this);
    }
   
    private void init(Test test) {
      if(TestCase.class.isAssignableFrom(test.getClass())) {
        TestCase tc= (TestCase) test;

        m_methodName= tc.getName();
        m_signature= m_methodClass.getName() + "." + m_methodName + "()";
        try {
          m_method= test.getClass().getMethod(tc.getName(), new Class[0]);
        }
        catch(Exception ex) {
          throw new TestNGException("cannot retrieve JUnit method", ex);
        }
      }
View Full Code Here


        return makeDescription(getTest());
    }

    private static Description makeDescription(Test test) {
        if (test instanceof TestCase) {
            TestCase tc = (TestCase) test;
            return Description.createTestDescription(tc.getClass(), tc.getName(),
                    getAnnotations(tc));
        } else if (test instanceof TestSuite) {
            TestSuite ts = (TestSuite) test;
            String name = ts.getName() == null ? createSuiteDescription(ts) : ts.getName();
            Description description = Description.createSuiteDescription(name);
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")
         {
            @Override
            protected void runTest()
            {
               Assert.fail("The SelectiveTestSuite did not select any test.");
View Full Code Here

    return makeDescription(fTest);
  }

  private Description makeDescription(Test test) {
    if (test instanceof TestCase) {
      TestCase tc= (TestCase) test;
      return Description.createTestDescription(tc.getClass(), tc.getName());
    } else if (test instanceof TestSuite) {
      TestSuite ts= (TestSuite) test;
      Description description= Description.createSuiteDescription(ts.getName());
      int n= ts.testCount();
      for (int i= 0; i < n; i++)
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

}
   
    /** 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

            //  TestItem.create assumes it is a a URI or string.
            // Clean up.
            item = TestItem.create(entry, defaultTestType, querySyntax, DataFormat.langXML) ;
        }
       
        TestCase test = null ;

        // Frankly this all needs rewriting.
        // Drop the idea of testItem.  pass entry/action/result to subclass.
        // Library for parsing entries.
       
View Full Code Here

     * @param args the command line arguments
     */
    public static void main(String[] args) throws Exception {

        TestResult            result;
        TestCase              test;
        java.util.Enumeration failures;
        int                   count;

        result = new TestResult();
        test   = new TestJDBCSavepoints("testJDBCSavepoints");

        test.run(result);

        count = result.failureCount();

        System.out.println("TestJDBCSavepoints failure count: " + count);

View Full Code Here

    }

    public static void main(String[] argv) {

        TestResult result = new TestResult();
        TestCase   testA  = new TestSql("testMetaData");
        TestCase   testB  = new TestSql("testDoubleNaN");
        TestCase   testC  = new TestSql("testAny");

        testA.run(result);
        testB.run(result);
        testC.run(result);
        System.out.println("TestSql error count: " + result.failureCount());
    }
View Full Code Here

        }
        s.close();
    }

    private static Throwable runTestCaseTest(String testClass, String method, int port) throws Exception {
        TestCase test = (TestCase)Class.forName(testClass).newInstance();
        test.setName(method);
        TestResult result = new TestResult();
        test.run(result);
        if (result.failureCount() != 0) {
            Enumeration e = result.failures();
            return ((TestFailure)e.nextElement()).thrownException();
        }
        else if (result.errorCount() != 0) {
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.