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

programmatically export a fiddler session as a webtest

3 Answers 420 Views
Extensions and Customization
This is a migrated thread and some comments may be shown as answers.
Mauricio
Top achievements
Rank 1
Mauricio asked on 01 Sep 2015, 10:12 AM

Hello,

 Using C# I want to programmatically export a fiddler session as a webtest. I understand this is not possible using FiddlerCore because it does not supports extensions (which is the mechanism to export the session as a web test through the UI).

Hence I have removed my dependency on FiddlerCore and taking one on Fiddler.exe to be able to use the Fiddler.WebTest namespace (from VSWebTestExport.dll).

However, now my existing code to capture the session (based on Fiddler Core) is not working as FiddlerApplication.StartUp() does no exist on the Fiddler assembly.

 

How can I programmatically start and capture a session with a dependency on Fiddler.exe? I hope this will allow me to use the WebTest export class.

 

Thanks,

 

Mau

3 Answers, 1 is accepted

Sort by
0
Eric Lawrence
Telerik team
answered on 01 Sep 2015, 03:34 PM
Hi, Mauricio--

If you have a commercial license to FiddlerCore, I can make available to you a version of the exporters (BasicFormats.dll) which works properly with FiddlerCore, such that you can achieve your scenario with FiddlerCore alone.

Alternatively, you can do either of two things:

1> Capture the traffic with FiddlerCore. Save it to a SAZ file and automate Fiddler so that it loads that file and exports the content from the SAZ file into the WebTest format.

2> Automate Fiddler (using ExecAction.exe) so that it captures the traffic and directly exports the content into a file in the WebTest format. See http://docs.telerik.com/fiddler/KnowledgeBase/ExecAction and https://groups.google.com/forum/#!topic/httpfiddler/4VK8lt4e3HA



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
Mauricio
Top achievements
Rank 1
answered on 01 Sep 2015, 09:08 PM
Thank you, Eric. For #1, do you have a sample link on how to get Fiddler to load the saz file?
0
Eric Lawrence
Telerik team
answered on 02 Sep 2015, 05:18 AM
Inside Rules > Customize Rules > OnExecAction, add a new block to the switch statement, like so:
            
  case "loadandexport":
    var oSessions: Session[] = Utilities.ReadSessionArchive(sParams[1], true);
    var oExportOptions = FiddlerObject.createDictionary(); 
    oExportOptions.Add("Filename", "C:\\users\\lawrence\\desktop\\out1.har"); 
    FiddlerApplication.DoExport("HTTPArchive v1.2", oSessions, 
                    oExportOptions, null);          
  break;

            
Save the file and you can now invoke your converter like so:

"C:\program Files (x86)\fiddler2\execAction.exe" "loadandexport C:\users\PROFILEUSERNAME\documents\fiddler2\captures\fuzzle.saz"



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
Tags
Extensions and Customization
Asked by
Mauricio
Top achievements
Rank 1
Answers by
Eric Lawrence
Telerik team
Mauricio
Top achievements
Rank 1
Share this question
or