Using JMeter with Yanel

Using JMeter

JMeter can be used either interactively by running the GUI (JMETER_HOME/bin/jmeter), or through the JMeter Ant Task. For the complete JMeter documention, see http://jakarta.apache.org/jmeter/usermanual/index.html

How to use the jmeter-ant-task

Included in yanel is a jmeter testplan. you can find it under local/test/data/jmeter/testplan/yanel_test_plan.jmx resp. src/realms/test/yanel/data/jmeter/testplan/yanel_test_plan.jmx

To make it work you need to install jmeter2.2 (jmeter2.1 will write the output in a different format hence the xslt included in yanel will not work) on your system and configure the path to your jmeter installation in src/build/local.build.properties jmeter.home.dir

Also set jmeter.save.saveservice.output_format=xml in the jmeter.properties of your jmeter installation.

To execute the test just type ./build.sh jmeter.

You will find the results in local/test/data/jmeter/jmeter-results/ resp. http://localhost:8080/yanel/test/jmeter/jmeter-results/

Note: turn off SSL.

Setting up a test plan

JMeter test plans are XML files, but generally too comlicated to edit by hand, so use the JMeter GUI to set up a test plan.

Here is a basic example:

  • Start JMeter
  • Add a Thread Group to the Test Plan
    • Set Number of Threads to the number of concurrent users desired, e.g. 5
    • Set the Ramp-Up Period to e.g. 1, that means that JMeter will start with 1 thread/user, and add 1 user every second to reach 5 users after 5 seconds
    • Set the Loop Count to 1 (we'll set this later)
  • Add the configuration element HTTP Request Defaults as a child to the thread group
    • Set Server Name/IP & Port, e.g. 127.0.0.1 and 8080
    • Set the Default Protocol, e.g. HTTP
  • Add a Loop Controller element as a child to the thread group
    • Set the Loop Count, e.g. 100
  • Add an HTTP Request element as a child to the Loop Controller
    • Set the Method, e.g. GET
    • Set the path to the page you want to test, e.g. de/index.html (without the server address, because this is already set in the HTTP Request Defaults element)
  • Add a Response Assertion element as a child to the HTTP Request
    • Add a pattern to test for existence on the page tested (i.e. de/index.html)
  • Add a Constant Timer as a child to the Loop Controller element
    • Set the Thread Delay, e.g. to 500 ms (this tells JMeter to wait 0.5 seconds between consecutive HTTP requests within the loop)
  • To view the results of the test, add one or more Listener Elements to the Thread Group, e.g. Graph Results, or View Results in Table
  • Save the Test Plan

This test plan should now look like this:

Test Plan
|__ Thread Group
|__ HTTP Request Defaults
|__ Loop Controller
| |__ HTTP Request
| | |__ Response Assertion
| |__ Constant Timer
|__ Graph Results
|__ View Results in Table

Login

If you need to login to the website for testing, you will need these 2 additions to your thread group:

  • An HTTP Cookie Manager
  • An HTTP Request with the following configuration:
    • Method = POST
    • Path = {test-page}?yanel.toolbar=on
      (this will cause Yanel to redirect to the login page)
    • Parameters:
      • yanel.login.username = ...
      • yanel.login.password = ...
      • regular-login = Login

For more detailed information, see the JMeter Documentation. Also, it might help to use the JMeter Proxy to figure out how the login procedure is actually working, or to debug it if it doesn't seem to be doing what you expect.

More Documentation

Other resources on testing:



Your comments are much appreciated

Is the content of this page unclear or you think it could be improved? Please add a comment and we will try to improve it accordingly.