Ask a Question

Verify multiple rows and then data drive

SOLVED
endorium
Frequent Contributor

Verify multiple rows and then data drive

First off I am new to Soup/ReadyAPI. 

I have an API that returns row information for a grid.

I have assertions for the count of rows and the first row. I am also verifying the data against an excel sheet which is all working fine.

 

The problems comes when I add more than one row of data in the excel sheet as i want to validate multiple rows. I cannot get this to work. Ideally I want to validate 3 rows on each run looking at the same excel sheet.

Any ideas how I do this? Eventually I want to datadrive this as well.

 

Screenshots of assertions and data returned plus excel sheet.

 

Ready.PNGexcel.PNG

45 REPLIES 45
endorium
Frequent Contributor

Good question.

They will not always be the rows that are validated.

If those rows are hardcoded to begin with, I can live with that and work out how to paramatize (Not a word..) those at a later date. Eventually I would use values set in the excel workbook to set which rows to validate.

 

I this this adds extra complexity but also makes it flexible.

As mentioned this is something that I can try resolve down the line. Its just getting the basics up and running for now.

I don't see an "easy" way around this, since you have two sets of data (grids from the response, and an excel sheet) that need to be compared. The way forward I would take is:

 

 

  1. Test Case
    1. Request whose response is a grid of data
    2. Groovy script to parse response and insert into a Data Source
    3. Grid Data Source to hold the data from the response
      1. Excel Datasource to read in Excel File
      2. Groovy Script to compare Row of Excel file to current grid row
      3. Data Source Loop for Excel DataSource
    4. Data Source Loop to parse through each row of the response

There's a lot of logic involved, but that might work for what you want. 




---

Click the Accept as Solution button if my answer has helped, and remember to give kudos where appropriate too!
endorium
Frequent Contributor

OK, I am sure it must be possible. I did not think it would be an unusual scenario but it seems it is 😞

I will keep looking. Thanks for the help

sanj
Super Contributor

its possible for sure

Have a groovy script that actually reads the particular row and assigns its to test case variables

Then make an assertion for the appropriate row

I have done something similar where each row is identified using a unique key

That how I retrieve and assign the values for that row to the test case variable.

 

 

It's not that it's an usual scenario, it's just that it would take some work. You basically have two tables of data and need to verify specific rows in one exist in the other. This isn't an easy scenario and would involve working with groovy scripts or various DataSource/Loops. 




---

Click the Accept as Solution button if my answer has helped, and remember to give kudos where appropriate too!
endorium
Frequent Contributor

Ok, bit of a learning curve but a challenge all the same.

 

 

 

endorium
Frequent Contributor

To give a bit more info/thought...

Screenshot below is a typical response for this grid. SO in my sheet which I attached in the initial post, I would like it to look at the first row. It has an ID of '1'. I then want it to compare the data for this row with the response I got for ID 1.

 

Then in the next row on the sheet I could have ID 223. It should then compare that with the JSON data returned for ID 223.

 

 

I am learning but if anyone could give me just a very basic example of get me started it would be apprciated and I can take it from there.

 

sample.PNG

endorium
Frequent Contributor

Can anyone help to start things off?

I have been "googling" but not come across anything that can help me start it off

Are you comfortable with groovy scripts and adjusting / writing /  maintaining them? If not, that would not be a viable solution for you and I would recommend you look at the Data Source / Loop test steps and play with those. Documentation on them can be found here: https://support.smartbear.com/readyapi/docs/soapui/steps/data-source.html

 

If you are comfortable, I can probably offer up some psuedo code groovy that might be useful as a launch pad for you.




---

Click the Accept as Solution button if my answer has helped, and remember to give kudos where appropriate too!
endorium
Frequent Contributor

I have had a good read of the documentation.

ALthough I have not used groovy before I can use java/javascript fairly well.

 

I have been looking at groovy and can make sense of what is going on.

Even a basic starting point would  be greatly appreciated.

cancel
Showing results for 
Search instead for 
Did you mean: