Tutorial: functional testing with JMeter - part 1

This article makes part of a series of articles. The other parts can be reached through following article links:

Using JMeter Components

We will create a Test Plan in order to demonstrate how we can configure the Test Plan to include functional testing capabilities. The modified Test Plan will include these scenarios:

  1. Create Account—New Visitor creating an Account
  2. Login User—User logging in to an Account
Following these scenarios, we will simulate various entries and form submission as a request to a page is made, while checking the correct page response to these user entries. We will add assertions to the samples following these scenarios to verify the 'correctness' of a requested page. In this manner, we can see if the pages responded correctly to invalid data.

For example, we would like to check that the page responded with the correct warning message when a user enters an invalid password, or whether a request returns the correct page.
First of all, we will create a series of test cases following the various user actions in each scenario. The test cases may be designed as follows:

Create Account

Logon User

With the exception of the Configuration elements, Listeners, and Assertions, which we will add later, our Test Plan will take the form that you see in the following screenshot:

Using HTTP Proxy Server to Record Page Requests

You will need to include the HTTP Proxy Server element in the WorkBench. Some configuration will be required, as shown in the following snapshot:

Configuring the Proxy Server

Simulating Create Account and Login User scenarios will require JMeter to make requests for the registration and login pages that are exposed via HTTPS. By default, HTTP Proxy Server is unable to record HTTP requests. However, we can override this by selecting (checking) the Attempt HTTPS Spoofing checkbox. Selecting Add Assertion will be especially useful as we add specific patterns of the page that we want to evaluate as a later part of this exercise. The Capture HTTP Headers option is selected to capture the Header information as we begin recording. However, to make the recording neater, we will keep this option unchecked. In addition, since we do not require images in our testing, in the URL Pattern to Exclude section, add these patterns: .*.jpg, .*.js, .*.png, .*.gif', .*.ico, .*.css, otherwise these image files, which are not necessary for our testing, will be recorded causing unnecessary clutter in our recording.

Adding HTTP Request Default

A useful addition to this element is the HTTP Request Default element, a type of Configuration element. Since this Test Plan will employ multiple HTTP request elements targeting the same server and port, this element will be very useful. The web server name will not be captured for each HTTP Request sampler record, since the Request Default element will retain this information. With a little configuration change in this element, it allows the Test Plan to run even when the application is the deployed to a different server and/or port. The following snapshot is the HTTP Request Default element that we will use for this exercise.

As we use this default element, our subsequent recording never needs to append the Server name. The result of our recording of the first page is shown in the following snapshot:

Adding HTTP Header Manager

Another very useful default element is the HTTP Header Manager Configuration element. This element can either be added to the Test Plan and configured manually as an afterthought, or we can simply use the recorded Browser-derived headers element as included in the recording. For convenience, we will choose the latter option. Once the Proxy Server records the homepage request, stop the recording. You will find a Header Manager for this page is being captured, as Browser-derived header. Simply click and drag this element to the top of the current scope of the HTTP Proxy Server. Notice that I have removed the Referer, since we want to create a default for the remaining HTTP Requests. Following is a snapshot of this change.

Now, you may de-select the Capture HTTP Headers option in the Proxy Server element, since we have the default header.

Continue to part 2: Recording http requests

Related Posts by Categories


9 Responses to "Tutorial: functional testing with JMeter - part 1"

Anonymous said... March 17, 2009 at 12:48 AM

can you post actual jmeter project file .jmx for download? thx

Anonymous said... March 17, 2009 at 12:49 AM

can jmeter do POST/click on link on jsp pages that is hidden until mouse hover over?

Steven Machtelinckx said... March 17, 2009 at 7:33 AM


- Unfortunately I don't have the .jmx file myself as this is a guest article from Emily H. Halili. Are you having trouble with adding or configuring some elements? Maybe in that case I could help.

- Instead of clicking items on the screen, Jmeter sends requests to the server. So whether the link in your case is available/visible or not, you can always perform a post to the target path. That should work fine. Let us know if you succeed in performing the post or not, good luck.

Dr Lars Wendowski said... May 23, 2010 at 9:18 PM

Purchased this book from Packt. While it is the very most basic it is lacking in more simple automation of Functional Testing/Stress Testing.

Would have like to have seen more ref: User Parameters (from Files)

Anonymous said... December 29, 2011 at 12:12 PM

can you post actual jmeter project file .jmx for download? thx

veerakalal said... December 29, 2011 at 12:16 PM

can you post actual jmeter project file .jmx for download? thx

Dzmitry said... August 28, 2012 at 10:50 AM

Thank you for good tutorial. Recently I've found another JMeter Library, have you seen it?


TestWithUs said... May 7, 2013 at 6:51 AM

SWIFT Interview questions on


For selenium solution visit

For QTP interview questions



Юля Ли said... December 27, 2013 at 3:02 PM

You can record script not only with HTTP Proxy Server, but with Chrome Extension plugin too. See this article - http://blazemeter.com/blog/blazemeters-chrome-extension-record-and-edit-jmeter-script-without-using-jmeter

Post a Comment

Recent Articles

Top Commenters

Recent Comments