Forum Discussion
Hi rajs2020,
I read your question incorrectly. Thanks to richie, I read it again.
So, you have Ready API and with that you have Data Driven Tests? It sound like you want to generate data on the fly AND use it as a source for your data driven test at the same time? Am I getting closer?
Chris
- rajs20205 years agoFrequent Contributor
Yes, I want to create my own "table"/"data grid" with code and then use its data to make some api calls repeatedly. I do not want to use the static/fixed data grid of ReadyAPI. Thanks.
This is the kind of code I expect:
DataSource:
"Table" tab = new Table()
//Code to fill the table.
DataSourceLoop:
Table tab = DataSource.getResult();
FOR each row, iterate through columns & use column values in to make api call in REST api step.- ChrisAdams5 years ago
Champion Level 2
Why not an initial Groovy step that creates the data for the test and saves it to a file. Then use plain old Data driven tests to read the data from the newly created file.
You don't have to use Ready API/Groovy to create the data, you could use whatever you want, but I suppose it would be tidier all in Ready API.
Re "FOR each row, iterate through columns & use column values in to make api call in REST api step.", are you trying to make something truly dynamic that can fit any number of rows and columns? If so, how are you going to build your payload based on the columns in the row?
- rajs20205 years agoFrequent Contributor
Thanks. But, I don't want to create a file because it is unnecessary overhead & I only need to create 5-10 rows of data. ReadyAPI has its own data grid. I wonder if the code for that is available inside groovy script so that we can generate the grid ourselves too.
For the 2nd part, this is what I have in mind - The number of rows & columns are known, all rows must have the same number of columns and the table supports at least, say 100 rows (arbitrarily chosen). I haven't figured out how to build the api payload yet. I'm almost about to abandon this approach & let duplicate tests remain.