51Testing软件测试论坛

标题: 有人用LR录制过测试QC9.2的脚本么? [打印本页]

作者: stone0214    时间: 2007-12-25 20:03
标题: 有人用LR录制过测试QC9.2的脚本么?
情况是这样的...  我现在需要做个针对QC9.2压力测试的脚本..  录制和脚本生成部分都很顺利,但是在回放的时候出现了以下问题..(安全起见,替换了部分URL为"*")

Action.c(42): Error -26628: HTTP Status-Code=403 (Forbidden) for "http://www.***.com/qcbin/servlet/tdservlet/TDAPI_GeneralWebTreatment"          [MsgId: MERR-26628]
Action.c(42): web_custom_request("TDAPI_GeneralWebTreatment") highest severity level was "ERROR", 962 body bytes, 324 header bytes          [MsgId: MMSG-26388]

遇到这样的情况我第一影像是关联没有做好...立即扫描,没能找到关联..于是我在打开自动关联的情况下(enable correlation during recording)又录了一次..脚本之中仍然没有关联.但是我却惊奇的发现,两次录制下来的脚本是一模一样的..(因此我在怀疑到底是否是关联而导致的错误了)

以下部分为脚本
        lr_start_transaction("1010_HOME");

        web_reg_find("Text=HP Quality Center 9.2",
                LAST);

        web_url("start_a.htm",
                "URL=http://www.***.com/qcbin/start_a.htm",
                "TargetFrame=",
                "Resource=0",
                "RecContentType=text/html",
                "Referer=",
                "Snapshot=t1.inf",
                "Mode=HTML",
                EXTRARES,
                "URL=servlet/tdservlet?method=ListExtensionFolder", ENDITEM,
                "URL=setup_a.cab", ENDITEM,
                LAST);

        lr_end_transaction("1010_HOME", LR_AUTO);

         lr_think_time(10);

        lr_start_transaction("1020_LOGIN_PAGE");

        web_custom_request("tdservlet",
                "URL=http://www.***.com/qcbin/servlet/tdservlet",
                "Method=GET",
                "TargetFrame=",
                "Resource=0",
                "RecContentType=text/html",
                "Referer=",
                "Snapshot=t2.inf",
                "Mode=HTML",
                LAST);
       
        web_custom_request("TDAPI_GeneralWebTreatment",
                "URL=http://www.***.com/qcbin/servlet/tdservlet/TDAPI_GeneralWebTreatment",
                "Method=POST",
                "TargetFrame=",
                "Resource=0",
                "RecContentType=application/octet-stream",
                "Referer=",
                "Snapshot=t3.inf",
                "Mode=HTML",
                "EncType=text/html; charset=UTF-8",
                "BodyBinary={\r\n"
                "0: \"0:conststr: Login\",\r\n"
                "1: \"0:int:2\",\r\n"
                "2: \"0:int:-1\",\r\n"
                "3: \"0:int:-1\",\r\n"
                "4: \\x5C00000045\\x5C0:conststr: {\r\n"
                "USER_NAME:{UID},\r\n"
                " PASSWORD:{PASSWORD},\r\n"
                "CLIENTTYPE:OTAClient\r\n"
                "}\r\n"
                ",\r\n"
                "5: \\x5C00000013\\x5C0:conststr:{Hostname},\r\n"
                "6: \"65536:str:0\",\r\n"
                "7: \"0:pint:0\",\r\n"
                "8: \"0:pint:0\",\r\n"
                "9: \"0:pint:0\"\r\n"
                "}\r\n",
                LAST);

        lr_end_transaction("1020_LOGIN_PAGE", LR_AUTO);

当脚本跑到请求TDAPI_GeneralWebTreatment页面的时候就会提示上面的错误....

个人人为TDAPI_GeneralWebTreatment里面的以下东西中可能存在关联..               
"0: \"0:conststr: Login\",\r\n"
"1: \"0:int:2\",\r\n"
"2: \"0:int:-1\",\r\n"
"3: \"0:int:-1\",\r\n"
"4: \\x5C00000045\\x5C0:conststr:{\r\n"
" USER_NAME:{UID},\r\n"
" PASSWORD:{PASSWORD},\r\n"
"CLIENTTYPE:OTAClient\r\n"
"}\r\n"
",\r\n"
"5: \\x5C00000013\\x5C0:conststr:{Hostname},\r\n"
"6: \"65536:str:0\",\r\n"
"7: \"0:pint:0\",\r\n"
"8: \"0:pint:0\",\r\n"
"9: \"0:pint:0\"\r\n"
"}\r\n",

于是我查看了前面两个页面的server response..  无奈.. 找不到任何相关的信息...

以下为LR版本信息

Product Name: Mercury LoadRunner 8.1  
Product Version: 8.1.0.0  
Product Build: 1735

Installed Patches:
Patch Name  
LR81P126

有高手能帮给我点建议么?
脚本实在通不了
谢谢了...

[ 本帖最后由 stone0214 于 2007-12-25 20:10 编辑 ]
作者: stone0214    时间: 2007-12-25 20:13
Header:
------------------------------------------
HTTP/1.1 200 OK
Date: Tue, 25 Dec 2007 08:40:53 GMT
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET
X-Powered-By: Servlet 2.4; JBoss-4.0.2 (build: CVSTag=JBoss_4_0_2 date=200505022023)/Tomcat-5.5
Content-Type: text/html;charset=ISO-8859-1
Transfer-encoding: chunked
Proxy-Connection: Keep-Alive
Connection: Keep-Alive
Age: 0


Body:
------------------------------------------
<font color="green">
<p>Quality Center - servlet is up and running!</p>
</font>

这是第二个页面的server response
作者: stone0214    时间: 2007-12-25 21:06
说明下...  如果注释掉
"6: \"65536:str:0\",\r\n"
就不会返回403错误了,但是脚本虽然跑通了但是application上面并没有做预期当中的事...  应该还是有关联没做好...
作者: tails82    时间: 2007-12-25 23:47
关联不了的,我也试了下,也不知道Mercury做了什么手脚,估计是故意防止用LR这种方法来恶意攻击服务器吧
作者: stone0214    时间: 2007-12-26 10:45
有高手帮忙看看么?
作者: whatkevin    时间: 2007-12-26 17:13
不眠夜啊。。。。。。。。。
作者: msnshow    时间: 2007-12-26 17:40
录制多一次,对比一下脚本就知道需不需要关联了!
作者: stone0214    时间: 2007-12-26 17:45
两次返回一模一样... 但是就是不行..  刚从HP拿到回复了,贴给大家看...
作者: stone0214    时间: 2007-12-26 17:45
HP Response

1) 403 Access forbidden error
The authentication check for QC must be disabled in order to loadtest it.
The authentication is made with X-TD-ID that are calculated and exchanged server-side and client-side for each communication, the ActiveX responsible for generating this X-TD-ID is not replayed with LoadRunner, therefore we should disable the authentication. Even with the authentication disabled, the server will keep calculating and sending these X-TD-ID thus insuring valid loadtest results.

If your QC implementation uses JBOSS under Windows

a) Open a DOS Command Prompt and navigate to "\jboss\bin" folder
b) adapt this command to your environment and run it
QCJavaService.exe -install "Mercury Quality Center for LoadTest" "\_jvm\jre\bin\client\jvm.dll" -Dprogram.name=run.bat -Djetty.port=8060 -Xms512m -Xmx1024m -XX:SurvivorRatio=10 -Djava.class.path=".;\_jvm\lib\tools.jar;\jboss\bin\run.jar"

-Dcom.mercury.td.http.authentication=false -start org.jboss.Main -stop org.jboss.Main -method systemExit -params %1 %2 -out

"\_jvm\..\InstallInfo\ServiceOut.txt"
c) for developing the script or loadtesting the QC server, you will need to
-go to control panel-administrative tools-service of the QC server
-stop the "Mercury Quality Center"
-start the "Mercury Quality Center for LoadTest"
d) once your load test is over, you can revert to the normal "Mercury Quality Center" service

If your QC implementation uses JBOSS under UNIX

a) edit the run.sh under <QC_INSTALL>/jboss/bin
b) modify the line that calls Java
"$JAVA" $JAVA_OPTS -Djava.endorsed.dirs="$JBOSS_ENDORSED_DIRS" -classpath "$JBOSS_CLASSPATH" org.jboss.Main "$@" > "$FILE_NAME" 2>&1 &
with
"$JAVA" $JAVA_OPTS -Djava.endorsed.dirs="$JBOSS_ENDORSED_DIRS" -Dcom.mercury.td.http.authentication=false -classpath "$JBOSS_CLASSPATH" org.jboss.Main "$@" > "$FILE_NAME" 2>&1 &
c) stop and restart QC

If your QC implementation uses websphere, there is a similar run file that should be modified similarly as for JBOSS under UNIX.

2) "The session authentication has failed"

When the LOGIN_SESSION_ID is not correlated. Usually it is returned from the first request
'web_custom_request("TDAPI_GeneralWebTreatment" '
and can be correlated this way
web_reg_save_param("WCSParam_Text1",
"LB=0:pint:",
"RB=\"",
"Ord=1",
"RelFrameId=1",
"Search=Body",
"IgnoreRedirections=Yes",
LAST);
作者: tails82    时间: 2007-12-27 14:35
到底是专业的回答啊~
作者: stone0214    时间: 2007-12-27 14:47
呵呵,感觉HP的人做事很专业...  刚提交上去case马上就指定给某个人来做来了...
作者: stone0214    时间: 2008-1-5 22:41
哎。。。  我把这测试做完了。。。  感觉Mercury的人很专业。。  做出来的QC(9。0版本以上)对于防范LR攻击的地方太多了。。

参数化不能设置(针对某一个项目和用户名),有防范LR的机制(帖子里面提到的),而且关联特别多。。。

光是一个登陆就有3个地方要关联
作者: JasonSei    时间: 2008-2-29 11:50
To stone0214.
太感谢了,我也正在做QC 9.2的Load Test,不过只是自己玩玩了, 这样就不用再专门部署一个其他的环境。
作者: JasonSei    时间: 2008-2-29 12:40
我遇到了一个比较怪的问题,当把Quality Center服务停掉后,然后启动Quality Center for Load Test 的服务时报错了,也就是说启动不了Quality Center for Load Test 这个服务,截图见附件。

我想启动Performance monitor and Alert服务也启动不了。
作者: joykao    时间: 2010-11-2 15:04
学到了哦。。。3Q




欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/) Powered by Discuz! X3.2