增加测试结果为空时,支持预期结果使用NULL字符匹配
This commit is contained in:
parent
9256a564af
commit
4ed74b8a48
|
@ -21,6 +21,7 @@ import luckyclient.remote.entity.ProjectCaseParams;
|
|||
import luckyclient.remote.entity.ProjectCaseSteps;
|
||||
import luckyclient.utils.Constants;
|
||||
import luckyclient.utils.LogUtil;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
|
||||
/**
|
||||
* =================================================================
|
||||
|
@ -295,7 +296,11 @@ public class AndroidCaseExecution{
|
|||
if (expect.equals(result)) {
|
||||
LogUtil.APP.info("用例:{} 第{}步,精确匹配预期结果成功!执行结果:{}",testcase.getCaseSign(),step.getStepSerialNumber(),result);
|
||||
caselog.insertTaskCaseLog(taskid, testcase.getCaseId(), "精确匹配预期结果成功!", "info", String.valueOf(step.getStepSerialNumber()), "");
|
||||
} else {
|
||||
} else if(expect.trim().equals("NULL")&& StringUtils.isBlank(result)){
|
||||
result = "返回结果为空,匹配NULL成功";
|
||||
LogUtil.APP.info("用例:{} 第{}步,精确匹配预期结果成功!执行结果:{}",testcase.getCaseSign(),step.getStepSerialNumber(),result);
|
||||
caselog.insertTaskCaseLog(taskid, testcase.getCaseId(), "精确匹配预期结果成功!", "info", String.valueOf(step.getStepSerialNumber()), "");
|
||||
} else {
|
||||
casenote = "第" + step.getStepSerialNumber() + "步,精确匹配预期结果失败!";
|
||||
setresult = 1;
|
||||
AndroidBaseAppium.screenShot(appium, imagname);
|
||||
|
|
|
@ -21,6 +21,7 @@ import luckyclient.remote.entity.ProjectCaseParams;
|
|||
import luckyclient.remote.entity.ProjectCaseSteps;
|
||||
import luckyclient.utils.Constants;
|
||||
import luckyclient.utils.LogUtil;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
|
||||
/**
|
||||
* =================================================================
|
||||
|
@ -308,7 +309,11 @@ public class IosCaseExecution{
|
|||
if (expect.equals(result)) {
|
||||
LogUtil.APP.info("用例:{} 第{}步,精确匹配预期结果成功!执行结果:{}",testcase.getCaseSign(),step.getStepSerialNumber(),result);
|
||||
caselog.insertTaskCaseLog(taskid, testcase.getCaseId(), "精确匹配预期结果成功!", "info", String.valueOf(step.getStepSerialNumber()), "");
|
||||
} else {
|
||||
} else if(expect.trim().equals("NULL")&& StringUtils.isBlank(result)){
|
||||
result = "返回结果为空,匹配NULL成功";
|
||||
LogUtil.APP.info("用例:{} 第{}步,精确匹配预期结果成功!执行结果:{}",testcase.getCaseSign(),step.getStepSerialNumber(),result);
|
||||
caselog.insertTaskCaseLog(taskid, testcase.getCaseId(), "精确匹配预期结果成功!", "info", String.valueOf(step.getStepSerialNumber()), "");
|
||||
} else {
|
||||
casenote = "第" + step.getStepSerialNumber() + "步,精确匹配预期结果失败!";
|
||||
setresult = 1;
|
||||
IosBaseAppium.screenShot(appium, imagname);
|
||||
|
|
|
@ -9,12 +9,14 @@ import java.util.regex.Pattern;
|
|||
import luckyclient.execution.dispose.ActionManageForSteps;
|
||||
import luckyclient.execution.httpinterface.analyticsteps.InterfaceAnalyticCase;
|
||||
import luckyclient.remote.api.GetServerApi;
|
||||
import luckyclient.remote.api.PostServerApi;
|
||||
import luckyclient.remote.entity.ProjectCase;
|
||||
import luckyclient.remote.entity.ProjectCaseParams;
|
||||
import luckyclient.remote.entity.ProjectCaseSteps;
|
||||
import luckyclient.utils.InvokeMethod;
|
||||
import luckyclient.utils.LogUtil;
|
||||
import luckyclient.utils.httputils.HttpRequest;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
|
||||
/**
|
||||
* =================================================================
|
||||
|
@ -148,6 +150,10 @@ public class ApiTestCaseDebug {
|
|||
if (expectedresults.equals(testnote)) {
|
||||
LogUtil.APP.info(
|
||||
"用例:{} 第{}步,精确匹配预期结果成功!执行结果:{}",testcase.getCaseSign(),(i+1),testnote);
|
||||
} else if(expectedresults.trim().equals("NULL")&& StringUtils.isBlank(testnote)){
|
||||
testnote = "返回结果为空,匹配NULL成功";
|
||||
LogUtil.APP.info(
|
||||
"用例:{} 第{}步,精确匹配预期结果成功!执行结果:{}",testcase.getCaseSign(),(i+1),testnote);
|
||||
} else {
|
||||
setcaseresult = 1;
|
||||
LogUtil.APP.warn("用例:{} 第{}步,精确匹配预期结果失败!预期结果:{},测试结果:{}",testcase.getCaseSign(),(i+1),expectedresults,testnote);
|
||||
|
|
|
@ -6,6 +6,7 @@ import java.util.Map;
|
|||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.openqa.selenium.WebDriver;
|
||||
|
||||
import io.appium.java_client.android.AndroidDriver;
|
||||
|
@ -382,6 +383,10 @@ public class TestCaseExecution {
|
|||
if (expectedresults.equals(testnote)) {
|
||||
LogUtil.APP.info("用例:{} 第{}步,精确匹配预期结果成功!执行结果:{}",testcase.getCaseSign(),step.getStepSerialNumber(),testnote);
|
||||
caselog.insertTaskCaseLog(taskid, testcase.getCaseId(), "精确匹配预期结果成功!执行结果:" + testnote, "info", String.valueOf(step.getStepSerialNumber()), "");
|
||||
} else if(expectedresults.trim().equals("NULL")&& StringUtils.isBlank(testnote)){
|
||||
testnote = "返回结果为空,匹配NULL成功";
|
||||
LogUtil.APP.info("用例:{} 第{}步,精确匹配预期结果成功!执行结果:{}",testcase.getCaseSign(),step.getStepSerialNumber(),testnote);
|
||||
caselog.insertTaskCaseLog(taskid, testcase.getCaseId(), "精确匹配预期结果成功!执行结果:" + testnote, "info", String.valueOf(step.getStepSerialNumber()), "");
|
||||
} else {
|
||||
setresult = 1;
|
||||
LogUtil.APP.warn("用例:{} 第{}步,精确匹配预期结果失败!预期结果:{},测试结果:{}",testcase.getCaseSign(),step.getStepSerialNumber(),expectedresults,testnote);
|
||||
|
|
|
@ -17,6 +17,7 @@ import luckyclient.remote.entity.ProjectCaseSteps;
|
|||
import luckyclient.utils.Constants;
|
||||
import luckyclient.utils.InvokeMethod;
|
||||
import luckyclient.utils.LogUtil;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
|
||||
/**
|
||||
* =================================================================
|
||||
|
@ -197,6 +198,10 @@ public class ThreadForExecuteCase extends Thread {
|
|||
if (expectedresults.equals(testnote)) {
|
||||
LogUtil.APP.info("用例:{} 第{}步,精确匹配预期结果成功!执行结果:{}",testcase.getCaseSign(),(i+1),testnote);
|
||||
caselog.insertTaskCaseLog(taskid, caseId, "精确匹配预期结果成功!执行结果:" + testnote, "info", String.valueOf(i + 1), "");
|
||||
} else if(expectedresults.trim().equals("NULL")&&StringUtils.isBlank(testnote)){
|
||||
testnote = "返回结果为空,匹配NULL成功";
|
||||
LogUtil.APP.info("用例:{} 第{}步,精确匹配预期结果成功!执行结果:{}",testcase.getCaseSign(),(i+1),testnote);
|
||||
caselog.insertTaskCaseLog(taskid, caseId, "精确匹配预期结果成功!执行结果:" + testnote, "info", String.valueOf(i + 1), "");
|
||||
} else {
|
||||
setcaseresult = 1;
|
||||
LogUtil.APP.warn("用例:{} 第{}步,精确匹配预期结果失败!预期结果:{},测试结果:{}",testcase.getCaseSign(),(i+1),expectedresults,testnote);
|
||||
|
|
|
@ -18,6 +18,7 @@ import luckyclient.remote.entity.ProjectCaseSteps;
|
|||
import luckyclient.utils.Constants;
|
||||
import luckyclient.utils.InvokeMethod;
|
||||
import luckyclient.utils.LogUtil;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
|
||||
/**
|
||||
* =================================================================
|
||||
|
@ -171,6 +172,9 @@ public class WebTestCaseDebug {
|
|||
else {
|
||||
if (expectedresults.equals(testnote)) {
|
||||
PostServerApi.cPostDebugLog(userId, caseId, "INFO", "精确匹配预期结果成功!执行结果:" + testnote,0);
|
||||
} else if(expectedresults.trim().equals("NULL")&& StringUtils.isBlank(testnote)){
|
||||
testnote = "返回结果为空,匹配NULL成功";
|
||||
PostServerApi.cPostDebugLog(userId, caseId, "INFO", "精确匹配预期结果成功!执行结果:" + testnote,0);
|
||||
} else {
|
||||
setcaseresult = 1;
|
||||
PostServerApi.cPostDebugLog(userId, caseId, "ERROR", "第" + (i + 1) + "步,精确匹配预期结果失败!预期结果:" + expectedresults + ",测试结果:" + testnote,0);
|
||||
|
|
|
@ -7,6 +7,7 @@ import java.util.Map;
|
|||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.openqa.selenium.By;
|
||||
import org.openqa.selenium.WebDriver;
|
||||
import org.openqa.selenium.WebElement;
|
||||
|
@ -311,6 +312,10 @@ public class WebCaseExecution{
|
|||
if (expect.equals(result)) {
|
||||
LogUtil.APP.info("用例:{} 第{}步,精确匹配预期结果成功!执行结果:{}",testcase.getCaseSign(),step.getStepSerialNumber(),result);
|
||||
caselog.insertTaskCaseLog(taskid, testcase.getCaseId(), "精确匹配预期结果成功!", "info", String.valueOf(step.getStepSerialNumber()), "");
|
||||
} else if(expect.trim().equals("NULL")&& StringUtils.isBlank(result)){
|
||||
result = "返回结果为空,匹配NULL成功";
|
||||
LogUtil.APP.info("用例:{} 第{}步,精确匹配预期结果成功!执行结果:{}",testcase.getCaseSign(),step.getStepSerialNumber(),result);
|
||||
caselog.insertTaskCaseLog(taskid, testcase.getCaseId(), "精确匹配预期结果成功!", "info", String.valueOf(step.getStepSerialNumber()), "");
|
||||
} else {
|
||||
casenote = "第" + step.getStepSerialNumber() + "步,精确匹配预期结果失败!";
|
||||
setresult = 1;
|
||||
|
|
Loading…
Reference in New Issue