VSTS 2008 has a great recording tool that allows you to create web test simply by recording your web traffic in the browser. But what if your application doesn’t use web browser, but still communicates with servers using HTTP or HTTPS protocols (such as Smart Client application). Then, you can use Fiddler to capture web traffic on the client side and create a VSTS test from Fiddler’s capture. Unfortunately, there might be one more problem… Since Fiddler acts as a proxy, you web application’s traffic has to go through Fiddler. But it doesn’t work for some application, which might have web server name hardcoded into code or configuration file. When this happens, there is another way to record application’s web traffic and create a VSTS 2008 web test – by using Fiddler’s reverse proxy. By reverse proxy I mean capturing web traffic on the web server side, and not on the client side. Basically, your application will think that it’s hitting web server, while it will be directing its traffic to Fiddler installed on web server, and then Fiddler will forward that traffic to the actual application.
Here are the steps on how to set up and use reverse proxy:
1. Log in to your web server and install the latest versions of Fiddler (http://www.fiddler2.com/Fiddler2/) and neXpert (http://www.fiddler2.com/fiddler2/addons/nexpert.asp)
2. Open IIS manager (Start>Administrative Tools>Internet Information Services (IIS) Manager)
3. Find your application under Web Sites, right click it and select Properties
4. Change TCP port from 80 to 81, and click OK
5. Open Fiddler on Web server
6. Select Tools > Fiddler Options
7. Make sure “Allow remote computers to connect” check box is checked on General tab
8. Click on Connections tab, and Change “Fiddler listens on port:” from 8888 to 80, and click OK
9. Select Rules > Customize Rules…
10. Find “static function OnBeforeRequest(oSession: Session)”
11. Add the following code inside of curly brackets: if (oSession.host.toLowerCase() == "webserver") oSession.host = "webserver:81"; //(where webserver is the name of your web server, make sure you spell it in lower case)
So, it should look like this:
static function OnBeforeRequest(oSession: Session)
if (oSession.host.toLowerCase() == "WebServer") oSession.host = "WebServer:81";
12. Save it and close text editor.
13. Close Fiddler and open it again.
14. Make sure that Fiddler is capturing the traffic (Left bottom corner should say “Capturing” or if you click on File menu, “Capture traffic” will have a check mark next to it)
15. Open the application you want to record on the client (not on web server) and perform activities you want to be recorded.
16. Make sure to add a step description after each step you perform by going back to Fiddler on Web server, selecting neXpert tab and clicking Add for Step Description.
17. After you recorded all steps, go back to Fiddler on Web server and stop capturing.
18. Select all recorded sessions (Ctrl + A), right click them and select Save>Selected Sessions>as Visual Studio Web Test…
19. Also, make sure to check out neXpert report, by clicking Create Report button on neXpert tab.
20. Change Fiddler listen port back to 8888 (Tools > Fiddler Options > Connections tab). And close fiddler
21. Change application’s TCP port back to 80 in IIS manager (See step 4)
22. Then, copy the Web test you created with Fiddler in step 18 to your machine (Where you have VSTS 2008 installed).
23. Open or Create a VSTS 2008 test project.
24. Right click Project name in Solution Explorer and select Add > Existing Item. Browse to your recorded web test and click OK.
25. Open web test from Solution Explorer and remove “:81” from all requests (by pressing CTRL + H, and replacing all “webserver:81” with “webserver”, where webserver is the name of your Web server)
26. Then, save the Web test and run it.
Notice that web test has transactions already for each step that you recorded, if you added step description using neXpert tab.
Also, this method works the best for http traffic. If your application uses https, you can disable it while recording the test, by:
- opening IIS manager on the web server
- right clicking your web site and selecting Properties
- selecting Directory Security tab
- clicking Edit on Secure Communications session
- and unchecking “Require secure channel (SSL)”
Make sure to switch it back on when you done recording the test and replacing all HTTP requests in your Web test with HTTPS (the same method we used in step 25).
I also created a video on how to set up a Reverse proxy. You can view it here: http://msdn.microsoft.com/en-us/teamsystem/dd876614.aspx
Microsoft – ACE Team
PingBack from http://asp-net-hosting.simplynetdev.com/how-do-i-set-up-fiddler%e2%80%99s-reverse-proxy-to-create-a-vsts-2008-web-test/
Thank you for submitting this cool story - Trackback from DotNetShoutout
Willy-Peter Schaub on Is Visual Studio 2010 Really as Evolutionary As We Think? The Developer Support
My colleague on the ACE Performance Team, Vitaliy Konev, recently posted a blog post and video discussing
Personalmente non posso vivere senza fiddler , ed un’altra prova della potenza di questo tool la trovate