Forum Discussion

anand1's avatar
anand1
Contributor
5 years ago

Assertion of selective elements in a teststep

Hi,

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
step1
step2
step3
XPATH - [AC-1,EX-C-1]
XPATH - [AC-2,EX-C-2]
XPATH - [AC-3,EX-C-3]
step4
step5
step6
Datasource loop

Iteration 2- csvdata file-Datasource step
step1
step2
step3
XPATH - [AC-1,EX-C-4]
XPATH - [AC-2,EX-C-5]
XPATH - [AC-3,EX-C-6]
step4
step5
step6
Datasource loop


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.

  • 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.

  • nmrao's avatar
    nmrao
    Champion Level 3
    Would you mind providing sample response of step 3(need not be same exact, but same structure of xml data) and what fields or data you need to verify as part of assertions.
  • anand1  : I think doing this by groovy script will easy your work as this is so dynamic. Even if you want to assert via pre existing feature of ReadyAPI then please share some response of Step-3.

    • anand1's avatar
      anand1
      Contributor

      Thanks nmrao HimanshuTayal 

      Below is the screenshot for the call that I am executing, and in both the screenshot, call is made to the same table, however the expected value that I am trying to assert is changing.

       

      Screen1:

       

      Screen2:

       

      Let me know if that helps.

       

      Thanks,

      Anand

      • nmrao's avatar
        nmrao
        Champion Level 3
        Can't view the images, lost the quality on zooming.

        Attach text of the response.