Sunday, October 14, 2012

Tip #16: How to save test results - part 2

In the previous part I wrote how to save the testing results using Simple Data Writer. There is one more way about how to do it - using the command line options.

So, if you want to run the test plan from file test.jmx and save the testing results to the file log.jtl, use the following command:
jmeter -n -t test.jmx -l log.jtl
You can configure how the result data will be saved by editing the file (section "Results file configuration"). For example, if you want to save the results in CSV format you should edit the following property:
This way is more powerful than the one described in the previous part (Simple Data Writer) because it allows you to set some additional options like CSV delimiter, timestamp format, etc. Sometimes it could be very helpful.

Wednesday, July 25, 2012

Tip #15: Hacking the response data size limit

View Results Tree is very useful listener especially when you are debugging your test plan. You can review the response data and ensure that your test plan works good. But sometimes you you can see a message in the beginning of the response data like "Response too large to be displayed. Size: 313674 > Max: 204800, Start of message:".

JMeter - Response too large to be displayed

And unfortunately you are not able to see the whole response data. By default JMeter shows only first 200 Kb of response data. To resolve this problem you should edit the file and uncomment the line:
 This will disable response data size check at all.

Uncommented view.results.tree.max_size=0

After you have saved you will never see this message again.

The problem with the response data size limit has been resolved.

Saturday, December 31, 2011

Tip #14: Advanced test plan structure

Working with JMeter for about 2 years I've come to the optimal (for me) structure of the test plan. It's divided into several suites (thread groups) depending on user type (visitor or signed in user, etc.) and is quite large to simulate real user activity. Complex business operations can be grouped using Simple Controller for better readability of the test plan. Also do not forget about pauses.

Here is an example test plan structure:

Thread Group - Visitor Suite
  Simple Controller - Homepage
    Transaction Controller - Homepage
      HTTP Request Sampler
  Random Order Controller
    Simple Controller - News page
      Transaction Controller - News page
        HTTP Request Sampler
Thread Group - User Suite

  Simple Controller - Sign In page
    Transaction Controller - Sign In page
      HTTP Request Sampler
  Random Order Controller
    Simple Controller - View User Profile page
      Transaction Controller - View User Profile page
        HTTP Request Sampler

Tuesday, October 26, 2010

Tip #13: Checking for empty variable using IF controller

Sometimes you need to add HTTP samplers with dynamic URL or with dynamic part of the URL which are stored in some variable after HTTP sampler post-processing.

But if Regular Expression Extractor will not find any matching string result variable will be set to default value (empty value in our case). We should test this variable for emptyness before we will use it.

Now if the News page has not any news we are sure that JMeter will handle this situation correctly.

Wednesday, June 2, 2010

Tip #12: How to add HTTP Request sampler with dynamic URL

If you need to add HTTP Request sampler with dynamic URL that can be different each time from testing to testing you must use one of the Post-Processors offered by JMeter. I usually use Regular Expression Extractor for this purposes.

So, let's imaging that you have "Popular News" web page which contains the links to "News Story" web pages that contains the full texts of news and you want to write a test which will include both "News" page and random "News Story" page.

For this you must include "News" page HTTP Request sampler inside Simple Controller with a Regular Expression Extractor to store random "News Story" page URL to a variable:

Then use the variable with the stored random "News Story" page URL in "News Story" HTTP sampler: