Tag Archives: Performance

Jmeter- Record and Play test cases

In my last post I talked about record part of test case in Jmeter.

Next step is to run the test cases, this is relevant even if you have created test cases manually. The first thing we need to add for any test plan is Thread Group.

Right Click on Test plan->Add-> Threads -> Thread Group

You can create test cases manually or record within Jmeter. A basic tool for providing the result data is Summary Report

Thread Group->Add-> Listener->Summary Report

There are additional reporting tools which can be used like Response Time Graph, Graph result etc.

By default the test will execute only once, but this is configurable in Thread Group properties.

Jmeter2

You can see I have set users, rampup and loop as 5.

Number of threads or user will simulate number of users hitting the application simultaneously.

Rampup period will give time it takes for the peak load. For example you have set number of user as 1000, and ramp up period as 100 seconds, Jmeter will start with 1 (or more) user at second one and will increase load gradually. At 100th second, load will get raised to 1000 users.

Loop 1 means that all users will hit the application URL only once. a higher value, say 10 means each user hits the application 10 times. so 1000 users with loop of 10 means a total of 10000 hits on URL.

Once the test completes, we can see results in Summary report or other graphs

Recording Test cases in Jmeter

Recording of web pages for performance testing is straight forward in Jmeter

Open a new Jmeter Test Plan (opens up by default for new setup), this will have Test Plan and WorkBench options by default in the left tree.

Follow these steps to setup the recording
Step 1: Right Click on Test plan->Add-> Threads -> Thread Group
Step 2: Thread Group->Add->Config Elements-> HTTP Request Defaults

Step 3: Now under Workbench-> Add-> Non Test Elements-> HTTP(S) Test Script Recorder
Step 4: (Optional to view requests) HTTP(S) Test Script Recorder -> Add Listener- > View Tree Listener

So far we have just added elements and not done any configuration setting. For recording purpose, we need to configure some values in HTTP(S) Test Script Recorder

jmeter

Port is required to be set to record the browser activity. HTTPS Domains setting is required if we are trying to record HTTPS pages, as I am not doing it here so this is left blank. URL patterns to include and exclude can be set for specific patterns to be recorded.

For this test I only set Port number. The same port number needs to be set in proxy setting for browser from which we are recording the test cases. Click on start button in Recorder and set the proxy setting in browser. For example, in Firefox go to Options->Advanced->Network->Connection-Settings->Manual Proxy Configuration->Http proxy= localhost and Port same as set in Recorder.

And now we are done. Whatever you will browse, will automatically get recorded in Jmeter.