programmatically export a fiddler session as a webtest

4 posts, 0 answers
  1. Mauricio
    Mauricio avatar
    2 posts
    Member since:
    Sep 2015

    Posted 01 Sep 2015 Link to this post

    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

  2. Eric Lawrence
    Admin
    Eric Lawrence avatar
    833 posts

    Posted 01 Sep 2015 Link to this post

    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
  3. Mauricio
    Mauricio avatar
    2 posts
    Member since:
    Sep 2015

    Posted 01 Sep 2015 in reply to Eric Lawrence Link to this post

    Thank you, Eric. For #1, do you have a sample link on how to get Fiddler to load the saz file?
  4. Eric Lawrence
    Admin
    Eric Lawrence avatar
    833 posts

    Posted 02 Sep 2015 Link to this post

    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
Back to Top