标签:请求 nbsp _id etc aaaaa equals 签名 mobile apache
import org.apache.commons.codec.digest.DigestUtils; import java.io.*; import org.apache.jmeter.config.Arguments; Arguments args = sampler.getArguments(); String str1 = vars.get("body"); //String bodyStr = str1.substring(1, str1.length()).replace("(","").replace(")",""); String timestamptmp = String.valueOf(Long.valueOf("${__time(,)}")); String query_str = "body=" + str1 + "×tamp=" + timestamptmp + "&uid=" + "${mobile}" ; //&req_id=123 String sig = DigestUtils.sha256Hex(query_str).toUpperCase(); vars.put("timestamp",timestamptmp); vars.put("sig",sig); vars.put("query_str",query_str); log.info("AAAAA"+ctx.getCurrentSampler()); //log.info("KKKKKKKKKK"+query_str); //log.info("PPPPP"+bodyStr);
断言:
code=vars.get("rescode"); if (!code.equals("00000")) { //响应信息的状态值status_str不等于0,则断言其他与实际值不一致 Failure=true; FailureMessage="请求失败"; };
标签:请求 nbsp _id etc aaaaa equals 签名 mobile apache
原文地址:https://www.cnblogs.com/yaobiluo/p/12217330.html