概述: LoadRunner测试方法手册从测试流程,测试过程,测试文档输入输出等各个方面描述,可以称为性能测试方法手册,我们目前使用的测试工具LoadRunner满足我们测试的需求,本文主要结合LoadRunner工具来描述性能测试方法.
性能测试需求分析
性能测试需求是由产品提出,客户沟通,或者依据业界标准来获取,首先目前测试现状来看,性能需求都会有,但不会很明确.通过沟通讨论来逐步将客户(或者开发)性能需求转换为测试性能需求,如上图测试过程中的
<!--[if !supportLists]-->1. <!--[endif]-->确定测试环境Identify Test Environment
<!--[if !supportLists]-->2. <!--[endif]-->确定性能可接收标准
性能测试设计Plan and Design Tests
性能测试设计先总体来描述,编写性能测试方案,必须包括如下方面:
<!--[if !supportLists]-->1. <!--[endif]-->测试用机和测试软件LoadRunner的部署
<!--[if !supportLists]-->2. <!--[endif]-->分析测试用机对本性能测试设计是否存在影响
<!--[if !supportLists]-->3. <!--[endif]-->被测Web应用服务器的部署
<!--[if !supportLists]-->4. <!--[endif]-->描述测试和被测服务器的网络TOPO
<!--[if !supportLists]-->5. <!--[endif]-->分析描述网络TOPO可能对本测试设计存在的影响
<!--[if !supportLists]-->6. <!--[endif]-->性能测试可接收标准(从性能测试需求分析得到)
<!--[if !supportLists]-->7. <!--[endif]-->性能测试用例设计
<!--[if !supportLists]-->a) <!--[endif]-->测试目的
<!--[if !supportLists]-->b) <!--[endif]-->性能测试输入
<!--[if !supportLists]-->c) <!--[endif]-->数据及数据流向
<!--[if !supportLists]-->d) <!--[endif]-->性能测试操作过程
<!--[if !supportLists]-->e) <!--[endif]-->LoadRunner中的Init Action中初始化功能
<!--[if !supportLists]-->f) <!--[endif]-->LoadRunner中的集合点处理
<!--[if !supportLists]-->g) <!--[endif]-->Loadrunner中的虚拟用户并发量
<!--[if !supportLists]-->h) <!--[endif]-->LoadRunner中的End Action中清理功能
<!--[if !supportLists]-->i) <!--[endif]-->性能测试输出
<!--[if !supportLists]-->8. <!--[endif]-->LoadRunner性能测试场景设计
<!--[if !supportLists]-->a) <!--[endif]-->Manual模式
非Web用户只能使用Manual模式,
场景设计要包括多少虚拟用户,虚拟用户启动过程,虚拟用户停止过程,虚拟用户运行时间;是否使用IP地址池等
<!--[if !supportLists]-->b) <!--[endif]-->Goal模式
Web用户分虚拟用户数目标,Hits/Second目标, Pages目标,Transactions数(TransAction需要指定)
<!--[if !supportLists]-->9. <!--[endif]-->LoadRunner参数设置
<!--[if !supportLists]-->10. <!--[endif]-->被测试软件监控和日志分析设计
性能测试功能实现
<!--[if !supportLists]-->1. <!--[endif]-->测试环境配置
<!--[if !supportLists]-->2. <!--[endif]-->LoadRunner测试设计实现
LoadRunner性能测试的文档在公网上非常多,帮助手册也很全面,就不再重点描述
<!--[if !supportLists]-->1. <!--[endif]-->录制代码需要删除和本次测试无关的任务语句
<!--[if !supportLists]-->2. <!--[endif]-->调试代码可以编写,但正式执行前必须注销,特别是Output Message类型的命令
<!--[if !supportLists]-->3. <!--[endif]-->明确Web测试模式Html和Http的区别,按照设计来制定
<!--[if !supportLists]-->4. <!--[endif]-->对动态捕获的数据进行判断
比如web_reg_add_cookie, web_reg_save_param等函数
需要判断”查询”是否注册成功,判断是否取回了数据,判断取回的数据类型是否满足预期,减少实际运行时出现异常.
性能测试执行和分析
<!--[if !supportLists]-->1. <!--[endif]-->按照性能测试Case执行
<!--[if !supportLists]-->2. <!--[endif]-->保存LoadRunner测试结果
<!--[if !supportLists]-->3. <!--[endif]-->使用Windows性能监控或者Loadrunner来记录Web站点的各个性能计数器
<!--[if !supportLists]-->4. <!--[endif]-->记录Windows资源的性能计数器,包括CPU,内存,硬盘,网络
<!--[if !supportLists]-->5. <!--[endif]-->记录CLR的性能计数器
<!--[if !supportLists]-->6. <!--[endif]-->记录数据库(MSSQL)的性能计数器等
性能测试报告
<!--[if !supportLists]-->1. <!--[endif]-->编写各个测试用例的测试结论
<!--[if !supportLists]-->2. <!--[endif]-->分析和确认目前产品中的性能瓶颈
<!--[if !supportLists]-->3. <!--[endif]-->记录显示测试过程和测试原始数据
<!--[if !supportLists]-->4. <!--[endif]-->性能测试优化建议
性能测试迭代测试
性能测试应该是一个迭代的过程,测试发现和定位性能瓶颈,根据问题原因修改系统配置或者代码,修改后应用原来的测试环境和手段,再次测试,验证问题是否解决,配置是否生效,对性能值各个方面比较,检测是否真正优化.
性能测试持续迭代测试到满足性能需求为止.
如存在理解错误和问题,欢迎探讨cmmdy@hotmail.com