From JMeter Tips Blog: JMeter Tips

Posted Sun, 02/21/2010 - 00:35 by Cloud-Intelligence

 
Printer-friendly versionSend to friend

JMeter Tips

Blog about performance/load/stress testing and JMeter software

Tip #7: How to add cookie support to your Test Plan
Friday, February 19, 2010 12:20 AM

If you want JMeter to handle cookies automatically you need to add HTTP Cookie Manager to Thread Group.

Be sure that Cookie Policy option is set to "compatibility" value, it will work in most cases. As for "Clear cookies each iteration?" checkbox I always check it and never had the situation when I was need it to be unchecked.

Tip #6: How to do the Test Plan more flexible using variables and properties
Friday, February 12, 2010 12:54 AM

JMeter's variables and properties can do your Test Plan very flexible and prevent you from frequent modifications of the Test Plan. Just add the most frequently used options as variables on the Test Plan page and specify their values using "__P" function as on the screenshot below.


As you can see Test Plan can be executed with default values and at the same time if you need to modify some options you can pass them to Test Plan through the command line without the modification of the Test Plan.

Tip #5: How to run a test plan for a certain amount of time
Wednesday, February 03, 2010 11:30 PM

If you want to run your Test Plan for a certain amount of time instead of a certain amount of iterations you can do it in two ways:
  • by specifiing testing duration on the Thread Group GUI (Scheduler checkbox must be checked). Note that you must specify the value of Startup delay option as zero otherwise you will need to specify Start Time option value before each test running. And of course you need to check Forever checkbox of Loop Count option. There is 10 minutes test example on the screenshot below.


  • by creating extra Thread Group with two Test Action samplers. The first Test Action configured as pause, and the seconf one is configured to stop all treads. Look at the screenshots below for 10 minutes test example.









Tip #4: Using JMeter properties
Thursday, January 28, 2010 12:11 AM

Sometimes I need to modify some parameters in the Test Plan and it requires me to start JMeter, open the Test Plan file and edit these parameters there. But it's better to use JMeter properties for this task. Look at the image below.



There are JMeter properties used as values of "Number of Threads (users)" and "Loop Count" options: ${__P(users)} and ${__P(count)}. Also we must add two parameters to JMeter command line:

jmeter -t TestPlan.jmx -Jusers=10 -Jcount=50

Now you can specify necessary parameters on the fly. I recommend you to use properties for the following options: number of users, loop count, host, port, results and data filenames, etc.

Tip #3: Pauses in test plan
Thursday, January 21, 2010 1:21 AM

For complete user simulation you need to add pause after each transaction. In most cases you will use only two types of pauses:

  1. Add constant pause to test planConstant pause. Just add Test Action controller after the Transaction controller. Specify the pause duration in ms and be sure that "Pause" item of "Action" option is checked.

    Constant pause options
  2. Add variable pause to test planVariable pause. Add Test Action as described above but specify the pause duration as 0 (zero). Then add Uniform Random Timer as a child of Test Action and specify the minimum value and maximum offset value.


Video: Using open source tools for performance testing
Friday, January 15, 2010 11:45 AM

Interesting video about performance testing at Google.


Tip #2: Basic web test plan structure
Tuesday, January 12, 2010 11:15 PM

The best practice is to group logically related HTTP requests to transactions using Transaction controllers. As the result you will get not only response time values of HTTP requests but response time values of the whole transactions too.

Thread group
Transaction controller 1
HTTP Request 1
HTTP Request 2
...
HTTP Request N
Transaction controller 2
HTTP Request 1
HTTP Request 2
...
HTTP Request N
...
Transaction controller N
HTTP Request 1
HTTP Request 2
...
HTTP Request N

Tip #1: How to record HTTPS requests by JMeter's recording proxy
Thursday, December 31, 2009 2:34 PM

If you ever tried to record HTTPS requests by the recording proxy of the lastest stable version of JMeter (2.3.4) you know that it's impossible. And HTTPS spoofing option can not help in the most cases.

I investigated this problem and found interesting thing. There is already a bug 47622 in JMeter's Bugzilla that already has RESOLVED FIXED status. Some guys added a patch and fake SSL certificate to JMeter so it allows to record HTTPS requests now. But you must use developer (nightly) build instead of stable release until this bugfix is added to next stable release.