This is a migrated thread and some comments may be shown as answers.

How to stop/kill a looping FiddlerScript

2 Answers 653 Views
Fiddler Classic
This is a migrated thread and some comments may be shown as answers.
John
Top achievements
Rank 1
John asked on 18 Jun 2015, 02:18 PM

Hi Eric,

1) congrats on your incredible and marvelous Fiddler, its really awesome, and helps us A LOT !

2) i couldnt find the answer to my question in the forums and/or other sources - so if i was just too blind to find it, please just direct me there. And i know the thing ill describe is not the standard usage of Fiddler (i also often use it for more mainstream purposes, but i thought to try it for this, and it works like a charm!)

3) my situation: i have to test a server with certain requests, and put it under a certain average but not uniform load. for that i first captured and saved some specific request/response pairs (some of them json, some not) using fiddler (v4.5.1.2, on Win7sp1/Ultimate/x64/en-us)

then i slapped together a quick fiddlerscript which does the following: prompt user for a loopcount, and a minimum and maximum delay. then, 'loopcount times', a for-loop replays the selected sessions (using random agentstrings from a list of mine), then waits for a random delay (between min & max), rinse, repeat.. i even added code to allow for multiple selected sessions at the same time, which lets the user enter a probability distribution between the multiple session, which it then uses for the replay, stuff like that.

 4) my question: this works like a charm to create the required random/average load, depending on the parameters i give the script on start. BUT: i cant see a way to STOP the executing script in fiddler forcefully, before the loop ends naturally. Only way i see now is to close the fiddler application itself; then additionally i have to kill fiddler.exe (which still runs the script in the background and keeps throwing the requests from the loop). then i have to restart fiddler, reload all beloved settings (btw, is there a way for example to start with the Composer 'teared off' in separate window by default..?) and all required sessions.

This 'total kill' procedure is quite tedious every time i have to change some setting. normally i need request-loopcounts around 1000-5000x, because i need to have this load for some time to allow me the tests on my server..

Is there an intended method of stopping an executing fiddlerscript? i went so far as thinking about out-of-channel stuff/semaphores like adding code in the loop to query for existence of a specific file, and then break the loop when found (allowing me to stop script loop execution by renaming an external 'kill-file')... but this is very awkward - any other ideas or methods?

 

And again: really, thank you for Fiddler, its a godsend, an incredibly great software helping us developers out !!

2 Answers, 1 is accepted

Sort by
0
Accepted
Eric Lawrence
Telerik team
answered on 18 Jun 2015, 02:57 PM
Hello, John--

The simplest thing to do would be to go to the Handlers class and add:

   public static ToolsOption("Cancel Run")
   var m_CancelASAP: boolean = false;

at the top. Inside your method, before your loop runs, add:

   m_CancelASAP = false;

...and inside your loop, add:

  if (m_CancelASAP) return;

If you'd prefer to have your "Cancel" action be invoked from the keyboard instead of your Tools menu, you could update the OnExecAction method with a new "cancel" item.

Today, there's no public method to "tearoff" the Composer; the UndockBuilder method is private.

Regards,
Eric Lawrence
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
John
Top achievements
Rank 1
answered on 18 Jun 2015, 03:59 PM

Thanks, perfect, just what i have been looking for !!!

 And again, dont know if i have mentioned this before enough, but: thanks for the incredible work producing Fiddler !

Tags
Fiddler Classic
Asked by
John
Top achievements
Rank 1
Answers by
Eric Lawrence
Telerik team
John
Top achievements
Rank 1
Share this question
or