Thursday, June 9, 2011

Record Test Script(test request)


HTTP Proxy Server is a non-test element feature of JMeter which enables user to record scripts from a real browser.
1. Add Thread Group in your Test Plan


Add Thread Group
2. Add Proxy Server to WorkBench
  • Add Non-test Elements > HTTP Proxy Server
add-proxy1
  • Set “Target Controller” where your recorded scripts will be added
proxy-target
  • Set URL patters to INCLUDE or EXCLUDE
    • .* – all
    • .*\.png – all png images
    • .*\.gif – all gif images
    • .*\.jpg – all jpg images
    • .*\.php
    • .*\.jsp
    • .*\.html
    • .*\.htm
    • .*\.js
  • Click START
proxy-exinclude
3. Set your Browser to use Proxy (I used IE7 browser)
  • Go to Tools > Internet options > Connections > LAN Setting
  • Select “proxy server”
  • Set Address = localhost; Port = 8080
lan
4. Browse your application and record
5. In HTTP Proxy Server, click “Stop” when finished
To verify if recording was successful, you should be able to see HTTP requests generated under your “Target Controller”
More Tricks:
Add a Constant Timer to the HTTP Proxy Server node to record your think-time (right-click on the “HTTP Proxy Server” node and choose “Add,” “Timer,” and then “Constant Timer.”)
Next change the “Thread Delay” on the timer to “${T}” to tell the proxy server to record your time rather than to add a constant time for each request.

No comments: