Jmeter- Building a Web test plan(2)

3. Adding Cookie Support

Nearly all web testing should use cookie support, unless your application specifically doesn't use cookies. To add cookie support, simply add an HTTP Cookie Manager to each Thread Group in your test plan. This will ensure that each thread gets its own cookies, but shared across all HTTP Request objects.

To add the HTTP Cookie Manager, simply select the Thread Group, and choose Add-->Config Element--> HTTP Cookie Manager, either from the Edit Menu, or from the right-click pop-up menu. 

4. Adding HTTP Requests

In our Test Plan, we need to make two HTTP requests. The first one is for the JMeter home page (http://jmeter.apache.org/), and the second one is for the Changes page (http://jmeter.apache.org/changes.html).

note: JMeter sends requests in the order that they appear in the tree. 

Start by adding the first HTTP Request to the JMeter Users element(Add-->Sampler-->HTTP Request). Then, select the HTTP Request element in the tree and edit the following properties.

  1) Change the Name field to "Home Page".

  2) Set the Path field to "/". Remember that you do not have to set the Server Name field because you already specified this value to the HTTP Request Defaults element.

Next, add the second HTTP Request and edit the following properties, see figure below.

  1) Change the Name field to "Changes".

  2) Set the Path field to "/changes.html". 

5. Adding a Listener to View Store the Test Results

The final element you need to add to your Test Plan is a Listener. This element is responsielbe for storing all of the results of your HTTP requests in a file and presenting a visual modle of the data.

Select the JMeter User element and add a Graph Results listener (Add -->Listener-->Graph Results). Next, you need to specify a directory and filename of the output file. You can either type it into the filename field, or select the Browse button and browse to a directory and then enter a file name. 

posted @ 2015-06-08 22:27  isister  阅读(172)  评论(0编辑  收藏  举报