Hey!
TI am using a script developed to record my execution stats. Its a teardown script I've stuck at project level at moment and is as follows:
It's fantastic - does almost everything I want. Currently it iteratively runs through each of the testsuites and returns the pass/fail numbers for the tests in each testsuite in the project. This is great - but on top of the current stats returned I need it to return a total executed, total PASS and total FAIL for the project after all the other stats have been returned, rather than at testsuite level which is what it's doing at the moment.
I think I could probably do that if the script wasn't iterative - if the script parked the values into variables that I could add up at the end - I think I could do that - but I just dont know where to start to alter the existing to give me those extra project level stats - or maybe it is easy and I'm just being dumb!?!? ![Smiley Wink Smiley Wink]()
// Define variables for holding test suites, test cases and test steps
def testSuites
def testCases
def passedTestCases = 0
def failedTestCases = 0
// Get the list of test suites
testSuites = runner.getResults()
// Iterate through each test suite
testSuites.each() {
log.info "----------------------------------------"
log.info "The " + "'" + it.getTestSuite().getName() +"'" + " test suite has " + it.getStatus() + "ED."
log.info "Test case execution results as follows..."
// Get all the test cases and iterate through them
testCases = it.getResults()
testCases.each() {
log.info "Test case " + "'" + it.getTestCase().getName() + "' " + it.getStatus() + "ED."
if ( it.getStatus().toString().equals("PASS") ) {
passedTestCases++
} else {
failedTestCases++
}
}
log.info " Number of PASSES = " + passedTestCases.toString() + " Number of FAILS = " + failedTestCases.toString() + "."
passedTestCases = 0
failedTestCases = 0
}
If anyone could give me a steer - I'd appreciate it - I just don't know where to start to alter the script accordingly.
As always - props to the originator of the work (Lucian) - I can't take credit! ![Smiley Happy Smiley Happy]()
nice one
richie