Package junit.framework

Examples of junit.framework.TestResult.wasSuccessful()


 
  public static void main(String args[]) {
    TestRunner aTestRunner= new TestRunner();
    try {
      TestResult r= aTestRunner.start(args);
      if (!r.wasSuccessful())
        System.exit(FAILURE_EXIT);
      System.exit(SUCCESS_EXIT);
    } catch(Exception e) {
      System.err.println(e.getMessage());
      System.exit(EXCEPTION_EXIT);
View Full Code Here


        // } catch (java.lang.InternalError e1){
        // System.out.println("Error with class "+n+" "+e1);
        // }
        //System.out.println("------------");
        // --
        System.exit(result.wasSuccessful() ? 0 : 1); // this is needed because the test may start the AWT EventQueue thread which is not a daemon.
    }

    /**
     * An overridable method that initializes the logging for the unit test run,
     * using the properties file passed in as the second argument.
View Full Code Here

              return;
            }

            notifier.fireTestRunFinished(new Result());

            if (!result.wasSuccessful()) {
              notifier.fireTestFailure(new Failure(description, null));
            }
            else {
              notifier.fireTestFinished(description);
            }
View Full Code Here

        // suiteSetup/SuiteTearDown
        AntUnitTestCase antUnitTestCase = new AntUnitTestCase(test1Name);

        TestResult testResult = new TestResult();
        antUnitTestCase.run(testResult);
        assertTrue(testResult.wasSuccessful());

        String output = FileUtils.readFully(new FileReader(outFile));
        assertEquals("suiteSetUp-setUp-test1-tearDown-suiteTearDown", output);
    }
View Full Code Here

    public void testRunSuiteSetUp() throws FileNotFoundException, IOException {

        TestResult testResult = new TestResult();
        suite.run(testResult);
        assertTrue(testResult.wasSuccessful());

        String output = FileUtils.readFully(new FileReader(outFile));
        String EXPECT1 = "suiteSetUp-setUp-test1-tearDown-setUp-test2-tearDown-suiteTearDown";
        String EXPECT2 = "suiteSetUp-setUp-test2-tearDown-setUp-test1-tearDown-suiteTearDown";
        assertTrue("unexted output : " + output, EXPECT1.equals(output)
View Full Code Here

        if (test1.getTarget().equals("test2")) {
            test1 = (AntUnitTestCase) suite.testAt(1);
        }
        TestResult testResult = new TestResult();
        suite.runTest(test1, testResult);
        assertTrue(testResult.wasSuccessful());

        String output = FileUtils.readFully(new FileReader(outFile));
        assertTrue("unexted output : " + output,
                "suiteSetUp-setUp-test1-tearDown-suiteTearDown".equals(output));
    }
View Full Code Here

        // } catch (java.lang.InternalError e1){
        // System.out.println("Error with class "+n+" "+e1);
        // }
        //System.out.println("------------");
        // --
        System.exit(result.wasSuccessful() ? 0 : 1); // this is needed because the test may start the AWT EventQueue thread which is not a daemon.
    }

    /**
     * An overridable method that initializes the logging for the unit test run,
     * using the properties file passed in as the second argument.
View Full Code Here

            } catch (IllegalAccessException e) {
                tr.addError(theClazz, e);
            } catch (IllegalArgumentException e) {
                tr.addError(theClazz, e);
            }
            if ( !tr.wasSuccessful() ){
                sresult.setSuccessful(false);
                StringBuilder buf = new StringBuilder();
                StringBuilder buftrace = new StringBuilder();
                Enumeration<TestFailure> en;
                if (getAppendError()) {
View Full Code Here

                sresult.setResponseCode(getErrorCode());
                sresult.setResponseMessage(getError());
                sresult.setResponseData(e.getMessage().getBytes());
                sresult.setSuccessful(false);
            }
            if ( !tr.wasSuccessful() ){
                sresult.setSuccessful(false);
                StringBuffer buf = new StringBuffer();
                buf.append( getFailure() );
                Enumeration en = tr.errors();
                while (en.hasMoreElements()){
View Full Code Here

            }
            System.out.println("Running all tests in '" + jarFile + "'");
            TestSuite suite = (TestSuite) suite();
            System.out.println("Found '" + suite.testCount() + "' test classes in jar file.");
            TestResult res = junit.textui.TestRunner.run(suite);
            System.exit(res.wasSuccessful() ? 0 : 1);
        } else {
            usage();
        }
    }
}
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.