ReadyAPI-how to make a teststep wait to run after fetching token
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ReadyAPI-how to make a teststep wait to run after fetching token
In a project I need to get a token first, and then run the teststep.
I have declared the token in the Auth Manager on parent testcase and pointed to all child testcases to 'Inherit from parent'. The token is retrieved correctly.
I also have automated the check on that token for existence. so if it isn't usable anymore, a new token should be asked by the Tokenizer automatically.
Now, I have testcases that have a high latency for the moment, a bug that is known and that they are fixing, but I would like the teststep to wait for e.g. 30 seconds to run and make sure the token is active.
I have inserted a "Delay" object in the testsuites, but I was actually wondering if this is really doing what it should?
Does anybody has an idea please?
Thanks in advance!
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Youre wondering if the Delay step is really doing what it should be? Can you clarify why you think its not behaving as youd expect?
I did notice that you mention a latency of 30 seconds and the value in your screenshot is '3000'. Isnt units of measurement for the Delay step in milliseconds? I.e. 3000 milliseconds = 3 seconds.
30000 milliseconds = 30 seconds.
Ta
Rich
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @richie
Thanks for your feedback. I've adapted the time as I didn't understood this measurement correctly.
Concering the fact if it really work or not is this:
As I have put the tokenizer in Auth manager, and the REST Request is fetching this token in it's request, I don't know the sequence of actions in a testsuite. How is it executed sequentially?
A request has an Endpoint and a resource and parameters, it has (in this case) a token that should be used.
so how is the TestSuite actually executed?
* TestSuite click --> execute all testcases in me
* ReadyAPI searches for the first testcase --> start testcase
* ReadyAPI finds a first teststep that is a Delay --> execute delay of (here ) 30 seconds
* ReadyAPI finds a second teststep that is a Rest Request --> look into the Rest Request for Endpoint and then look if you need a token --> Execute.
If this is the way how it goes, the delay has no use. I need a delay after the Rest Request has found the token to fetch, and delay the proces then.
So actually, to my understanding, that Delay has no use in my case.
Might ReadyAPI look in the teststep Rest Request at the token first before looking at the endpoint, then I should script something to delay the execution of the Rest Request in scripting or something like that.
So, yhé, now that I'm writing this I notice that I explained it wrongly. Sorry. I know that it works, because I see the countdown, but not for my case....
Actually I think I need to use EventHandlers for this but I have no clue about scripting....
Regards,
AAB
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@AAB , As i have understood, you need to wait till the desired condition gets satisfied, so in that case Delay won't help you need to write some logic(script) so that you can let your script wait till the till desired condition gets satisfied.
Let me know if you need help at coding part, will be happy to help 🙂
Click "Accept as Solution" if my answer has helped,
Remember to give "Kudos" 🙂 ↓↓↓↓↓
Thanks and Regards,
Himanshu Tayal
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
That would be great if you could help me because indeed, I'm not a coder 😉
So yes, please give me a script for this. And where should I put it? in an assertion? On testcase level in a setup script?.....
Thanks in advance!
Regards, AboveAndBeyond
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@AAB : You can PM me with some details.
Like where your token is generating where it is getting stored how you are checking if is generated.
Click "Accept as Solution" if my answer has helped,
Remember to give "Kudos" 🙂 ↓↓↓↓↓
Thanks and Regards,
Himanshu Tayal
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If you manage to put some code together to extract the token value without executing the REST step, you might want to make the post sticky or i think theres a "handy stuff" section for cool stuff.
Ive seen lots of posts in the last year about doing this.
Just a suggestion fella,
Rich
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Sorry sir, I can't share that project with you as this is Governmental property.
Kind regards,
AboveAndBeyond
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you Richie for the idea, yes, the techcorner tag is how we can keep the awesome stuff in one place🙂
@HimanshuTayal there would be no way to proceed without the actual project, would there? Or maybe kind of a sample project from @AAB would help?
Sonya Mihaljova
Community and Education Specialist
