Archive
Jmeter-server 2.3.4 failed to start in Ubuntu 9.10
Problem:
I’m using jmeter 2.3.4 distribution in my ubuntu 9.10, tried running the jmeter-server but encountered the following error:
Server failed to start: java.rmi.RemoteException: Cannot start. <computer_name> is a loopback address.
Solution:
* Go to /etc folder
* Edit hosts file by changing 127.0.0.1 to your absolute IP address
Then run your jmeter-server again, to verify, you should be able to see the following logs in jmeter-server.log file
INFO – jmeter.engine.RemoteJMeterEngineImpl: Starting backing engine on 1099
Now you’re ready to start your distributed testing with Jmeter
JMeter: Using property function to fetch data from user input
If our objective is to run our test scripts from the command line with variable number of users and ramp up period without editing our test plan every now and then, we could do this using JMeter’s simplified property function(“__P”).
First we need to set our Thread Group property as follows:
That is changing the value of Threads and Ramp-up as:
Threads: ${__P(group1.threads)}
Ramp-up: ${__P(group1.ramp)}
We could also use the property function when saving our test results. ${__property(result_dir)}/graph.jtl
From the above settings, Jmeter will automatically generate a graph.jtl file inside result_dir folder.
Notice that number of threads, ramp-up period, result filename are all set as parameters.
After adding samplers and listeners to our testplan. We run our test from the command line by invoking:
jmeter -n -t test.jmx -Jgroup1.threads=10 -Jgroup1.ramp=5
From here onwards we could set different number of threads and ramp up period depending on the scenarios we’d like to test. Cool huh!
Jmeter: Add “Cookie Manager”
Objective: Create an automated scripts using JMeter that will do the following scenarios in a healthcare system application and use the same scripts to register more patients.
1. admin user login
2. register new patient
3. save registration
4. verify new patient in the patient’s list
5. admin logout
Issue: Changing values of an automated scripts does not add the new value to the database on test playback.
Here’s how we do it:
1. In our JMeter testplan, add a Non-Test Element>Proxy Server in the WorkBench to do the initial recording.
2. Add Constant Timer under your HTTP Proxy with value “S{T}” to capture the actual delay during recording.
3. Start your browser, enable proxy in your browser and start recording.
4. After one action is recorded, JMeter generates a Header Manager which allows you to customize what information JMeter sends in the HTTP request header. Make a copy of the Header Manager from the first sample and paste it as a child of your thread group before all the HTTP requests, this will serve as the default header manager to be used. Continue recording until all the scenarios are finished.
5. After recording, update the samples to a more descriptive names just like this:
At this point, new user created during recording is successfully added in the database when manually validated. Next steps will help us parameterized and set new values for our new user.
6. To parameterized your login account, go to your thread group, add a Config Element > User Defined Variable. Then set values for login and password that are accepted in the appliication (in my case, login = admin; password=admin)
7. Update your “login” sample by changing Value to ${Variable_name}
8. Now go to your “fill out express registration form” sample and edit new values for last name, first name and middle name.
8. Run playback or hit CTRL-R to add to automatically add the new user values.
Actual: Scripts are successfully run but new user is not added in the user list
Expected: Succesfully run the script and add the new user in the user list
Solution: After futher readings of JMeter forums and wikis, I bumped across this post, and in its one reply suggest to add a Cookie Manager. True enough after adding a Config Element > Cookie Manager, set its Policy to “Compatibility,” and rerun the scripts, the new user value we edited was successfully added in the user list.
Cookie Manager, saves the day!
JMeter 101: Using HTTP Proxy to Record your Test
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 Testplan
2. Add Proxy Server to WorkBench
- Add Non-test Elements > HTTP Proxy Server

- Set “Target Controller” where your recorded scripts will be added
- 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

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

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.
JMeter 101: Analyze your Test Results
To help you analyze your testing efforts, JMeter provides different types of Listeners. Listeners are JMeter components that show the results of the samples. The results can be shown in the form of a tree, tables, graphs or simply a log file.
Here are some of the listeners that I’ve tried:
1. Graph Full Results / Graph Result
2. Aggregate Graph
3. Aggregate Result
4. Summary Result
5. View Result in Table
6. View Result Tree
JMeter 101: Write your first load test script
Going through this session, assumes that you have successfully set-up JMeter distribution(latest version is 2.3.2) in your box, but if not, it’s never too late you can still check it out on my previous post – JMeter 101: Introduction.
Using the friendly GUI of Jmeter, lemme me help you explore and write your first load test script.
1. Go to “bin” folder of your JMeter distribution, double click “jmeter.bat” file
2. Simulate users by adding a Thread Group.
- Set Number of threads(users) = 5, => the number of concurrent users we want to simulate
- Set Ramp-up Period(in seconds) = 10, => the amount of time it will take to create the threads/users
In this example, Jmeter will create a thread every 2 seconds (10/5). If ramp-up period is set to “0″ or blank, Jmeter will create all the threads immediately.
- Set Loop count = 1, => the number of times to execute the test
3. Simulate web requests by adding Sampler > HTTP Request
- Set a descriptive HTTP request name
- Set Server name or IP = http://www.yahoo.com
- Set Path = “/”, which is Yahoo Homepage
4. To help us analyze the results, add the following listeners
- Listener > Aggregate Report
- Listener > View Result Tree
5. Save your script with .jmx extension
6. Go to Run > Start (ctrl + R)
JMeter 101: Introduction
I. What is Jmeter?
Apache JMeter is a 100% pure Java desktop application designed to load test functional behavior and measure performance. JMeter may be used to test performance both on static and dynamic resources . It can be used to simulate a heavy load on a server, network or object to test its strength or to analyze overall performance under different load types.
II. Why choose Apache Jmeter?
There are wide load testing tools to choose from. There are open source tools like Open STA, http_load, The Grinder, Siege including Jmeter. And commercial tools like LoadRunner, WebLoad etc. But why would we pick Jmeter from this list? Lemme help you decide…
- Jmeter is FREE! – no monthly charges
- Easy to install and use – 100% JAVA with friendly GUI
- Feature rich
- Record from browser
- Load test data from files
- Add logic, variables and functions
- Run distributed testing from multiple machines
- Variety of protocols: Web – HTTP, HTTPS; SOAP; Database via JDBC; LDAP; JMS; Mail – POP3
III. What are the requirements of Jmeter?
- Java Virtual Machine – JMeter requires a fully compliant JVM 1.4 or higher
- Operating System
- Unix (Solaris, Linux, etc)
- Windows (98, NT, XP, etc)
- OpenVMS Alpha 7.3+
IV. Where to get Jmeter?
Download from http://jakarta.apache.org/site/downloads/downloads_jmeter.cgi
I choose the binary version of 2.3.2 release for my Windows XP box.
V. How to run JMeter?
- Unzip Jmeter distribution file to desired path
- Go to “bin” directory
- Run Jmeter file
- Windows : double click jmeter.bat
- Mac : double click ApacheJmeter.jar
- Unix : double click jmeter.sh OR run ./jmeter from the command line
From Jmeter’s friendly GUI, we can now create, record and configure scripts for our load test.
For comprehensive tutorials visit http://jakarta.apache.org/jmeter/
Record Jmeter using Badboyy
For the past 2 days I’ve been filing my blog stuff on the right folder, and I believe this old post of mine belongs here.
Check out how you can record Jmeter scripts on a real browser using Badboy application. Dig in HERE!
















Recent Comments