Extracting POST arguments from fiddler for JMeter

You can filter on your domain by clicking filters in the top right hand corner row of tabs in Fiddler, then add your domain and click run filterset now in the “Actions” dropdown box.

After running your requests in your browser, you should see something similar to what is below…

You can save the output to a text file by clicking the ones in which you are interested, then right clicking the selecting and save as test, as shown below…

With the resulting text file, you can run the python below to generate a file that can be used to paste into the JMeter UI for POST arguments.

import re

URL=""
for lne in open("your_fiddler_file","r"):
  if re.match("HTTP/1.1",line) and len(tmp) > 0:
    l = URL.split("/")
    if URL != "" and re.match("www.yourtestdomain.com",l[2]):
      print METHOD,URL
      m = tmp.split("&")
      if len(m) > 1:
        print "#cut and paste the tab delimited post parameters below into the post variables section of your JMeter plan"
        print "#for the URL above"
        for i in m:
          n = i.split("=")
          print n[0] + '\t' + n[1]
      print "------------------------------------------------------------------"
  elif re.match("^POST",line) > -1 or re.match("^GET",line) > -1:
    METHOD = line.split(" ")[0]
    URL = line.split(" ")[1]
  tmp = line

Generally, I have found this to be the most reliable way to record a test, even when compared to the JMeter script recorder as well as WebSite Pulse (which is still pretty good).

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.