Forum Discussion
jkester
13 years agoOccasional Contributor
You can find the existing report collector by just asking any existing testcase.
You can then attach the same report collector to any new testcase you generate.
Some example code I just tried out on 4.5:
I want to apply this on a datasource too: loop through the records, and for every record clone a test case with a meaningful name, register it to junit report, execute it, remove it.
I think/hope it will work ...
Regards, Jan.
You can then attach the same report collector to any new testcase you generate.
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);
}
I want to apply this on a datasource too: loop through the records, and for every record clone a test case with a meaningful name, register it to junit report, execute it, remove it.
I think/hope it will work ...
Regards, Jan.