Best approach to testing async API calls?
Good afternoon all,
First post so please be gentle :)
Just to give a little context... we're in the process of testing APIs that perform operations asynchronously. Naturally, from a test perspective we need to verify that the asynchronous request has ultimately performed it's desired operation correctly. At present we're just using arbitrary delays awaiting these things to happen but this is far from ideal and adds a level of unreliability to the tests.
i.e.
1. Rest API call - Giving me a request ID response
2. Delay for X seconds
3. Rest API call - Check status of request ID and should have a JSON attribute indicating success/failure/pending
4. Rest API - Do next operation
etc.
What'd like to do is replace step "2 Delay for X seconds" either with... retry step 3 checking the status every Z seconds for a period of Y and do not fail.
Or another approach that meets the needs... we have Soap UI NG Pro in use.
All approaches, suggestions, thoughts welcomed... we haven't dug through all Soap UI NG Pro documentation yet so apologies if it's something obvious in there but haven't seen something that'll meet the need yet.
Appreciate any help! Thanks.
Ken.