Forum Discussion

Markal's avatar
Markal
Occasional Contributor
8 years ago

Skipping assertions in a test case

Hi, I have a question regarding assertions.

So I have a few assertions in a test step which build upon each other in a tree like structure. So for example, if assertion1 fails it should fail assertions from 2 to 10 . I managed to figure out how to fail assertions but they are ran after they are failed so I didn't save any time with it.
I tried disabling the assertions, but it's very very slow, and sometimes it crashes the whole application. Here is some of our code(It's inserted into a script assertion):

def assertionList=messageExchange.modelItem.getAssertionList()
def currentStep=messageExchange.modelItem String status=assertionList[1].status if(status=='FAILED') { for(int i=2; i<10;i++) { String can=assertionList[i].name currentStep.assertions[can].status="FAILED" } }

I use the above code when trying to disable the assertions and it looks like this:

def assertionList=messageExchange.modelItem.getAssertionList()
def currentStep=messageExchange.modelItem
String status=assertionList[1].status

if(status=='FAILED')
{
for(int i=2; i<10;i++)
 {
	String can=assertionList[i].name
	currentStep.assertions[can].disabled=true
 }
}

Is there a way to skip the assertions that I fail? Like something similar to goToTestStep() ?

No RepliesBe the first to reply