how delete multiple generated ids one by one using delete endpoint
SOLVED- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
how delete multiple generated ids one by one using delete endpoint
I am creating 5 records using Post end points, then after creating those ids I want to delete them one by one using delete end point just for clean up , so how can I achieve it?
So here, I cannot delete multiple IDs in a single request.
While creating the records, storing them in a property as object as below-
{"id1":"124","id2":"234","id3":"345" }
Tried it with groovy, where I am reading those IDs from the property using "Data Source" and then trying to use them for delete using loop, but problem is the loop is going infinitive and for delete always taking only 1st ID i.e "id1":"124".
It would be great if anyone can give me solution .
Solved! Go to Solution.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You dont need groovy to do this.
You can use dataSource loop to handle this. Om typing this on my phone, but i'll provide basic test step hierarchy with explanation when on my laptop
Cheers
Rich
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @richie ,
Thank you for your reply ,could you please explain ?
dataSource loop use to loop from and to, but how will it help to loop in picking IDs one by one from property (here I am storing the generated ids as key and value pair as explained above) and send it to delete endpoint?
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for this post i was willing to post it and i found this I am creating 4 records using Post end points and i had the same question.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Re "dataSource loop use to loop from and to, but how will it help to loop in picking IDs one by one from property (here I am storing the generated ids as key and value pair as explained above) and send it to delete endpoint?"
The datasource and loop and in short the beginning and end of the steps you want to loop.
See recent this recent post about datasources and loops - https://community.smartbear.com/t5/ReadyAPI-Questions/One-Excel-Datasource-and-Multiple-Test-cases-u...
The dataloop requires two parameters. Firstly, the data source it is bound to (to create the loop), the second is the first step inside the the loop (after the datasource) you was as part of your loop.
OK, that's datasources and loops, but the problem in hand.
I know you can use groovy as your datasource, but I've never tried. But, I think the reason you're getting an infinite loop is that they're executed afresh each time they're called. I don't believe they have any state. For example, in the Groovy script window there is Green Go button. I imagine that if you click it several times it will reply with "1" each time.
I'm need to pop out before I start work, but in the meantime, how/where are you storing these Ids?
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @ChrisAdams
I am storing the Ids in Property (Getting generated runtime by post). And i don't want to store those generated Ids in excel instead of storing in property. Please find the attach snap
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi.
I've had a played with datasource using Groovy, and I can't get it to work either.
It might be possible to use the tear-down script, but I haven't got time right now. I'll try and have a look later.
