Package junit.framework

Examples of junit.framework.TestFailure


    public void testRunSuccessfulTestCase() throws Throwable {
        RuntimeStub runtime = new RuntimeStub();
        MarathonTestCase t = new MarathonTestCase(new File("./success.py"), runtime);
        TestResult result = t.run();
        if (result.errorCount() > 0) {
            TestFailure failure = (TestFailure) result.errors().nextElement();
            throw failure.thrownException();
        }
        assertEquals("failed", true, result.wasSuccessful());
    }
View Full Code Here


    public void addTestOpenListener(ITestListener l) {
        testOpenListeners.add(ITestListener.class, l);
    }

    private void appendFailure(Test test, Throwable t) {
        failures.addElement(new TestFailure(test, t));
    }
View Full Code Here

    private void showFailureDetail(Test test) {
        if (test != null) {
            ListModel failures = getFailures();
            for (int i = 0; i < failures.getSize(); i++) {
                TestFailure failure = (TestFailure) failures.getElementAt(i);
                if (failure.failedTest() == test) {
                    failureView.showFailure(failure);
                    return;
                }
            }
        }
View Full Code Here

    public Test getSelectedTest() {
        int index = failureList.getSelectedIndex();
        if (index == -1)
            return null;
        ListModel model = failureList.getModel();
        TestFailure failure = (TestFailure) model.getElementAt(index);
        return failure.failedTest();
    }
View Full Code Here

        }

        public Component getListCellRendererComponent(JList list, Object value, int modelIndex, boolean isSelected,
                boolean cellHasFocus) {
            Component c = super.getListCellRendererComponent(list, value, modelIndex, isSelected, cellHasFocus);
            TestFailure failure = (TestFailure) value;
            String text = failure.failedTest().toString();
            String msg = failure.exceptionMessage();
            if (msg != null)
                text += ":" + BaseTestRunner.truncate(msg);
            if (failure.isFailure()) {
                if (failureIcon != null)
                    setIcon(failureIcon);
            } else {
                if (errorIcon != null)
                    setIcon(errorIcon);
View Full Code Here

                           " : Failures = "+result.failureCount()) ;
       
        for ( Enumeration<?> e = result.errors() ; e.hasMoreElements() ; )
        {
            out.println() ;
            TestFailure failure = (TestFailure)e.nextElement() ;
            out.println("Error:    "+failure.toString()) ;
        }
        for ( Enumeration<?> e = result.failures() ; e.hasMoreElements() ; )
        {
            out.println() ;
            TestFailure failure = (TestFailure)e.nextElement() ;
            out.println("Failure:  "+failure.toString()) ;
        }
    }
View Full Code Here

        ListIterator it = tr.listIterator();
        while (it.hasNext()) {
            TestResult result = (TestResult) it.next();
            if (result.failureCount() != 0) {
                TestFailure fail = (TestFailure) result.failures().nextElement();
                out.println(fail.trace());
                return;
            }
        }

    }
View Full Code Here

                writer().println("There were " + result.failureCount() + " failures:");
           
            int i = 1;
            writer().println("\nFailure Summary:");
            for (Enumeration e= result.failures(); e.hasMoreElements(); i++) {
                TestFailure failure= (TestFailure) e.nextElement();
                writer().println(i + ") " + failure.failedTest());
            }
            i = 1;
            writer().println("\nFailure Details:");
            for (Enumeration e= result.failures(); e.hasMoreElements(); i++) {
                TestFailure failure= (TestFailure) e.nextElement();
                writer().println("\n"+ i + ") " + failure.failedTest());
                Throwable t= failure.thrownException();
                if (t.getMessage() != null)
                    writer().println("\t\"" + t.getMessage() + "\"");
                else {
                    writer().println();
                    failure.thrownException().printStackTrace();
                }
            }
        }
    }
View Full Code Here

                writer().println("There were "+result.errorCount()+" errors:");
   
            writer().println("\nError Summary:");
            int i = 1;
            for (Enumeration e= result.errors(); e.hasMoreElements(); i++) {
                TestFailure failure= (TestFailure) e.nextElement();
                writer().println(i + ") " + failure.failedTest());
            }
            writer().println("\nError Details:");
            i = 1;
            for (Enumeration e= result.errors(); e.hasMoreElements(); i++) {
                TestFailure failure= (TestFailure)e.nextElement();
                writer().println(i+") "+failure.failedTest());
                String trace = getRelevantStackTrace(failure.thrownException());
                writer().println(trace);
            }
        }
    }
View Full Code Here

      else
        writer().println("There were " + result.errorCount() + " errors:");

      int i = 1;
      for (Enumeration e = result.errors(); e.hasMoreElements(); i++) {
        TestFailure failure = (TestFailure) e.nextElement();
        writer().println(i + ") " + failure.failedTest());
        writer().print(getFilteredTrace(failure.thrownException()));
      }
    }
  }
View Full Code Here

TOP

Related Classes of junit.framework.TestFailure

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.