08a构建一个LDAP测试计划

来源:互联网 发布:谭松韵网络综艺节目 编辑:程序博客网 时间:2024/06/18 12:49

08a构建一个LDAP测试计划

Created Friday 30 June 2017

In this section, you will learn how to create a basic Test Plan to test an LDAP server. You will create four users that send requests for four tests on the LDAP server. Also, you will tell the users to run their tests 4 times. So, the total number of requests is (4 users) x (4 requests) x repeat 4 times) = 40 LDAP requests. To construct the Test Plan, you will use the following elements: Thread Group, LDAP Request, LDAP Request Defaults, and View Results in Table .
本章,你将会学习如何去创建一个基本的对LDAP服务器的测试计划,你将会创建四个用户,发送对LDAP服务器四个测试请求,你也可以告诉用户运行他们的测试4次,所以总的请求数是(4 users) x (4 requests) x repeat 4 times) = 40 LDAP requests。为了构建这个测试计划,你将会使用下面的元素:Thread Group, LDAP Request, LDAP Request Defaults, and View Results in Table。

This example assumes that the LDAP Server is available at ldap.test.com.
这个例子假设ldap.test.com上的LDAP服务器是可用的。

8a.1 添加用户

The first step you want to do with every JMeter Test Plan is to add a Thread Group element. The Thread Group tells JMeter the number of users you want to simulate, how often the users should send requests, and the how many requests they should send.
每个JMeter测试计划的你想要做的第一步是添加一个线程组元素,线程组告诉JMeter你想要模拟的用户数,用户多久发送一次请求,他们发送多少次请求。

Go ahead and add the ThreadGroup element by first selecting the Test Plan, clicking your right mouse button to get the Add menu, and then select Add → ThreadGroup. You should now see the Thread Group element under Test Plan. If you do not see the element, then “expand” the Test Plan tree by clicking on the Test Plan element.
回过头来,要添加线程组,先选中测试计划,点击你的鼠标右键到Add菜单,然后选择Add → ThreadGroup,你应该可以在测试计划下面看到线程组,如果你可不到的话,那就通过点击测试计划元素来展开测试计划树。
这里写图片描述
Figure 8a.1. Thread Group and final test tree

8a.2 添加登录配置元素

Begin by selecting the LDAP Users element. Click your right mouse button to get the Add menu, and then select Add → Config Element → Login Config Element. Then, select this new element to view its Control Panel.
先选中LDAP Users元素,点击鼠标右键到Add菜单,然后选则 Add → Config Element → Login Config Element,然后选择这个新元素来查看它的控制面板。

Like most JMeter elements, the Login Config Element’s Control Panel has a name field that you can modify. In this example, leave this field with the default value.
想大部分的JMeter元素,登录配置元素的控制面板有一个你可以修改的name字段,在这个例子中,保留该字段为默认值。
这里写图片描述
Figure 8a.2 Login Config Element for our Test Plan

Enter Username field to “your LDAP Username”,
输入Username字段为“你的LDAP用户名”
The password field to “your LDAP Password”
输入password字段为“你的LDAP密码”

These values will be used by the LDAP Requests.
LDAP Requests将会使用这些值。

8a.3 添加LDAP请求默认

Begin by selecting the LDAP Users element. Click your right mouse button to get the Add menu, and then select Add → Config Element → LDAP Request Defaults. Then, select this new element to view its Control Panel.
先选中LDAP Users元素,点击鼠标右键到Add菜单,然后选中Add → Config Element → LDAP Request Defaults。然后选中这个新元素去查看它的控制面板。

Like most JMeter elements, the LDAP Request Defaults Control Panel has a name field that you can modify. In this example, leave this field with the default value.
像大部分的JMeter元素一样,LDAP Request Defaults的控制面板有一个你可以修改的名称字段。这里例子中,保存这个字段为默认值。
这里写图片描述
Figure 8a.3 LDAP
Defaults for our Test Plan
Enter DN field to “your LDAP Root Distinguished Name”.
输入DN字段为“你的LDAP基准DN”
Enter LDAP Server’s Servername field to “ldap.test.com”.
输入LDAP 服务器的Servername字段为“ldap.test.com”
The port to 389.
输入port为389
These values are default for the LDAP Requests.
LDAP Requests将会使用这些值。

8a.4 添加LDAP请求

In our Test Plan, we need to make four LDAP requests.
在我们的测试计划中,我们需要制作四个LDAP请求。

  • Inbuilt Add Test
  • 内置的添加测试
  • Inbuilt Search Test
  • 内置的搜索测试
  • Inbuilt Modify Test
  • 内置的修改测试
  • Inbuilt Delete Test
  • 内置的删除测试

JMeter sends requests in the order that you add them to the tree. Start by adding the first LDAP Request to the LDAP Users element (Add → Sampler → LDAP Request). Then, select the LDAP Request element in the tree and edit the following properties
JMeter按照你在树中添加他们的顺序发送请求,首先添加地一个LDAP请求到LDAP Users元素(Add → Sampler → LDAP Request)。然后在树中选中LDAP Request元素,并编辑下面的属性。

  • Rename to “Add” this element
  • 将这个元素重命名为“Add”
  • Select the Add Test radio button in Test Configuration group
  • 在Test Configuration中选中Add Test单选按钮

这里写图片描述
Figure 8a.4.1 LDAP Request for Inbuilt Add test

You do not have to set the Servername field, port field, Username, Password and DN because you already specified this value in the Login Config Element and LDAP Request Defaults.
你不必设置Servername字段,port字段,Username,Password和DN,因为你已经在Login Config Element和LDAP Request Defaults中指定这些值。

Next, add the second LDAP Request and edit the following properties
接下来,添加第二个LDAP Request并编辑下面的属性

  • Rename to “Search” this element
  • 重命名这个元素为“Search”
  • Select the Search Test radio button in Test Configuration group
  • 在Test Configuration中选中Search Test单选框

Next, add the Third LDAP Request and edit the following properties
这里写图片描述
Figure 8a.4.2 LDAP Request for Inbuilt Search test

  • Rename to “Modify” this element
  • 重命名这个元素为“Modify”
  • Select the Modify Test radio button in Test Configuration group
  • 在Test Configuration中选中Modify Test单选按钮

Next, add the fourth LDAP Request and edit the following properties
接下来,添加第四个LDAP Request,并编辑下面属性
这里写图片描述
Figure 8a.4.3 LDAP Request for Inbuilt Modify test

  • Rename to “Delete” this element
  • 重命名这个元素为“Delete”
  • Select the Delete Test radio button in Test Configuration group
  • 在Test Configuration中选中Delete Test单选按钮

这里写图片描述
Figure 8a.4.4 LDAP Request for Inbuilt Delete test

8a.5 添加响应断言

You can add a Response Assertion element. This element will check the received response data by verifying if the response text is “successful”. (Add → Assertion → Response Assertion).
你可以添加一个响应断言元素,断言将会检查收到响应数据,校验响应文本是否是“successful”(Add → Assertion → Response Assertion)。

Note: A this position in the tree, the Response Assertion will be executed for each LDAP Request.
注意:在树中的这个位置,响应断言将会被每个LDAP请求执行。

  • Select Text Response Radio button in Response Field to Test group
  • 在Response Field to Test中选中Text Response单选按钮
  • Select Substring Radio button in Pattern Matching Rules group
  • 在Pattern Matching Rules中选中Substring单选按钮
  • Click on Add button and add the string “successful” in Pattern to Test field
  • 在Pattern to Test field中点击添加按钮,并添加字符串“successful”

这里写图片描述
Figure 8a.5 LDAP Response Assertion

8a.6 添加监听器查看保存测试结果

The final element you need to add to your Test Plan is a Listener. This element is responsible for storing all of the results of your LDAP requests in a file and presenting a visual model of the data. Select the LDAP Users element and add a View Results in Table (Add → Listener → View Results in Table)
最后你需要添加到你的测试计划的元素是监听器,这个元素负责保存你所有的LDAP请求结果到文件,并展示数据的可视化模型,选中LDAP Users元素并添加一个View Results in Table(Add → Listener → View Results in Table)。
这里写图片描述
Figure 8a.6 View Results in Table Listener

原创粉丝点击