Package junit.framework

Examples of junit.framework.TestResult.wasSuccessful()


              return;
            }

            notifier.fireTestRunFinished(new Result());

            if (!result.wasSuccessful()) {
              Failure failure = null;
             
              if (result.failures().hasMoreElements()) {
                failure = new Failure(description, result.failures().nextElement().thrownException());
              }
View Full Code Here


  }
  public void testNoException() {
    TestResult result= new TestResult();
    junit.framework.Test adapter= new JUnit4TestAdapter(NoExceptionTest.class);
    adapter.run(result);
    assertFalse(result.wasSuccessful());
  }
 
  public static class ExpectedTest {
    @Test(expected= Exception.class) public void expected() throws Exception {
      throw new Exception();
View Full Code Here

  }
  public void testExpected() {
    TestResult result= new TestResult();
    junit.framework.Test adapter= new JUnit4TestAdapter(ExpectedTest.class);
    adapter.run(result);
    assertTrue(result.wasSuccessful());
  }
 
  public static class UnExpectedExceptionTest {
    @Test(expected= Exception.class) public void expected() throws Exception {
      throw new Error();
View Full Code Here

        TestResult result = t.run();
        if (result.errorCount() > 0) {
            TestFailure failure = (TestFailure) result.errors().nextElement();
            throw failure.thrownException();
        }
        assertEquals("failed", true, result.wasSuccessful());
    }

    /**
     * this testcase uses the file failure.py contained in the same directory as
     * this testcase
View Full Code Here

    public void testRunFailingTestCase() throws Exception {
        RuntimeStub runtime = new RuntimeStub();
        runtime.scriptsFail = true;
        MarathonTestCase t = new MarathonTestCase(new File("./failure.py"), runtime);
        TestResult result = t.run();
        assertEquals("test case should have failed", false, result.wasSuccessful());
        assertEquals("each failing testcase should have one failure, and no errors", 1, result.failureCount());
        assertEquals("each failing testcase should have one failure, and no errors", 0, result.errorCount());
    }
}
View Full Code Here

        setLogConfiguration(projectDir);
        RuntimeLogger.setRuntimeLogger(new NullLogger());
        TestRunner aTestRunner = new TestRunner();
        try {
            TestResult r = aTestRunner.runTests(argProcessor);
            if (!r.wasSuccessful())
                System.exit(junit.textui.TestRunner.FAILURE_EXIT);
            System.exit(junit.textui.TestRunner.SUCCESS_EXIT);
        } catch (Exception e) {
            System.err.println(e.getMessage());
            System.exit(junit.textui.TestRunner.EXCEPTION_EXIT);
View Full Code Here

                    Object value = entry.getValue();
                    System.out.println(key+" = "+value);
                }
                System.out.println("_________________________________________________");

                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

                    final Object value = entry.getValue();
                    System.out.println(key + " = " + value);
                }
                System.out.println("_________________________________________________");

                if (!r.wasSuccessful())
                    System.exit(FAILURE_EXIT);
                System.exit(SUCCESS_EXIT);
            } catch (final Exception e) {
                System.err.println(e.getMessage());
                System.exit(EXCEPTION_EXIT);
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

            } 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

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.