Forum Discussion
jkester
13 years agoOccasional Contributor
I found a trick here.
You need to find the Junit ReportCollector. You can use an existing testcase and call all testrunlisteners.
Then you look for any with JUnit.
Then you clone your testcase, and finally, you add the existing reportcollector to listeners of the testcase.
Now your junit report will also show the cloned test cases.
Some example code I just tried out on 4.5:
You need to find the Junit ReportCollector. You can use an existing testcase and call all testrunlisteners.
Then you look for any with JUnit.
Then you clone your testcase, and finally, you add the existing reportcollector to listeners of the testcase.
Now your junit report will also show the cloned test cases.
Some example code I just tried out on 4.5:
(1..5).each {
//log.info it
def templateTc = testRunner.testCase.testSuite.testCases["tc1"]
def listenerList = testRunner.testCase.getTestRunListeners();
def junitReportCollector = listenerList.find {
it.class.name =~ 'JUnit'
}
log.info "JunitReportCollector = $junitReportCollector"
def newName = "newtc$it"
def tc = testRunner.testCase.testSuite.cloneTestCase(templateTc,newName)
if (junitReportCollector != null) {
tc.addTestRunListener(junitReportCollector);
}
log.info "Executing new testcase ${tc.name}"
sleep(2000)
def runner = tc.run(new com.eviware.soapui.support.types.StringToObjectMap(), false)
testRunner.testCase.testSuite.removeTestCase(tc);
}