1.Bean shell断言,先获取ecjsd,ecjsd1两个变量值。转化成int类型。再比较大小
代码如下
String str1=vars.get("ecjsd");
String str2=vars.get("ecjsd1");
// 将两个数都转换为int 数据
int num1 =Integer.valueOf(str1);
int num2 =Integer.valueOf(str2);
if(num2>=num1){
Failure=false;
FailureMessage="pass";
}else{
Failure=true;
FailureMeddage="faile";
}
2.运行查看,没有错误,且10000确实大于等于20。是正确的!
3.再看下如果不正确的情况,将num1和num2位置调换
4.再次运行,也可以正确进行断言
文章部分参考:
https://www.cnblogs.com/xiongjiawei/p/6406110.html