private void createResults ( List < ISuite > suites , File outputDirectory , boolean onlyShowFailures ) throws Exception { int index = 1 ; for ( ISuite suite : suites ) { int index2 = 1 ; for ( ISuiteResult result : suite . getResults ( ) . values ( ) ) { boolean failuresExist = result . getTestContext ( ) . getFailedTests ( ) . size ( ) > 0 || result . getTestContext ( ) . getFailedConfigurations ( ) . size ( ) > 0 ; if ( ! onlyShowFailures || failuresExist ) { VelocityContext context = createContext ( ) ; context . put ( RESULT_KEY , result ) ; context . put ( FAILED_CONFIG_KEY , sortByTestClass ( result . getTestContext ( ) . getFailedConfigurations ( ) ) ) ; context . put ( SKIPPED_CONFIG_KEY , sortByTestClass ( result . getTestContext ( ) . getSkippedConfigurations ( ) ) ) ; context . put ( FAILED_TESTS_KEY , sortByTestClass ( result . getTestContext ( ) . getFailedTests ( ) ) ) ; context . put ( SKIPPED_TESTS_KEY , sortByTestClass ( result . getTestContext ( ) . getSkippedTests ( ) ) ) ; context . put ( PASSED_TESTS_KEY , sortByTestClass ( result . getTestContext ( ) . getPassedTests ( ) ) ) ; String fileName = String . format ( "suite%d_test%d_%s" , index , index2 , RESULTS_FILE ) ; generateFile ( new File ( outputDirectory , fileName ) , RESULTS_FILE + TEMPLATE_EXTENSION , context ) ; } ++ index2 ; } ++ index ; } }
Generate a results file for each test in each suite .