Microsoft Application Center Test是一个基于软件的能够对Web服务器产生负载的压力测试工具。可以通过查看性能报告分析和诊断性能问题,并且判断出Web应该程序的性能极限。还可以用ACT针对Web应用程序通过录制或手工创建测试脚本的方法来得到测试脚本。这些脚本可以根据某种用户场景模拟出许多浏览器同时访问某些页面的情景。但是其对于测试场景以及测试结果分析比较的简单,与lr测试工具相差比较远。由于简单,比较容易上手,如果不需要比较复杂的并发用户数以及对于测试结果分析要求不是很高选择act还是不错的。
1、运行场景中可以设置代理服务器,在工程的属性窗口中;
2、设置日志,同样也在工程的属性窗口,并且可以设置日志保存的位置,默认在C:\Program Files\Microsoft ACT\ACTTrace.log,但在必须将测试脚本中的Test.TraceLevel属性;
3、可以设置压力系数,如10 connections,在test的属性窗口中;
4、对于测试周期有两种方式,一种是运行时间设置,另外一种是运行周期设置,同样的test的属性窗口中;
附本人常的测试代码:
option explicit
Dim fEnableDelays '是否进行sleep
fEnableDelays = False
dim lngSleep '进行sleep的时间
lngSleep = 0
dim strHostName '进行连接的机器名
strHostName = "192.168.115.1"
dim strFilePath '文件位置
strFilePath = "/test/index.aspx"
sub sendRequest()
dim oConnection,oRequest,oResponse,oHeaders,strStatusCode
if fEnableDelays = true then test.sleep(lngSleep)
set oConnection = Test.CreateConnection(strHostName, 80)
if (oConnection is nothing ) then
Test.Trace("Error: unable to create connection")
else
set oRequest = Test.CreateRequest
oRequest.Path = strFilePath
oRequest.Verb = "GET"
oRequest.HTTPVersion = "HTTP/1.1"
set oHeaders = oRequest.Headers
oHeaders.RemoveAll
oHeaders.Add "Accept", "image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, application/x-shockwave-flash, */*"
oHeaders.Add "Accept-Language", "zh-cn"
oHeaders.Add "Cookie", "(automatic)"
oHeaders.Add "User-Agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322)"
oHeaders.Add "Host", "(automatic)"
oHeaders.Add "Cookie", "(automatic)"
set oResponse = oConnection.Send(oRequest)
if (oResponse is nothing ) then
Test.Trace "Error:failed to Receive for url to" + strFilePath
else
strStatusCode = oResponse.ResultCode
end if
oConnection.close
end if
end sub
Sub Main()
'Test.TraceLevel = -1
dim i
'for i = 0 to 10
call SendRequest()
'next
end sub
main
浙公网安备 33010602011771号