Package junit.framework

Examples of junit.framework.TestResult


        super(name);
    }

    @Override
    protected void setUp() {
        fResult = new TestResult();
    }
View Full Code Here


        fEndCount++;
    }

    @Override
    protected void setUp() {
        fResult = new TestResult();
        fResult.addListener(this);

        fStartCount = 0;
        fEndCount = 0;
        fFailureCount = 0;
View Full Code Here

            }
            System.out.println("\nResults :");
            if (m_failures.size() > 0) {
                System.out.println("\nFailed tests:");
                for (int i = 0; i < m_failures.size(); i++) {
                    TestResult tr = (TestResult) m_failures.get(i);
                    Enumeration e = tr.failures();
                    while (e.hasMoreElements()) {
                        TestFailure tf = (TestFailure) e.nextElement();
                        System.out.println(" " + tf.toString());
                    }
                }
            }

            if (m_failures.size() > 0) {
                System.out.println("\nTests in error:");
                for (int i = 0; i < m_errors.size(); i++) {
                    TestResult tr = (TestResult) m_errors.get(i);
                    Enumeration e = tr.errors();
                    while (e.hasMoreElements()) {
                        TestFailure tf = (TestFailure) e.nextElement();
                        System.out.println(" " + tf.toString());
                    }
                }
View Full Code Here

        try {
            XMLReport report = new XMLReport();
            String name = getTestName(test);
            System.out.println("Running " + name);

            TestResult tr = new TestResult();
            tr.addListener(new ResultListener(report));
            test.run(tr);
            m_results.add(tr);

            if (tr.wasSuccessful()) {
                System.out.println("Tests run: "
                        + tr.runCount()
                        + ", Failures: "
                        + tr.failureCount()
                        + ", Errors: "
                        + tr.errorCount()
                        + ", Time elapsed: "
                        + report.elapsedTimeAsString(report.m_endTime
                                - report.m_endTime) + " sec");
            } else {
                System.out.println("Tests run: "
                        + tr.runCount()
                        + ", Failures: "
                        + tr.failureCount()
                        + ", Errors: "
                        + tr.errorCount()
                        + ", Time elapsed: "
                        + report.elapsedTimeAsString(report.m_endTime
                                - report.m_endTime) + " sec <<< FAILURE!");
                if (tr.errorCount() > 0) {
                    m_errors.add(tr);
                }
                if (tr.failureCount() > 0) {
                    m_failures.add(tr);
                }
            }

            m_total += tr.runCount();
            m_totalFailures += tr.failureCount();
            m_totalErrors += tr.errorCount();

            report.generateReport(test, tr, m_reportsDirectory, bc, felixConf);

        } catch (Exception e) {
            getLog().error(e);
View Full Code Here

    public Object run() throws Exception {
        Method testSuiteMethod = testClass.getMethod("suite", (java.lang.Class[]) null);
       
        TestSuite suite = (TestSuite) testSuiteMethod.invoke(testClass, (java.lang.Object[])null);
       
        TestResult result = new TestResult();
       
       
        suite.run(result);
       
        if (result.wasSuccessful()) {
           
            logger.info("Success");
        } else {
            logger.severe("Failed");
           
            Enumeration errorEnum = result.errors();
            TestFailure failure = null;
            while (errorEnum.hasMoreElements()) {
                failure = (TestFailure) errorEnum.nextElement();
                logger.severe("Test " + failure.failedTest().toString() + " failed --------");
                Throwable th = failure.thrownException();
                th.printStackTrace(System.err);
            }
            errorEnum = result.failures();
            failure = null;
            while (errorEnum.hasMoreElements()) {
                failure = (TestFailure) errorEnum.nextElement();
                logger.severe("Test " + failure.failedTest().toString() + " failed --------");
                Throwable th = failure.thrownException();
View Full Code Here

  public SuiteTest(String name) {
    super(name);
  }
  @Override
  protected void setUp() {
    fResult= new TestResult();
  }
View Full Code Here

  public void endTest(Test test) {
    fEndCount++;
  }
  @Override
  protected void setUp() {
    fResult= new TestResult();
    fResult.addListener(this);
 
    fStartCount= 0;
    fEndCount= 0;
    fFailureCount= 0;
View Full Code Here

        public void write(int arg0) throws IOException {
        }
      }
    ));
    try {
      TestResult result= junit.textui.TestRunner.run(new TestSuite());
      assertTrue(result.wasSuccessful());
    } finally {
      System.setOut(oldOut);
    }
  }
View Full Code Here

    assertEquals(1, fAdapter.getTests().size());
  }
 
  @Test
  public void initializationErrorsAreThrownAtRuntime() {
    TestResult result= new TestResult();
    fAdapter.run(result);
    assertEquals(1, result.errorCount());
    assertEquals(CantInitialize.UNIQUE_ERROR_MESSAGE, result.errors()
        .nextElement().exceptionMessage());
  }
View Full Code Here

  }
 
  @Test
  public void generatedErrorTestsMatchUp() {
    junit.framework.Test shouldFail= fAdapter.getTests().get(0);
    TestResult result= new TestResult();
    ErrorRememberingListener listener= new ErrorRememberingListener();
    result.addListener(listener);
    fAdapter.run(result);
    assertNotNull(listener.getError());
    assertTrue(shouldFail == listener.getError());
  }
View Full Code Here

TOP

Related Classes of junit.framework.TestResult

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.