在测试时,我们可以根据文本检查点判断事务是否执行正确。
我们在启动流程时,成功返回:
我们检查这个响应结果是否有。
int i=0;
i=web_reg_find("Text=\":1,\"",   
        "Search=Body",    
        LAST);
web_submit_data("startFlow.ht",   
        "Action=http://192.168.1.154:8080/bpmhac/platform/bpm/task/startFlow.ht",    
        "Method=POST",    
        "RecContentType=text/html",    
        "Referer=http://192.168.1.154:8080/bpmhac/platform/bpm/task/startFlowForm.ht?defId=10000027300066",    
        "Snapshot=t235.inf",    
        "Mode=HTTP",    
        ITEMDATA,    
        "Name=actDefId", "Value=csqdxn:1:10000027300065", ENDITEM,    
        "Name=defId", "Value=10000027300066", ENDITEM,    
        "Name=businessKey", "Value=", ENDITEM,    
        "Name=runId", "Value=0", ENDITEM,    
        "Name=startNode", "Value=", ENDITEM,    
        "Name=m:jdbcs:xm", "Value=a", ENDITEM,    
        "Name=m:jdbcs:bianma", "Value=", ENDITEM,    
        "Name=formKey", "Value=10000027300052", ENDITEM,    
        "Name=formData", "Value={\"main\":{\"fields\":{\"xm\":\"a\",\"bianma\":\"\"}},\"sub\":[],\"opinion\":[]}", ENDITEM,    
        LAST);    
if(i==0){   
lr_end_transaction("startFlow", LR_PASS);    
}    
else{    
lr_end_transaction("startFlow", LR_FAIL);    
}    
这个代码根据响应判断事务是否成功。
在vuser_gen下这个执行是正确的。
但是在controller下并发执行,发现出现事务错误。
在服务端调试时并没有发现启动流程有报错记录。
在通过问老师,老师让我去打印一下相应的情况,看看日志结果。
代码改成如下:
使用关联,左右边界都为空。
打印响应的内容。
通过打印日志,发现:
Action.c(10): web_set_max_html_param_len was successful   [MsgId: MMSG-26392]   
Action.c(19): Registering web_reg_save_param_ex was successful   [MsgId: MMSG-26390]    
Action.c(28): Redirecting "http://192.168.1.154:8080/bpmhac/platform/bpm/task/startFlow.ht" (redirection depth is 0)   [MsgId: MMSG-26694]    
Action.c(28): To location "http://192.168.1.154:8080/bpmhac/loginRedirect.ht"   [MsgId: MMSG-26693]    
Action.c(28): Redirecting "http://192.168.1.154:8080/bpmhac/loginRedirect.ht" (redirection depth is 1)   [MsgId: MMSG-26694]    
Action.c(28): To location "http://192.168.1.154:8080/bpmhac/loginRedirect.ht"   [MsgId: MMSG-26693]    
Action.c(28): Redirecting "http://192.168.1.154:8080/bpmhac/loginRedirect.ht" (redirection depth is 2)   [MsgId: MMSG-26694]    
Action.c(28): To location "http://192.168.1.154:8080/bpmhac/login.jsp"   [MsgId: MMSG-26693]    
Action.c(28): web_submit_data("startFlow.ht") was successful, 3124 body bytes, 1072 header bytes   [MsgId: MMSG-26386]    
Action.c(47): output:HTTP/1.1 302 Found     
Server: Apache-Coyote/1.1      
Cache-Control: no-cache      
Pragma: no-cache      
Expires: Wed, 31 Dec 1969 23:59:59 GMT      
Location: http://192.168.1.154:8080/bpmhac/loginRedirect.ht      
Content-Type: text/html;charset=UTF-8      
Content-Length: 0      
Date: Fri, 23 Jan 2015 09:24:47 GMT
发现启动流程时,发生了登录跳转。
结合服务器查看,终于找到问题的原因,因为在录制脚本是,都统一使用同一个用户进行登录,服务端有配置了单一用户登录。
意思就是同一个用户,一个时间点只能登录一次,去掉这个限制,再重新测试,结果终于正常了。
原文:http://www.cnblogs.com/yg_zhang/p/4245158.html