Ask a Question

how delete multiple generated ids one by one using delete endpoint

SOLVED
mrarkapravo
Contributor

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 .

 

19 REPLIES 19
mrarkapravo
Contributor

@ChrisAdams @TNeuschwanger - Could you please help me out over here ?

Hey @mrarkapravo,

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
if this helped answer the post, could you please mark it as 'solved'? Also if you consider whether the title of your post is relevant? Perhaps if the post is solved, it might make sense to update the Subject header field of the post to something more descriptive? This will help people when searching for problems. Ta

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?

Holden
Occasional Visitor

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.

Myloweslife

Hi @richie ,

 

could you please provide solution of it ?

Hi @richie  ,
any update on this ?Could you please let me know ?

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?

 

 

 

 

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 

 

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.

cancel
Showing results for 
Search instead for 
Did you mean: