|
大家先看看这个脚本。
执行此脚本,一个用户就可以通过for循环把要完成的任务全部完成。
如果要实现并发,就要用contorller。假设并发10个,那么这10个用户是如何分配的呢~!
#include "web_api.h"
shelldialog()
{
int count,i;
char reqid1[256];
char flowid[256];
char reqid;
char bufferflow;
/*计算usertasks首页reqId的总数*/
count=atoi(lr_eval_string("{req_id_count}"));
lr_output_message("count=%d",count);
/*循环执行shell交互,输入111*/
for(i=1;i<=count;i++)
{
/*存储req_id的各个元素到reqid1中,根据conut值计算存储的次数*/
sprintf(reqid1,"{req_id_%d}",i);
sprintf(flowid,"{flow_id_%d}",i);
lr_message("%s %s",lr_eval_string(reqid1),lr_eval_string(flowid));
/*将reqid1的值赋给reqid,并在下面是用reqid进行参数化*/
lr_save_string(lr_eval_string(reqid1),"reqid");
lr_save_string(lr_eval_string(flowid),"bufferflow");
web_url("shellWindow.do",
"URL=http://192.168.0.135:8888/usertasks/shellWindow.do?reqId={reqid}&flowId={bufferflow}&actId=1&flowInsName=qqqflowInsName&actName=ShellCmdactName",
"Resource=0",
"RecContentType=text/html",
"Referer=",
"Snapshot=t4.inf",
"Mode=HTML",
LAST);
web_url("style.css",
"URL=http://192.168.0.135:8888/usertasks/css/style.css",
"Resource=1",
"RecContentType=text/css",
"Referer=http://192.168.0.135:8888/usertasks/shellWindow.do?reqId={reqid}&flowId={bufferflow}&actId=1&flowInsName=qqqflowInsName&actName=ShellCmdactName",
LAST);
web_url("tab.css",
"URL=http://192.168.0.135:8888/usertasks/css/tab.css",
"Resource=1",
"RecContentType=text/css",
"Referer=http://192.168.0.135:8888/usertasks/shellWindow.do?reqId={reqid}&flowId={bufferflow}&actId=1&flowInsName=qqqflowInsName&actName=ShellCmdactName",
LAST);
web_url("iconErrors.gif",
"URL=http://192.168.0.135:8888/usertasks/images/iconErrors.gif",
"Resource=1",
"RecContentType=image/gif",
"Referer=http://192.168.0.135:8888/usertasks/shellWindow.do?reqId={reqid}&flowId={bufferflow}&actId=1&flowInsName=qqqflowInsName&actName=ShellCmdactName",
LAST);
web_url("btnLong.gif",
"URL=http://192.168.0.135:8888/usertasks/images/btnLong.gif",
"Resource=1",
"RecContentType=image/gif",
"Referer=http://192.168.0.135:8888/usertasks/shellWindow.do?reqId={reqid}&flowId={bufferflow}&actId=1&flowInsName=qqqflowInsName&actName=ShellCmdactName",
LAST);
web_custom_request("freshConsole.do",
"URL=http://192.168.0.135:8888/usertasks/freshConsole.do?reqId={reqid}&flowId={bufferflow}&outLine=0&errLine=0&allLine=100&stdLastLine=0&errLastLine=0",
"Method=POST",
"Resource=0",
"RecContentType=text/html",
"Referer=http://192.168.0.135:8888/usertasks/shellWindow.do?reqId={reqid}&flowId={bufferflow}&actId=1&flowInsName=qqqflowInsName&actName=ShellCmdactName",
"Snapshot=t5.inf",
"Mode=HTML",
"EncType=",
LAST);
web_custom_request("freshConsole.do_2",
"URL=http://192.168.0.135:8888/usertasks/freshConsole.do?reqId={reqid}&flowId={bufferflow}&outLine=0&errLine=0&allLine=100&stdLastLine=-1&errLastLine=-1",
"Method=POST",
"Resource=0",
"RecContentType=text/html",
"Referer=http://192.168.0.135:8888/usertasks/shellWindow.do?reqId={reqid}&flowId={bufferflow}&actId=1&flowInsName=qqqflowInsName&actName=ShellCmdactName",
"Snapshot=t6.inf",
"Mode=HTML",
"EncType=",
LAST);
web_custom_request("freshConsole.do_3",
"URL=http://192.168.0.135:8888/usertasks/freshConsole.do?reqId={reqid}&flowId={bufferflow}&outLine=0&errLine=0&allLine=100&input=111&stdLastLine=-1&errLastLine=-1",
"Method=POST",
"Resource=0",
"RecContentType=text/html",
"Referer=http://192.168.0.135:8888/usertasks/shellWindow.do?reqId={reqid}&flowId={bufferflow}&actId=1&flowInsName=qqqflowInsName&actName=ShellCmdactName",
"Snapshot=t7.inf",
"Mode=HTML",
"EncType=",
LAST);
}
//i++;
return 0;
} |
|