Assertion of selective elements in a teststep
I am using readyapi version 3.1.0 and I am trying to do the database testing using it
My test case looks like this
Iteration 1- csvdata file-Datasource step
XPATH - [AC-1,EX-C-1]
XPATH - [AC-2,EX-C-2]
XPATH - [AC-3,EX-C-3]
Iteration 2- csvdata file-Datasource step
XPATH - [AC-1,EX-C-4]
XPATH - [AC-2,EX-C-5]
XPATH - [AC-3,EX-C-6]
When i am looping my test case, all the steps are basically dbase calls only and output of step 3 is also from a table
and in the first iteration I am getting few fields & they are asserted using xpath assertion
But when i iterate it, input data for step3 changes and now I have 3 different fields in the same step(Step3) which i need to assert
It is like execution step3 is same, but it is displaying different output in the same column, because of my input data
And my requirement is, I need to assert all the elements using xpath match assertion
I am sure it can be achieved by Groovy script, wondering if in this flow I can be able to use readyapi existing components
Any help which leads to a direction is highly appreciated.
Please let me know, if it needs more clarification.
Solved! Go to Solution.
The alternative is to custom property one per response XML element and the desired colum data be set to the custom property before. But it may not be feasible to do that as XPath assertion would run as soon as the response is received. Otherwise, script assertion is flexible if you can do that.
It is possible with custom property if you know for particular condition even if the expected data column changes, do the assignment of expected data to custom property as suggested earlier. And use custom property as expected data insted of data source field. Then have actual test step after the assignment. So that XPath assertion can be run without any issues.
No it is only one row in the step3
In this eg
Iteration 1 - R1- c1,c2,c3,c4,c5,c6
Iteration 2 - R2-c1,c2,c7,c8,c9,c10
Actual Data-Coming from my request
Iteration 1 - OR1- oc1,oc2,oc3,oc4,oc5,oc6
Iteration 2 - OR2- oc1,oc2,oc3,oc4,oc5,oc6
R- means row and c means columns and oc - output column,OR- output row
When i am running the loop
Iteration 1 - Xpath assertion : R1-OR1 -- True
Iteration 2 - Xpath assertion : R2-OR2 -- false
Added the Iteration's
Hope this helps
No it is not possible..!!
With respect to the discussion..I feel that it will be fine if I use script assertion as using that I can put a condition and then assert it.
Thanks for tyring to help me out. appreciate your efforts.
Thanks @nmrao for your suggestion
I have never used custom property earlier, however I am able to achieve it using script assertion and for now it seems that it running well with my huge data.
Still if i run into any scenario..will surely try the custom property approach.
Thanks for your help.
Yes, for this dynamic assertion use the script assertion, as you can write code to achieve every condition.
Click "Accept as Solution" if my answer has helped,
Remember to give "Kudos" 🙂 ↓↓↓↓↓
Thanks and Regards,