Load Testing with Apache JMeter |Recording a Scenario

Now we’re ready to go. First we’ll record a scenario from the article "Coding your second Jakarta Struts Application". If you’re interested in using this application yourself you’ll find a link in the resources section of that article where you may download the application (as a war-file ready to install in Tomcat).

We’ll execute these actions in the browser:

  • list all DVDs
  • select the second DVD
  • create a new DVD
  • go back to the list with "Cancel"
  • select the new DVD
  • delete it
  • select the third DVD
  • update it
  • go back to the list with "Cancel"
  • Save the list of DVDs

The DVD application is started by the address http://localhost:8080/dvdapp/list.do. If you size JMeter and your browser making both visible, then it’s easy to see when an HTTP request is added in JMeter. Here’s the first request added:

When the whole use case has been completed, you can see every request in JMeter’s left pane:


By selecting one of the requests—for example, the "DVD update" action, you can see the parameters sent from the browser to the server. This could be useful when debugging an application!

Having recorded the use case, we may run it but first we must consider one thing, A servlet application like this uses a Session object, which typically is maintained by sending a cookie between the browser and the server. JMeter makes it very easy to accomplish this, just add an HTTP Cookie Manager to the Thread Group:

When I tried to run this use case with the same number of threads and same loop count JMeter threw several OutOfMemoryErrors. In the JMeter newsgroup you can read about what may be done to avoid these errors, but again, if you want to simulate a large number of users you’ll need a large computer for running the JMeter server (see next section about remote testing), and maybe also another platform (Windows XP Professional or Solaris).

To simply get the response times I defined one thread, and looped 100 times:

Some of the actions (create, update, delete and cancel) use the same URL so I’ve given each request a unique title, seen in the URL column.