场景中运行脚本发现随机数是相同的
三个关联函数关联的数据OrderId_1="20131011024"
Register_1="476824"
GuestNum_1="2"
OrderId_2="20131011025"
RegisterId_2="476825"
GuestNum_2="1"
OrderId_3="20131011026"
RegisterId_3="476826"
GuestNum_3="3"
OrderId_4="20131011027"
RegisterId_4="476827"
GuestNum_4="0"
OrderId_5="20131011028"
RegisterId_5="476828"
GuestNum_5="1"
OrderId_5="201310110209"
RegisterId_5="476829"
GuestNum_5="1"
OrderId_5="20131011030"
RegisterId_5="476830"
GuestNum_5="1"
。。。。。
必须取GuestNum的值为0
写如下代码获取合适的值
srand(Time(NUll))
num=atoi(lr_eval_string("{GuestNum_count}"));
for(i=1;i<=num;i++){
randnum=rand()%num+1;
lr_error_message("%s",randnum);
sprintf(randGuestNum,"{GuestNum_%d}",randnum);
lr_save_string(lr_eval_string(randGuestNum),"wkGuestNum");
restult1=strcmp(lr_eval_string("{wkGuestNum}"),"0");
if(result1>0){
continue;
}else if(result1<0){
continue;
}else{
sprintf(randOrderId,"{OrderId_%d}",randnum);
lr_save_string(lr_eval_string(randOrderId),"wkOrderId");
sprintf(randRegisterId,"{RegisterId_%d}",randnum);
lr_save_string(lr_eval_string(randRegisterId),"wkRegisterId");
......
break;
}
}
在场景中出现的问题是 vuser1 vuser2 vueser3 得的randnum的值是一样的
加入时间差应该就行了 1如果vuser1、vuser2、vuser3使用相同的用户名密码登陆系统,随机出的值是一样的
2如果vuser1、vuser2、vuser3使用不同的用户名密码登陆系统,随机出的值就是不一样的
页:
[1]