VSTS LoadTest使用原则

 

1、强烈建议先读Web 测试的创作与调试技术这篇文章,http://www.microsoft.com/china/msdn/library/webservices/WebApp/dnvs05WTAuthDebug.mspx?mfr=true

在负载测试时,确保负载测试调用的测试都运行通过,例如数据绑定的,能够通过所有的数据值

2、选择合适的负载方案

1)        恒负载测试

小心使用大用户数的,在负载测试中不对服务器做不合理的和不合实际的要求

例如,一个负载测试包含一个请求首页的Web测试,你设置用户为1000,那么测试时会立马提交1000个请求给首页,这个就不是模仿真实世界,除非受到攻击

为了减轻这个,使用逐步增加到1000,或是指定一个热身的周期,指定了热身时期,在这个时间内用户数将逐渐增加到负载

2)        步进式

例如使用一个增加到2000用户的负载测试,应该运行一个10小时的负载模式

 

初始用户数:100

最大用户数:2000

持续时间:1800

每步间隔时间:20秒,也就是每秒增加5个用户

每步增加用户数:100

 

这样设置,在30分钟用户逐渐从100200300直至增加到2000

每步间隔时间需要指出:不在向导中设置

3)        基于目标的

当你希望知道到达某一资源水平时你的系统能够支持用户数,可以使用此模式

SQL Express最大支持4G的硬盘空间,当你大量运行负载测试,多少个用户时数据库服务器的CPU接近为75%

%Processor Time”设置为70%----80%

另外,如果还有其他资源的限制,目标是不能达到的,而用户会一直增加到你指定的最大用户

要有一个大约的最大用户值,一次约束用户的负荷

3、选择负载测试结果的存储位置

默认数据库实例是SQLExpressSQLExpress最大是4G磁盘存储

如果结果存储过大,要考虑使用另一个更大存储的实例

4、增加采样间隔

选择一个合适的“Sample Rate”值

一个更小的“Sample Rate”比如默认的是5秒,在存储结果时需要更多的空间,下面是一个“Sample Rate”的指导:

Load Test Duration Recommended Sample Rate

      < 1 Hour                   5 seconds

    1 - 8 Hours                 15 seconds

   8 - 24 Hours                 30 seconds

     > 24 Hours                 60 seconds

5、考虑包含Timing Detail来收集百分比数据

"Timing Details Storage".

如果设置为可用,则执行每个单个测试,事务和页面都会存储结果

允许90%95%显示在测试分析中的测试,事务和页面表

存储结果会很大,特别是长时间运行

同时,存储的时间在执行完成,需要收集测试代理机的数据

因此"Timing Details Storage". 默认是不可用的

如果有足够的空间允许,可以在设置属性中有2个选项: "StatisticsOnly" and "AllIndividualDetails".

all of the individual tests, pages, and transactions are timed, and percentile data is calculated from the individual timing data.

The difference is that with the StatisticsOnly option, once the percentile data has been calculated, the individual timing data is deleted from the repository

6、不要过载代理机

7Consideration for Load Tests that contain Web Tests

8Choose the Appropriate Connection Pool Model

ConnectionPerUser

ConnectionPool

9Consider setting response time goals for web test requests

响应时间是整个页面的,显示少于目标值的百分比

10Consider setting timeouts for web test requests

如果不响应,那么测试不完成,也不会报错

11Choose a value for the “Percentage of New Users” property

默认为100%,表示都是新用户第一次使用

12Consider setting the “ParseDependentRequests” property of your web test requests to false

13Advanced Load Testing Features of Visual Studio Team System

http://blogs.msdn.com/billbar/articles/517081.aspx

14Implementing sync points in VSTS load tests

http://blogs.msdn.com/billbar/articles/528649.aspx

15Content Index for Web Tests and Load Tests

http://blogs.msdn.com/edglas/pages/content-index-for-web-tests-and-load-tests.aspx

16Diagnosing and fixing Web Test recorder bar issues

http://blogs.msdn.com/mtaute/archive/2007/11/09/diagnosing-and-fixing-web-test-recorder-bar-issues.aspx

OscarXie.net

关注质量与体验——电子商务与自动化测试
http://www.cnblogs.com/oscarxie/

原文地址:https://www.cnblogs.com/oscarxie/p/1086987.html