If you are developing an HTTP based component or have a detailed interface spec of what you need to test, creating your WebInject test cases is pretty straight forward. Other times you may have a web application in front of you that you want to test, but are not sure how the HTTP requests are formatted.
An easy way to view all the HTTP traffic you are sending from your web browser is to use a proxy server. You can run a proxy server locally on the same machine you are browsing from. You can see all of the HTTP requests and responses that are sent and received. You can use the data that you record to model test scripts. This is the same way that recorders on commercial load test tools work.
A proxy server acts as an intermediary between a workstation user and a web server. An HTTP proxy server receives a request for an internet service (such as a web page request) from a user, and acting as a client on behalf of the user, requests the page from the web server. When the response is returned, the proxy server relates it to the original request and forwards it on to the user.
To go through an HTTP proxy, you will need to point your browser to the proxy server so all web requests are directed to it:
If the proxy server is running on a remote machine, use the IP Address of the server as the "Address". If it is running locally, use the IP Address of your own machine as the "Address". If this does not work for a local proxy, enter 'localhost' as the "Address" rather than your IP. The "Port" you enter is the port that the proxy server is listening on. This is an option when you start the proxy server, but usually defaults to port 8080. (Remember to turn off the proxy settings when your are done recording)
There are proxy servers available for all platforms including many good ones that are free and open source. For Windows I use Proxomitron - www.proxomitron.info.
Here is an example of the proxy server log in Proxomitron created by requesting the statistics page at SourceForge for this project (http://sourceforge.net/sourceforge.net/project/stats/?group=100145) with my web browser:
You are able to view the full HTTP Outgoing Request Header and Incoming Response Header. If it is an HTTP POST (where the data is sent in the body of the outgoing request rather than the header), you can also see the POST data in the proxy logs.
In this example, it is a 'GET' Request for '/project/stats/?group=100145' at the Host 'sourceforge.net'.
Your 'url' test case parameter for WebInject would look like: