public boolean isSuccessful() { return !hasFailure() && !hasError() && !hasSkipped(); }
public List<ReportTestCase> getFailureDetails( List<ReportTestSuite> testSuites ) { List<ReportTestCase> failureDetails = new ArrayList<ReportTestCase>(); for ( ReportTestSuite suite : testSuites ) { for ( ReportTestCase tCase : suite.getTestCases() ) { if ( !tCase.isSuccessful() ) { failureDetails.add( tCase ); } } } return failureDetails; }
String type = tCase.getFailureType(); sinkCellAnchor( sink, tCase.getName(), toHtmlId( tCase.getFullName() ) ); String message = tCase.getFailureMessage(); String detail = tCase.getFailureDetail(); if ( detail != null ) atts.addAttribute( ID, tCase.getName() + toHtmlIdFailure( tCase ) ); sink.unknown( "div", TAG_TYPE_START, atts ); String fullClassName = tCase.getFullClassName(); String errorLineNumber = tCase.getFailureErrorLine(); if ( xrefLocation != null )
if ( testCase.getFailureType() != null ) sink.link( "#" + toHtmlId( testCase.getFullName() ) ); sinkIcon( testCase.getFailureType(), sink ); if ( !testCase.isSuccessful() ) sinkAnchor( sink, "TC_" + toHtmlId( testCase.getFullName() ) ); sinkLink( sink, testCase.getName(), "#" + toHtmlId( testCase.getFullName() ) ); sinkLink( sink, "javascript:toggleDisplay('" + toHtmlId( testCase.getFullName() ) + "');" ); atts.addAttribute( ID, toHtmlId( testCase.getFullName() ) + "-off" ); sink.unknown( "span", TAG_TYPE_START, atts ); sink.text( " + " ); atts.addAttribute( ID, toHtmlId( testCase.getFullName() ) + "-on" ); sink.unknown( "span", TAG_TYPE_START, atts ); sink.text( " - " ); sinkCellAnchor( sink, testCase.getName(), "TC_" + toHtmlId( testCase.getFullName() ) ); sinkCell( sink, numberFormat.format( testCase.getTime() ) ); if ( !testCase.isSuccessful() ) sinkCell( sink, testCase.getFailureMessage() );
testCase = new ReportTestCase() .setName( attributes.getValue( "name" ) ); final Number time = StringUtils.isBlank( timeAsString ) ? 0 : numberFormat.parse( timeAsString ); testCase.setFullClassName( currentSuite.getFullClassName() ) .setClassName( currentSuite.getName() ) .setFullName( currentSuite.getFullClassName() + "." + testCase.getName() ) .setTime( time.floatValue() ); currentSuite.setTimeElapsed( testCase.getTime() + currentSuite.getTimeElapsed() ); testCase.setFailure( attributes.getValue( "message" ), attributes.getValue( "type" ) ); currentSuite.incrementNumberOfFailures(); testCase.setError( attributes.getValue( "message" ), attributes.getValue( "type" ) ); currentSuite.incrementNumberOfErrors(); testCase.setSkipped( message != null ? message : "skipped" ); currentSuite.incrementNumberOfSkipped();
if (testCase.hasFailure() || testCase.hasError()) { String failureType = testCase.getFailureType(); FailureType typeTof = new FailureType(failureType, testCase.getFailureMessage(), testCase.hasError()); FailureLocation failureLocation = null; if (location.getClassName().equals(testCase.getFullClassName())) { failureLocation = location; break; failureLocation = new FailureLocation(testCase.getFullClassName()); this.failureLocations.add(failureLocation); if (testCase.hasError()) { failureLocation.addErroringMethod(testCase.getName()); } else { failureLocation.addFailingMethod(testCase.getName()); failureDetail.setTestMethod(testCase.getName()); failureDetail.setFailureName(typeTof.getFailureName()); failureDetail.setDetail(typeTof.getFailureDetail());
for (int j = 0; j < testCases.size(); j++) { ReportTestCase reportTestCase = testCases.get(j); if (reportTestCase.hasFailure() && reportTestCase.getFailureDetail() != null) { try { StackTrace stackTrace = StackTraceParser.parse(reportTestCase.getFailureDetail()); StackTrace causedBy = stackTrace.getCausedBy(); while (causedBy != null) { output.add(new Pair<>(reportTestCase.getFullClassName() + "#" + reportTestCase.getName(), files));
/** * {@inheritDoc} */ @Override public void endElement( String uri, String localName, String qName ) throws SAXException { // todo: use jdk7 switch-case if ( "testcase".equals( qName ) ) { currentSuite.getTestCases().add( testCase ); } else if ( "failure".equals( qName ) || "error".equals( qName ) ) { testCase.setFailureDetail( currentElement.toString() ) .setFailureErrorLine( parseErrorLine( currentElement, testCase.getFullClassName() ) ); } else if ( "time".equals( qName ) ) { try { defaultSuite.setTimeElapsed( numberFormat.parse( currentElement.toString() ).floatValue() ); } catch ( ParseException e ) { throw new SAXException( e.getMessage(), e ); } } // TODO extract real skipped reasons }
private static String toHtmlIdFailure( ReportTestCase tCase ) { return tCase.hasError() ? "-error" : "-failure"; }
if (suite.getNumberOfErrors() > 0 || suite.getNumberOfFailures() > 0) { for (ReportTestCase tc : suite.getTestCases()) { if (tc.getFailure() != null && !"skipped".equalsIgnoreCase((String) tc.getFailure().get("message"))) { message .append("<li><em>") .append(tc.getFullName()) .append("</em> failed: ") .append(tc.getFailure().get("message")) .append("</li>");
String type = tCase.getFailureType(); sinkCellAnchor( sink, tCase.getName(), toHtmlId( tCase.getFullName() ) ); String message = tCase.getFailureMessage(); String detail = tCase.getFailureDetail(); if ( detail != null ) atts.addAttribute( ID, tCase.getName() + toHtmlIdFailure( tCase ) ); sink.unknown( "div", TAG_TYPE_START, atts ); String fullClassName = tCase.getFullClassName(); String errorLineNumber = tCase.getFailureErrorLine(); if ( xrefLocation != null )
if ( testCase.getFailureType() != null ) sink.link( "#" + toHtmlId( testCase.getFullName() ) ); sinkIcon( testCase.getFailureType(), sink ); if ( !testCase.isSuccessful() ) sinkAnchor( sink, "TC_" + toHtmlId( testCase.getFullName() ) ); sinkLink( sink, testCase.getName(), "#" + toHtmlId( testCase.getFullName() ) ); sinkLink( sink, "javascript:toggleDisplay('" + toHtmlId( testCase.getFullName() ) + "');" ); atts.addAttribute( ID, toHtmlId( testCase.getFullName() ) + "-off" ); sink.unknown( "span", TAG_TYPE_START, atts ); sink.text( " + " ); atts.addAttribute( ID, toHtmlId( testCase.getFullName() ) + "-on" ); sink.unknown( "span", TAG_TYPE_START, atts ); sink.text( " - " ); sinkCellAnchor( sink, testCase.getName(), "TC_" + toHtmlId( testCase.getFullName() ) ); sinkCell( sink, numberFormat.format( testCase.getTime() ) ); if ( !testCase.isSuccessful() ) sinkCell( sink, testCase.getFailureMessage() );
currentElement = new StringBuilder(); testCase = new ReportTestCase() .setName( attributes.getValue( "name" ) ); Number time = StringUtils.isBlank( timeAsString ) ? 0 : numberFormat.parse( timeAsString ); testCase.setFullClassName( currentSuite.getFullClassName() ) .setClassName( currentSuite.getName() ) .setFullName( currentSuite.getFullClassName() + "." + testCase.getName() ) .setTime( time.floatValue() ); currentSuite.setTimeElapsed( testCase.getTime() + currentSuite.getTimeElapsed() ); testCase.setFailure( attributes.getValue( "message" ), attributes.getValue( "type" ) ); currentSuite.incrementNumberOfFailures(); break; case "error": testCase.setError( attributes.getValue( "message" ), attributes.getValue( "type" ) ); currentSuite.incrementNumberOfErrors(); break; case "skipped": String message = attributes.getValue( "message" ); testCase.setSkipped( message != null ? message : "skipped" ); currentSuite.incrementNumberOfSkipped(); break;
case "failure": case "error": testCase.setFailureDetail( currentElement.toString() ) .setFailureErrorLine( parseErrorLine( currentElement, testCase.getFullClassName() ) ); break; case "time":
private static String toHtmlIdFailure( ReportTestCase tCase ) { return tCase.hasError() ? "-error" : "-failure"; }
public boolean isSuccessful() { return !hasFailure() && !hasError() && !hasSkipped(); }
public List<ReportTestCase> getFailureDetails( List<ReportTestSuite> testSuites ) { List<ReportTestCase> failureDetails = new ArrayList<>(); for ( ReportTestSuite suite : testSuites ) { for ( ReportTestCase tCase : suite.getTestCases() ) { if ( !tCase.isSuccessful() ) { failureDetails.add( tCase ); } } } return failureDetails; }
if ( !testCase.isSuccessful() || showSuccess ) if ( !testCase.isSuccessful() || showSuccess )
if ( !testCase.isSuccessful() || showSuccess ) if ( !testCase.isSuccessful() || showSuccess )