Monday 24 February 2014

JMETER TIPS AND TRICKS

1. How to add JMeter requests manually and 
2.Need to capture the traffic for a web front end that’s heavy in AJAX. So there’s a lot going on in the background that I don’t get to see by just making a request to the page. I could use a third party app or an addon like Firebug to grab all the traffic but when that functionality is built into JMeter I’d just be making work for myself.

I have the bare bones of my test plan in place. In the test plan node I create a User Defined Variable called serverName with the relevant target server name as the value. I’m ready to record the transactions for a short user story. I create a blank transaction controller to group the page requests (this relates to another tip I’ll post later) then in the Proxy Server config I set the Target Controllerto this empty one.

Changing the proxy server and port in the browser, I point the browser at the required location and record the transaction. For the next step I create another empty Transaction Controller, update theTarget Controller of the Proxy Server, and continue with the user story, repeating this process for each step.

This can seem cumbersome but it lightens the work load. It also allows you to go back and edit the request, adding whatever assertions you feel may be warranted while the step is clerar in your mind. An alternative would be to set the Grouping on the Proxy Server to Put each group in a new controller and later copy and paste these grouped requests into transaction controllers seperately. Either way would work. Just don’t get too far ahead of yourself and record a large slice of your user story without analysing it.

Now if I go back and look at an HTTP request created during the user story, the Server Name or IPfield has been automatically filled with the appropriate variable i.e. ${serverName}. Any other variables I set are also automagically entered into their appropriate fields.

No comments: