cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Create a loop in a Synthetic HTTP Monitor

JeanBlanc
Participant

Hi all 😀

Do you know any way to create a loop in a monitor ?

I need to make some HTTP requests, based on a previous body response.

I already use the skip function (https://docs.dynatrace.com/docs/shortlink/http-monitor-pre-post-script#skip-http-requests) but I didn't see a previous/goto function.

Thanks in advance !

6 REPLIES 6

AntonPineiro
DynaMight Guru
DynaMight Guru

Hi,

Depending on what information you need in next action, maybe, you can check pass variables.

Something as make HTTP request, save answer value in a variable and make other request with that variable.

Best regards

❤️ Emacs ❤️ Vim ❤️ Bash ❤️ Perl

JeanBlanc
Participant

Hi @AntonPineiro,

I already use a lot of pass variables, but that's not a solution for my usecase.

Maybe I'm not clear enough.

I need to execute the same request or go back to a previous HTTP request in the same HTTP monitor.

On Postman, the function exists when you use postman.setNextRequest("xxxx"), you can go to a previous request in the same collection.

Tell me if you need more details 😉

Hi,

I had never heard about it. I would say trying it using pure JavaScript with JavaScript clickpath event.

I hope someone can suggest you a better solution.

Best regards

❤️ Emacs ❤️ Vim ❤️ Bash ❤️ Perl

@JeanBlanc  synthetic tests do not allow loops as far as I know, probably purely for sanity reasons so the test will not stay in loop and never finish.

You can only skip some steps either in HTTP or in Browser monitors. In other words, you are limited by the number of iterations. You can just do two equal HTTP requests, and in the first one use the skip function to skip the second one if desired. If not the flow will continue to the second request.

Certified Dynatrace Master | Alanata a.s., Slovakia, Dynatrace Master Partner

JeanBlanc
Participant

Thank you @Julius_Loman 

Unfortunately, in my case I have between 5 and 50 HTTP requests needed.

So it will be difficult to manually build each step and skip useless ones.

Not really, I'd use a scripted approach and create / update the synthetic test programmatically using API so you don't have to create it manually. Maybe it's wise to rethink if it's really necessary to do it this way - but I don't know your case.

Certified Dynatrace Master | Alanata a.s., Slovakia, Dynatrace Master Partner

Featured Posts