public void finalizeReporter ( int testStatus ) { // reopen the file try ( FileWriter fw = new FileWriter ( file , true ) ; BufferedWriter out = new BufferedWriter ( fw ) ) { out . write ( " </table>\n" ) ; out . write ( " </body>\n" ) ; out . write ( "</html>\n" ) ; } catch ( IOException e ) { log . error ( e ) ; } // Record the metrics if ( ( fails + passes + checks ) != stepNum ) { log . error ( "There was some error recording your test steps. Step results don't equal steps performed" ) ; } replaceInFile ( "STEPSPERFORMED" , Integer . toString ( fails + passes + checks ) ) ; replaceInFile ( "STEPSPASSED" , Integer . toString ( passes ) ) ; replaceInFile ( "STEPSFAILED" , Integer . toString ( fails ) ) ; if ( fails == 0 && checks == 0 && testStatus == 0 ) { replaceInFile ( PASSORFAIL , "<font size='+2' class='pass'><b>PASS</b></font>" ) ; } else if ( fails == 0 ) { replaceInFile ( PASSORFAIL , "<font size='+2' class='check'><b>CHECK</b" + "></font>" ) ; } else { replaceInFile ( PASSORFAIL , "<font size='+2' class='fail'><b>FAIL</b></font>" ) ; } addTimeToReport ( ) ; if ( Property . packageResults ( ) ) { packageTestResults ( ) ; } if ( Property . generatePDF ( ) ) { generatePdf ( ) ; } }
Ends and closes the output test file . The HTML is properly ended and the file is analyzed to determine if the test passed or failed and that information is updated along with the overall timing of the test