Forum Discussion
PaulDonny
12 years agoRegular Contributor
Personally I would have each groovy script check a property value as to whether they should do their functions or not. With testRunner you can pass in the propert(y|ies) and then have the groovy scripts check if the flag for it was set to run or not.
For example using a CSV style property that will check:
Basic explanation:
It checks the property value scripts for the name of the current script. If it is not there it just returns. If it is there, it skips the return and continues on with the script. Very simple, the groovy scripts still run (I suppose you could do a controller script that will disable them but this will be easier IMO).
If you put the above into it, as long as the groovy scripts do not have extremely similar names (For example, dog and dog2 would always trigger dog when dog2 is triggered with this current script).
Enjoy.
For example using a CSV style property that will check:
if (!testRunner.testCase.testSuite.project.getPropertyValue("scripts").toString().contains(context.testCase.getTestStepAt(context.getCurrentStepIndex()).getName())) {
log.info "This step is disabled";
return;
}
//The code for the Groovy script would go here
log.info "Nope, not disabled";Basic explanation:
It checks the property value scripts for the name of the current script. If it is not there it just returns. If it is there, it skips the return and continues on with the script. Very simple, the groovy scripts still run (I suppose you could do a controller script that will disable them but this will be easier IMO).
If you put the above into it, as long as the groovy scripts do not have extremely similar names (For example, dog and dog2 would always trigger dog when dog2 is triggered with this current script).
Enjoy.