优化使用runcase关键字时,支持调用用例中的局部变量以及全局变量,传入到被调用用例中进行使用
This commit is contained in:
parent
f4668150a6
commit
60930ea4b5
|
@ -124,7 +124,7 @@ public class AndroidCaseExecution{
|
||||||
if(null != operationValue && "runcase".equals(operation)){
|
if(null != operationValue && "runcase".equals(operation)){
|
||||||
String[] temp=operationValue.split(",",-1);
|
String[] temp=operationValue.split(",",-1);
|
||||||
TestCaseExecution testCaseExecution=new TestCaseExecution();
|
TestCaseExecution testCaseExecution=new TestCaseExecution();
|
||||||
String ex = testCaseExecution.oneCaseExecuteForCase(temp[0], taskid, caselog, appium);
|
String ex = testCaseExecution.oneCaseExecuteForCase(temp[0], taskid, variable, caselog, appium);
|
||||||
if(!ex.contains("CallCase调用出错!") && !ex.contains("解析出错啦!") && !ex.contains("失败")){
|
if(!ex.contains("CallCase调用出错!") && !ex.contains("解析出错啦!") && !ex.contains("失败")){
|
||||||
// 加入runcase中的变量
|
// 加入runcase中的变量
|
||||||
variable.putAll(testCaseExecution.RUNCASE_VARIABLE);
|
variable.putAll(testCaseExecution.RUNCASE_VARIABLE);
|
||||||
|
|
|
@ -133,7 +133,7 @@ public class IosCaseExecution{
|
||||||
if(null != operationValue && "runcase".equals(operation)){
|
if(null != operationValue && "runcase".equals(operation)){
|
||||||
String[] temp=operationValue.split(",",-1);
|
String[] temp=operationValue.split(",",-1);
|
||||||
TestCaseExecution testCaseExecution=new TestCaseExecution();
|
TestCaseExecution testCaseExecution=new TestCaseExecution();
|
||||||
String ex = testCaseExecution.oneCaseExecuteForCase(temp[0], taskid, caselog, appium);
|
String ex = testCaseExecution.oneCaseExecuteForCase(temp[0], taskid, variable, caselog, appium);
|
||||||
if(!ex.contains("CallCase调用出错!") && !ex.contains("解析出错啦!") && !ex.contains("匹配失败")){
|
if(!ex.contains("CallCase调用出错!") && !ex.contains("解析出错啦!") && !ex.contains("匹配失败")){
|
||||||
// 加入runcase中的变量
|
// 加入runcase中的变量
|
||||||
variable.putAll(testCaseExecution.RUNCASE_VARIABLE);
|
variable.putAll(testCaseExecution.RUNCASE_VARIABLE);
|
||||||
|
|
|
@ -179,7 +179,7 @@ public class TestCaseExecution {
|
||||||
* @return 返回执行结果
|
* @return 返回执行结果
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public String oneCaseExecuteForCase(String testCaseExternalId, String taskid, serverOperation caselog, Object driver) {
|
public String oneCaseExecuteForCase(String testCaseExternalId, String taskid, Map<String, String> outVariable, serverOperation caselog, Object driver) {
|
||||||
String expectedresults;
|
String expectedresults;
|
||||||
int setresult = 1;
|
int setresult = 1;
|
||||||
String testnote = "初始化测试结果";
|
String testnote = "初始化测试结果";
|
||||||
|
@ -191,6 +191,9 @@ public class TestCaseExecution {
|
||||||
}
|
}
|
||||||
// 加入全局变量
|
// 加入全局变量
|
||||||
RUNCASE_VARIABLE.putAll(ParamsManageForSteps.GLOBAL_VARIABLE);
|
RUNCASE_VARIABLE.putAll(ParamsManageForSteps.GLOBAL_VARIABLE);
|
||||||
|
// 加入调用用例中的变量
|
||||||
|
RUNCASE_VARIABLE.putAll(outVariable);
|
||||||
|
|
||||||
List<ProjectCaseSteps> steps = GetServerApi.getStepsbycaseid(testcase.getCaseId());
|
List<ProjectCaseSteps> steps = GetServerApi.getStepsbycaseid(testcase.getCaseId());
|
||||||
if (steps.size() == 0) {
|
if (steps.size() == 0) {
|
||||||
setresult = 2;
|
setresult = 2;
|
||||||
|
|
|
@ -126,7 +126,7 @@ public class WebCaseExecution{
|
||||||
if (null != operationValue && "runcase".equals(operation)) {
|
if (null != operationValue && "runcase".equals(operation)) {
|
||||||
String[] temp = operationValue.split(",", -1);
|
String[] temp = operationValue.split(",", -1);
|
||||||
TestCaseExecution testCaseExecution=new TestCaseExecution();
|
TestCaseExecution testCaseExecution=new TestCaseExecution();
|
||||||
String ex = testCaseExecution.oneCaseExecuteForCase(temp[0], taskid, caselog, wd);
|
String ex = testCaseExecution.oneCaseExecuteForCase(temp[0], taskid, variable, caselog, wd);
|
||||||
if (!ex.contains("CallCase调用出错!") && !ex.contains("解析出错啦!") && !ex.contains("失败")) {
|
if (!ex.contains("CallCase调用出错!") && !ex.contains("解析出错啦!") && !ex.contains("失败")) {
|
||||||
// 加入runcase中的变量
|
// 加入runcase中的变量
|
||||||
variable.putAll(testCaseExecution.RUNCASE_VARIABLE);
|
variable.putAll(testCaseExecution.RUNCASE_VARIABLE);
|
||||||
|
|
Loading…
Reference in New Issue