在測試時,我們可以根據文本檢查點判斷事務是否執行正確。
我們在啟動流程時,成功返回:
我們檢查這個響應結果是否有。
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
發現啟動流程時,發生了登錄跳轉。
結合服務器查看,終於找到問題的原因,因為在錄制腳本是,都統一使用同一個用戶進行登錄,服務端有配置了單一用戶登錄。
意思就是同一個用戶,一個時間點只能登錄一次,去掉這個限制,再重新測試,結果終於正常了。