fix(接口测试): 修复批量执行case部分case未选择运行环境批量执行未提醒选择环境的缺陷
--bug=1010862 --user=王孝刚 【接口测试】-批量执行case-部分case未选择运行环境-批量执行也未统一选择运行环境-可批量执行 https://www.tapd.cn/55049933/s/1120823
This commit is contained in:
parent
f9bd46ff88
commit
3218006e3e
|
@ -140,23 +140,19 @@ public class ApiCaseExecuteService {
|
||||||
if (CollectionUtils.isNotEmpty(caseList)) {
|
if (CollectionUtils.isNotEmpty(caseList)) {
|
||||||
StringBuilder builderHttp = new StringBuilder();
|
StringBuilder builderHttp = new StringBuilder();
|
||||||
StringBuilder builderTcp = new StringBuilder();
|
StringBuilder builderTcp = new StringBuilder();
|
||||||
for (ApiTestCaseWithBLOBs apiCase : caseList) {
|
for (int i = caseList.size() - 1; i >= 0; i--) {
|
||||||
|
ApiTestCaseWithBLOBs apiCase = caseList.get(i);
|
||||||
JSONObject apiCaseNew = new JSONObject(apiCase.getRequest());
|
JSONObject apiCaseNew = new JSONObject(apiCase.getRequest());
|
||||||
if ("HTTPSamplerProxy".equals(apiCaseNew.getString("type"))) {
|
if (apiCaseNew.has("type") && "HTTPSamplerProxy".equals(apiCaseNew.getString("type"))) {
|
||||||
try {
|
if (!apiCaseNew.has("useEnvironment") || StringUtils.isEmpty(apiCaseNew.getString("useEnvironment"))) {
|
||||||
String environmentId = apiCaseNew.getString("useEnvironment");
|
builderHttp.append(apiCase.getName()).append("; ");
|
||||||
if (!StringUtils.isNotEmpty(environmentId)) {
|
|
||||||
builderHttp.append(apiCase.getName()).append("; ");
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
MSException.throwException("用例:" + builderHttp.append(apiCase.getName()).append("; ") + "运行环境为空!请检查");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ("JDBCSampler".equals(apiCaseNew.getString("type"))) {
|
if (apiCaseNew.has("type") && "JDBCSampler".equals(apiCaseNew.getString("type"))) {
|
||||||
try {
|
DatabaseConfig dataSource = null;
|
||||||
|
if (apiCaseNew.has("useEnvironment") && apiCaseNew.has("dataSourceId")) {
|
||||||
String environmentId = apiCaseNew.getString("useEnvironment");
|
String environmentId = apiCaseNew.getString("useEnvironment");
|
||||||
String dataSourceId = apiCaseNew.getString("dataSourceId");
|
String dataSourceId = apiCaseNew.getString("dataSourceId");
|
||||||
DatabaseConfig dataSource = null;
|
|
||||||
ApiTestEnvironmentService environmentService = CommonBeanFactory.getBean(ApiTestEnvironmentService.class);
|
ApiTestEnvironmentService environmentService = CommonBeanFactory.getBean(ApiTestEnvironmentService.class);
|
||||||
ApiTestEnvironmentWithBLOBs environment = environmentService.get(environmentId);
|
ApiTestEnvironmentWithBLOBs environment = environmentService.get(environmentId);
|
||||||
EnvironmentConfig envConfig = null;
|
EnvironmentConfig envConfig = null;
|
||||||
|
@ -170,17 +166,20 @@ public class ApiCaseExecuteService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (dataSource == null) {
|
}
|
||||||
MSException.throwException("用例:" + builderTcp.append(apiCase.getName()).append("; "));
|
if (dataSource == null) {
|
||||||
}
|
builderTcp.append(apiCase.getName()).append("; ");
|
||||||
} catch (Exception e) {
|
|
||||||
MSException.throwException("用例数据源为空,请检查!");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (StringUtils.isNotEmpty(builderHttp)) {
|
||||||
|
MSException.throwException("用例:" + builderHttp + "运行环境为空!请检查");
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotEmpty(builderTcp)) {
|
||||||
|
MSException.throwException("用例:" + builderTcp + "数据源为空!请检查");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 接口定义case执行
|
* 接口定义case执行
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue