cancel
Showing results for 
Search instead for 
Did you mean: 

why need to remove assertions before Adding Xpath match(which is put before request step)

Highlighted
Visitor

why need to remove assertions before Adding Xpath match(which is put before request step)

1.DataSource

2.Add xpath assertion

Notes:

def assertionList = myTestRequest.getAssertionList();
for( e in assertionList){
myTestRequest.removeAssertion(e);
}

if(contact_id!=""){
contact_idXPA = myTestRequest.addAssertion("XPath Match")
contact_idXPA.name="XPath_ContactId"
contact_idXPA.setPath(namespace1+contact_idX)
contact_idXPA.setExpectedContent(contact_id)
}

3.Request/Response

4.Loop_DataSource

If without the code marked as blue, the above asserion in step 2 is failed. while if adding  them back, the above asserion is failed,

 

5 REPLIES 5
Highlighted
Community Hero

Re: why need to remove assertions before Adding Xpath match(which is put before request step)

Abit of confusing.

 

1. Why asserton step without even calling the request?

2. Can't be using predefined assertion which is part of requestion step (without the existing step)?

 

If you have expected values varies for each row, then use custom propeties to have the row data saved and assert each test against custom property. This way, predefined assertion can be used instead of adding and removing each time.



Regards,
Rao.
Highlighted
Community Manager

Re: why need to remove assertions before Adding Xpath match(which is put before request step)

Great advice here nmrao.

 

@lively629 will the solution work for you?


Sonya Mihaljova
Community and Education Specialist

 Join the virtual SmartBear Connect user conference on April 27-28! Get your free virtual ticket today!
Highlighted
Community Leader

Re: why need to remove assertions before Adding Xpath match(which is put before request step)

@lively629  : I think i got you correct, you are doing this to make generic according to your framework, ince i did this i place certain condition in my excel sheet and according to data i add or delete the assertions

 

If i am right  then what you can do is place blue code in Controller/Main Groovy script of your framework.

 

but if i am wrong then please elaborate more.

 


Click "Accept as Solution" if my answer has helped, and remember to give "kudos" Smiley Happy

Thanks and Regards,
Himanshu Tayal
Highlighted
Community Manager

Re: why need to remove assertions before Adding Xpath match(which is put before request step)

@lively629 any updates?


Sonya Mihaljova
Community and Education Specialist

 Join the virtual SmartBear Connect user conference on April 27-28! Get your free virtual ticket today!
Highlighted
Moderator

Re: why need to remove assertions before Adding Xpath match(which is put before request step)

Hi @lively629,

 

We need more information here (as @nmrao requested).



 Join the virtual SmartBear Connect user conference on April 27-28! Get your free virtual ticket today!