Forum Discussion
SmartBear_Suppo
Alumni
13 years agoHi,
I tried to reproduce it with similar code. I was able to execute it successfully once and then it asked for a unique name for the assertion when I executed again through GUI. I saw the same exception when I clicked the "Cancel" in the name dialog. If I enter a unique name then it adds the assertion and sets the path correctly. So, I think the assertion was added in first run and it stays there once the project is saved - you don't have to add it in every run/execution - rather you just want to update the path and expectedContent values if the assertion already exists.
Do you also see the error in same scenario?
Can you please change:
To:
and
To:
and try again.
I hope it helps.
Best Regards,
Prakash
SmartBear Sweden
I tried to reproduce it with similar code. I was able to execute it successfully once and then it asked for a unique name for the assertion when I executed again through GUI. I saw the same exception when I clicked the "Cancel" in the name dialog. If I enter a unique name then it adds the assertion and sets the path correctly. So, I think the assertion was added in first run and it stays there once the project is saved - you don't have to add it in every run/execution - rather you just want to update the path and expectedContent values if the assertion already exists.
Do you also see the error in same scenario?
Can you please change:
mchelikani wrote: def assertion = testStep.addAssertion("Check for existance of")
To:
def assertion = testStep.getAssertionByName("Check for existance of")
if(assertion == null){
assertion = testStep.addAssertion("Check for existance of")
}and
mchelikani wrote: def assertion = testStep.addAssertion("XPath Match")
To:
def assertion = testStep.getAssertionByName("XPath Match")
if(assertion == null){
assertion = testStep.addAssertion("XPath Match")
}
and try again.
I hope it helps.
Best Regards,
Prakash
SmartBear Sweden