Use current teststep name to trigger event
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Use current teststep name to trigger event
Hello,
how can I trigger a testRunListener.beforeStep event on the condition of the current teststep's name? The purpose is to skip the execution of the teststep if the custom executeStep property is not matching expectation.
I tried to enter the teststep's name simply into the target column, but this doesn't work.
I also tried to check the condition in the script part, but it doesn't work either:
def teststep = context.getCurrentStep().getLabel()
def executeStep = context.expand( '${Properties#executeStep}' )
if(teststep.equals("cancelCoverage")){
if(!executeStep.equals("X"){´
testRunner.gotoStepByName("EditObject")
}
}
Can you give me a hint?
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ok, just found in the error logs, that script failed because of missing bracket, with correction it works:
if(!executeStep.equals("X")){
.. but I still wonder if it's possible to put this condition as the event's target, something like:
${context.getCurrentStep().getLabel()} = "testStepName"
If this is possible, what would be the correct spelling?
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
May be that should be done at test case level to skip the test step.
Regards,
Rao.
