build-web-test-plan.html
来自「测试工具jmeter可用来进行性能测试」· HTML 代码 · 共 499 行 · 第 1/2 页
HTML
499 行
<a href="test_plan.html#thread_group">
Thread
Group
</a>
in your test plan. This will ensure that each thread gets its own
cookies, but shared across all
<a href="../usermanual/component_reference.html#HTTP_Request">HTTP Request</a>
objects.
</p>
<p>
To add the
<a href="../usermanual/component_reference.html#HTTP_Cookie_Manager">HTTP Cookie Manager</a>
, simply select the
<a href="test_plan.html#thread_group">
Thread Group
</a>
, and choose Add -->
Config Element --> HTTP
Cookie Manager, either from the Edit Menu, or from the right-click pop-up menu.
</p>
</blockquote>
</p>
</td></tr>
<tr><td><br></td></tr>
</table>
<table border="0" cellspacing="0" cellpadding="2" width="100%">
<tr><td bgcolor="#525D76">
<font color="#ffffff" face="arial,helvetica,sanserif">
<a name="adding_requests"><strong>5.4 Adding HTTP Requests</strong></a>
</font>
</td></tr>
<tr><td>
<blockquote>
<p>
In our Test Plan, we need to make two HTTP requests. The first one is for the
Jakarta home page (http://jakarta.apache.org/), and the second one is for the
Project Guidelines page (http://jakarta.apache.org/site/guidelines.html).
</p>
<p><table border="1" bgcolor="#bbbb00" width="50%" cellspacing="0" cellpadding="2">
<tr><td>JMeter sends requests in the order that they appear in the tree.
</td></tr>
</table></p>
<p>
Start by adding the first
<a href="../usermanual/component_reference.html#HTTP_Request">HTTP Request</a>
to the Jakarta Users element (Add --> Sampler --> HTTP Request).
Then, select the HTTP Request element in the tree and edit the following properties
(see Figure 5.5):
<ol>
<li>
Change the Name field to "Home Page".
</li>
<li>
Set the Path field to "/". Remember that you do not have to set the Server
Name field because you already specified this value in the HTTP Request Defaults
element.
</li>
</ol>
</p>
<p><table border="0" cellspacing="0" cellpadding="0"><tr><td><img src="../../docs/images/screenshots/webtest/http-request1.png"><br>
<font size="-1">
Figure 5.5. HTTP Request for Jakarta Home Page
</font></td></tr></table></p>
<p>
Next, add the second HTTP Request and edit the following properties (see
Figure 5.6:
<ol>
<li>
Change the Name field to "Project Guidelines".
</li>
<li>
Set the Path field to "/site/guidelines.html".
</li>
</ol>
</p>
<p><table border="0" cellspacing="0" cellpadding="0"><tr><td><img src="../../docs/images/screenshots/webtest/http-request2.png"><br>
<font size="-1">
Figure 5.6. HTTP Request for Jakarta Project Guidelines Page
</font></td></tr></table></p>
</blockquote>
</p>
</td></tr>
<tr><td><br></td></tr>
</table>
<table border="0" cellspacing="0" cellpadding="2" width="100%">
<tr><td bgcolor="#525D76">
<font color="#ffffff" face="arial,helvetica,sanserif">
<a name="adding_listener"><strong>5.5 Adding a Listener to View Store the Test Results</strong></a>
</font>
</td></tr>
<tr><td>
<blockquote>
<p>
The final element you need to add to your Test Plan is a
<a href="component_reference.html#listeners">
Listener
</a>
. This element is
responsible for storing all of the results of your HTTP requests in a file and presenting
a visual model of the data.
</p>
<p>
Select the Jakarta Users element and add a
<a href="../usermanual/component_reference.html#Graph_Results">Graph Results</a>
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 filename.
</p>
<p><table border="0" cellspacing="0" cellpadding="0"><tr><td><img src="../../docs/images/screenshots/graph_results.png"><br>
<font size="-1">
Figure 5.7. Graph Results Listener
</font></td></tr></table></p>
</blockquote>
</p>
</td></tr>
<tr><td><br></td></tr>
</table>
<table border="0" cellspacing="0" cellpadding="2" width="100%">
<tr><td bgcolor="#525D76">
<font color="#ffffff" face="arial,helvetica,sanserif">
<a name="logging_in"><strong>5.6 Logging in to a web-site</strong></a>
</font>
</td></tr>
<tr><td>
<blockquote>
<p>
It's not the case here, but some web-sites require you to login before permitting you to perform certain actions.
In a web-browser, the login will be shown as a form for the user name and password,
and a button to submit the form.
The button generates a POST request, passing the values of the form items as parameters.
</p>
<p>
To do this in JMeter, add an HTTP Request, and set the method to POST.
You'll need to know the names of the fields used by the form, and the target page.
These can be found out by inspecting the code of the login page.
[If this is difficult to do, you can use the
<a href="component_reference.html#HTTP_Proxy_Server">
JMeter Proxy Recorder
</a>
to record the login sequence.]
Set the path to the target of the submit button.
Click the Add button twice and enter the username and password details.
Sometimes the login form contains additional hidden fields.
These will need to be added as well.
</p>
<p><table border="0" cellspacing="0" cellpadding="0"><tr><td><img src="../../docs/images/screenshots/http_login.png"><br>
<font size="-1">
Figure 5.8. Sample HTTP login request
</font></td></tr></table></p>
</blockquote>
</p>
</td></tr>
<tr><td><br></td></tr>
</table>
<br>
<table>
<tr>
<td bgcolor="#525D76">
<div align="right"><a href="index.html"><font size=-1 color="#ffffff" face="arial,helvetica,sanserif">Index</font></a></div>
</td>
<td bgcolor="#525D76">
<div align="right"><a href="build-adv-web-test-plan.html"><font size=-1 color="#ffffff" face="arial,helvetica,sanserif">Next</font></a></div>
</td>
<td bgcolor="#525D76">
<div align="right"><a href="test_plan.html"><font size=-1 color="#ffffff" face="arial,helvetica,sanserif">Prev</font></a></div>
</td>
</tr>
</table>
</td>
</tr>
<tr><td>
<hr noshade size="1">
</td></tr>
<tr>
<td>
<table width=100%>
<tr>
<td>
<font color="#525D76" size="-1"><em>
Copyright © 1999-2008, Apache Software Foundation
</em></font>
</td>
<td align="right">
<font color="#525D76" size="-1"><em>
Updated: $Date: 2007-08-31 18:31:15 +0100 (Fri, 31 Aug 2007) $
</em></font>
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?