14 years ago
Trying to clone assertions through Groovy
I know that SOAPUI Pro allows one to clone Assertions from one test case to another but I don't have Pro and am trying to do it through Groovy. I'm also trying to do it not a run time but at design time by using a groovy test step that's disabled and that I run manually.
My plan is this:
1) Define 2 properties: the source and destination test steps
2) loop on the list of Assertions in the Source
3) Add the Assertions to the Destination (after checking they don't already exist there)
The crux of my logic is this loop:
That destinationStep.addAssertion(assert.get????) is proving to ge difficult. According to other posts that "String" needs to be the type of Assertion (i.e. one of the values in the drop down) but that type values does not seem to be carried on the assertion object I'm pulling from the source step.
Anyone manage to do something like this or know how to assertain the type of the assertion and use that to define a new assersion?
thank you,
Martin.
My plan is this:
1) Define 2 properties: the source and destination test steps
2) loop on the list of Assertions in the Source
3) Add the Assertions to the Destination (after checking they don't already exist there)
The crux of my logic is this loop:
sourceStep = testRunner.testCase.getTestStepByName(sourceTestStepName)
destinationStep = testRunner.testCase.getTestStepByName(destinationTestStepName)
if (sourceStep != null && destinationStep != null && sourceStep instanceof Assertable && destinationStep instanceof Assertable) {
for (assert in sourceStep.getAssertionList()) {
//add to destination
destinationStep.addAssertion(assert.get????)
}
}
That destinationStep.addAssertion(assert.get????) is proving to ge difficult. According to other posts that "String" needs to be the type of Assertion (i.e. one of the values in the drop down) but that type values does not seem to be carried on the assertion object I'm pulling from the source step.
Anyone manage to do something like this or know how to assertain the type of the assertion and use that to define a new assersion?
thank you,
Martin.