Package junit.framework

Examples of junit.framework.TestFailure


        writer().println("There was " + result.failureCount() + " failure:");
      else
        writer().println("There were " + result.failureCount() + " failures:");
      int i = 1;
      for (Enumeration e = result.failures(); e.hasMoreElements(); i++) {
        TestFailure failure = (TestFailure) e.nextElement();
        writer().print(i + ") " + failure.failedTest());
        writer().print(getFilteredTrace(failure.thrownException()));
      }
    }
  }
View Full Code Here


                writer().println("There were " + result.failureCount() + " failures:");

            int i = 1;
            writer().println("\nFailure Summary:");
            for (final Enumeration e = result.failures(); e.hasMoreElements(); i++) {
                final TestFailure failure = (TestFailure) e.nextElement();
                writer().println(i + ") " + failure.failedTest());
            }
            i = 1;
            writer().println("\nFailure Details:");
            for (final Enumeration e = result.failures(); e.hasMoreElements(); i++) {
                final TestFailure failure = (TestFailure) e.nextElement();
                writer().println("\n" + i + ") " + failure.failedTest());
                final 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 (final Enumeration e = result.errors(); e.hasMoreElements(); i++) {
                final TestFailure failure = (TestFailure) e.nextElement();
                writer().println(i + ") " + failure.failedTest());
            }
            writer().println("\nError Details:");
            i = 1;
            for (final Enumeration e = result.errors(); e.hasMoreElements(); i++) {
                final TestFailure failure = (TestFailure) e.nextElement();
                writer().println(i + ") " + failure.failedTest());
                final String trace = getRelevantStackTrace(failure.thrownException());
                writer().println(trace);
            }
        }
    }
View Full Code Here

                        sresult.setResponseCode(getFailureCode());
                        buf.append( getFailure() );
                        buf.append("\n");
                    }
                    while (en.hasMoreElements()){
                        TestFailure item = en.nextElement();
                        buf.append( "Failure -- ");
                        buf.append( item.toString() );
                        buf.append("\n");
                        buftrace.append( "Failure -- ");
                        buftrace.append( item.toString() );
                        buftrace.append("\n");
                        buftrace.append( "Trace -- ");
                        buftrace.append( item.trace() );
                    }
                    en = tr.errors();
                    if (en.hasMoreElements()){
                        sresult.setResponseCode(getErrorCode());
                        buf.append( getError() );
                        buf.append("\n");
                    }
                    while (en.hasMoreElements()){
                        TestFailure item = en.nextElement();
                        buf.append( "Error -- ");
                        buf.append( item.toString() );
                        buf.append("\n");
                        buftrace.append( "Error -- ");
                        buftrace.append( item.toString() );
                        buftrace.append("\n");
                        buftrace.append( "Trace -- ");
                        buftrace.append( item.trace() );
                    }
                }
                sresult.setResponseMessage(buf.toString());
                sresult.setResponseData(buftrace.toString(), null);
            }
View Full Code Here

       
        if(failureCount > 0){
            List<TestExceptionResult> l = new ArrayList<TestExceptionResult>();
            Enumeration<TestFailure> failures = result.failures();
            while(failures.hasMoreElements()){
                TestFailure failure = failures.nextElement();

                TestExceptionResultBean t = new TestExceptionResultBean();
                t.setExceptionMessage(failure.exceptionMessage());
                t.setLineNumber(getLineNumber(failure.trace()));
                l.add(t);
            }
            resultBean.setFailures(l);
        }
       
        if(errorCount > 0){
            List<TestExceptionResult> l = new ArrayList<TestExceptionResult>();
            Enumeration<TestFailure> errors = result.errors();
            while(errors.hasMoreElements()){
                TestFailure error = errors.nextElement();
               
                TestExceptionResultBean t = new TestExceptionResultBean();
                t.setExceptionMessage(error.exceptionMessage());
                t.setLineNumber(getLineNumber(error.trace()));
                l.add(t);
            }
            resultBean.setErrors(l);
        }
View Full Code Here

   
    TestResult result=new TestResult();
    testsuite.run(result);
    Enumeration enm=result.errors();
    while(enm.hasMoreElements()){
      TestFailure ob=(TestFailure)enm.nextElement();
      System.out.println("Failed Test : "+ob.failedTest().toString()+" "+ob.trace());
      logger.severe("Failed Test : "+ob.failedTest().toString()+" "+ob.trace());
    }
    Enumeration enm1=result.failures();
    while(enm1.hasMoreElements()){
      TestFailure ob=(TestFailure)enm1.nextElement();
      System.out.println("Failed Test : "+ob.failedTest().toString()+" "+ob.trace());
      logger.severe("Failed Test : "+ob.failedTest().toString()+" "+ob.trace());
    }
   
    System.out.println("result errorCount "+result.errorCount()+ " result failureCount "+ result.failureCount()+ " result status "+result.wasSuccessful()+ result.errors()
        );
  }
View Full Code Here

        private void displayProblems( PrintWriter writer, String kind, int count, Enumeration enumeration ) {
            if (count != 0) {
                displayProblemTitle( writer, getFormatted( count, kind ) );
                Enumeration e = enumeration;
                for (int i = 1; e.hasMoreElements(); i++) {
                    TestFailure failure = (TestFailure) e.nextElement();
                    displayProblemDetailHeader( writer, i, failure.failedTest().toString() );
                    if (failure.thrownException() instanceof AssertionFailedError) {
                        displayProblemDetail( writer, failure.thrownException().getMessage() );
                    } else {
                        displayProblemDetail( writer, BaseTestRunner.getFilteredTrace( failure.thrownException() ) );
                    }
                    displayProblemDetailFooter( writer );
                }
            }
        }
View Full Code Here

        }


        private void displayResults( PrintWriter writer, String failureNodeName, Enumeration resultsEnumeration ) {
            for (Enumeration e = resultsEnumeration; e.hasMoreElements();) {
                TestFailure failure = (TestFailure) e.nextElement();
                writer.println( "  <testcase name=" + asAttribute( failure.failedTest().toString() ) + ">" );
                writer.print( "    <" + failureNodeName + " type=" + asAttribute( failure.thrownException().getClass().getName() ) +
                                                      " message=" + asAttribute( failure.exceptionMessage() ) );
                if (!displayException( failure )) {
                    writer.println( "/>" );
                } else {
                    writer.println( ">" );
                    writer.print( sgmlEscape( BaseTestRunner.getFilteredTrace( failure.thrownException() ) ) );
                    writer.println( "    </" + failureNodeName + ">" );
                }
                writer.println( "  </testcase>" );
            }
        }
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

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.