Jmeter- Building a Web test plan(1)

因为我接触的项目是Web的,所以优先从创建一个web test plan入手。

官方教程地址:

http://jmeter.apache.org/usermanual/build-web-test-plan.html

In this section, we will learn how to create a basic Test plan to test a web site. You will create five users that send requests to two pages on the  Jmeter Web site. Also, you will tell the user to run their tests twice. So, the total number of requests is (5 users)*(2 requests)*(repeat 2 times)=20 HTTP requests. To construct the Test Plan, you will use the following elements: Thread Group, HTTP Request, HTTP Request Defaults, and Graph Results.

1. Adding users

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.

Go ahead and add the Thread Group 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.

Next, you need to modify the default properties. Select the Thread Group element in the tree, if you have not already selected it. You should now see the Thread Group Control Panel in the right section of the JMeter window.

Start by providing a more descriptive name for our Thread Group. In the name field, enter Jmeter Users.

Next, increse the number of users (called threads) to 5.

In the next field, the Ramp-up Period, leave the default value of 1 seconds. This property tells Jmeter how long to delay between starting each user. For example, if you enter a Ramp-up Period of 5 seconds, Jmeter will finish starting all of your users by the end of the 5 seconds. So, if we have 5 users and a 5 second Ramp-up Period, then the delay between starting users would be 1 second ( 5 users/ 5 seconds = 1 user per second). If you set the value to 0, then Jmeter will immediately start all of your users.

Finally enter a value of 2 in the loop count field. This prepertly telss Jmeter hwo many times to repeat your test. If you enter a loop count value of 1, then JMeter will run your test only once. To have JMeter repeatly run your Test Plan, select the Forver checkbox.

note: in most applications, you have to manually accept changes you make in a Control Panel. However, in JMeter, the control panel automatically accepts your changes as you make them. If you change the name of an element, the tree will be updated with the new text after you leave the Control Panel( for example, when selecting another tree element).

See below Figure for the completed JMeter Users Thread Group.

2. Adding Default HTTP Request Properties

Now that we have defined our users, it is time to define the tasks that they will be performing. In this section, you will specify the default settings for your HTTP requests. And then, in next section, you will add HTTP Request elements which use some of the default settings you sepcified here.

Begin by selecting the Jmeter users( Thread Group) element. Click your right mouse button to get the Add menu, and then select Add- -> Config Element --> HTTP Request Defaults. Then, select this new element to view its Control Panel.

Like most JMeter elements, the HTTP Request Defaults Control Panel has a name field that you c an modify. In this example, leave this field with the default value.

Skip to the next field, which is the Web Server Name/IP. For the Test Plan that you are building, all HTTP requests will be sent to the same Web server, jmeter.apache.org. Enter this domain name into the field. This is the only field that we will specifiy a default, so leave the remaining fields with their default values.

note: The HTTP Request Defaults element does not tell JMeter to send an HTTP request. It simply defines the default values that the HTTP Request elements use.

时间: 2024-10-13 00:24:22

Jmeter- Building a Web test plan(1)的相关文章

JMeter-Building an Advanced Web Test Plan

1. Handling User Sessions With URL Rewriting If your web application uses URL rewriting rather than cookies to save session information, then you'll need to do a bit of extra work to test your site. To respond correctly to URL rewriting, JMeter needs

jmeter 构建一个Web测试计划

添加用户 第一步你想做的每一个JMeter测试计划是添加一个 线程组 元素. 线程组告诉 JMeter的用户数量你想模拟,用户应该发送的次数 请求,请求他们应该送多少. 继续添加ThreadGroup元素首先选择测试计划, 点击你的鼠标右键添加菜单,然后选择 添加一个??ThreadGroup. 您现在应该看到测试计划下的线程组元素. 如果你不 看到的元素,那么“扩大”点击测试计划树 测试计划的元素. 接下来,您需要修改默认属性. 选择线程组元素 在树上,如果您还没有选择它. 您现在应该看到线程

BadBoy+JMeter来录制Web测试脚本

参考: http://jingyan.baidu.com/article/5d368d1ef548d43f61c05761.html 1.简介 JMeter是纯Java编写的软件功能和性能测试工具,其录制脚本过于笨拙和复杂. 而Badboy是用C++开发的动态应用测试工具,其拥有强大的屏幕录制和回放功能,同时提供图形结果分析功能,刚好弥补了JMeter的不足之处.同时Badboy录制的脚本可导出为JMeter支持的jmx格式脚本. 因此这里的web测试结合这两个工具来完成. 2.下载. http

三:搭建一个Web Test Plan

参考:http://jmeter.apache.org/usermanual/build-web-test-plan.html 场景 5个用户并发测试百度搜索,有两个请求,一个请求搜索"你好",一个请求搜索"helloworld". 配置用户 添加线程组. 在Test Plan 上右键,添加Thread Group. 设定如下:5个用户并发访问系统,1秒内准备好用户,每个用户访问循环2次. 添加配置元件 由于我们有多个相同的请求,所以我们可以直接添加一个HTTP 配

Jmeter实现简单web负载测试

简介 Apache JMeter是Apache组织开发的基于Java的压力测试工具.用于对软件做压力测试,它最初被设计用于Web应用测试,但后来扩展到其他测试领域.它可以用于测试静态和动态资源例如静态文件.Java 小服务程序.CGI 脚本.Java 对象.数据库, FTP 服务器, 等等. 安装 上面的文字提到 Jmeter是基于Java进行开发的,所以理论上我们可以运行于任何安装有Java的平台上,而事实也确实如此,我们就大概说一下安装步骤. · 安装Java环境,这一步我们就不做过多解释了

SPRING IN ACTION 第4版笔记-第五章BUILDING SPRING WEB APPLICATIONS-003-示例项目用到的类及配置文件

一.配置文件 1.由于它继承AbstractAnnotationConfigDispatcherServletInitializer,Servlet容器会把它当做配置文件 1 package spittr.config; 2 3 import org.springframework.web.servlet.support.AbstractAnnotationConfigDispatcherServletInitializer; 4 5 import spittr.web.WebConfig; 6

jmeter性能测试实战-web登录测试

一.项目背景: 网站信息: 操作系统类型 二.需求: 登录并发测试 三.场景: 1s增加两个线程,运行2000次 分别看20.40.60并发下的表现 四.监控: 成功率.响应时间.标准差.cpu.mem.io等 在服务器所在操作系统中部署serverAgent 五.步骤 badboy录制(或jmeter录制) 导入jmeter 参数化.检查点.集合点 指标监控,资源监控 生成报告(保存到本地,后缀为.jtl,也可生成.xls文件)

SPRING IN ACTION 第4版笔记-第五章BUILDING SPRING WEB APPLICATIONS-002-Controller的requestMapping、model

一.RequestMapping 1.可以写在方法上或类上,且值可以是数组 1 package spittr.web; 2 3 import static org.springframework.web.bind.annotation.RequestMethod.*; 4 5 import org.springframework.stereotype.Controller; 6 import org.springframework.ui.Model; 7 import org.springfra

创建一个web Test Plan

1.添加ThreadGroup (1).线程组界面解析: 线程数:虚拟用户的个数 Ramp-up Period:开启每个用户的延迟时间,如果有5个虚拟用户,Ramp-up Period值是5,Jmeter将会在5分钟之内开启全部的用户,开启每个用户的延迟时间是:5 users/5 seconds=1 user per second;如果值是0,JMeter将会立刻开启你的所有用户 循环次数:表示Jmeter循环这个test多少次.