!34 新增功能【聚合计划】,可以将多个测试计划聚合起来一次执行
Merge pull request !34 from Jerel/feature20220125
This commit is contained in:
commit
26ef98bfd3
|
@ -16,11 +16,7 @@ import luckyclient.execution.appium.iosex.IosCaseExecution;
|
|||
import luckyclient.execution.httpinterface.TestControl;
|
||||
import luckyclient.remote.api.GetServerApi;
|
||||
import luckyclient.remote.api.serverOperation;
|
||||
import luckyclient.remote.entity.ProjectCase;
|
||||
import luckyclient.remote.entity.ProjectCaseParams;
|
||||
import luckyclient.remote.entity.ProjectCaseSteps;
|
||||
import luckyclient.remote.entity.TaskExecute;
|
||||
import luckyclient.remote.entity.TaskScheduling;
|
||||
import luckyclient.remote.entity.*;
|
||||
import luckyclient.tool.jenkins.BuildingInitialization;
|
||||
import luckyclient.tool.mail.HtmlMail;
|
||||
import luckyclient.tool.mail.MailSendInitialization;
|
||||
|
@ -80,9 +76,9 @@ public class AppTestControl {
|
|||
LogUtil.APP.info("开始执行计划中的第{}条用例:【{}】......",i,testcase.getCaseSign());
|
||||
try {
|
||||
if ("Android".equals(properties.getProperty("platformName"))) {
|
||||
AndroidCaseExecution.caseExcution(testcase, steps, taskid, androiddriver, caselog, pcplist);
|
||||
AndroidCaseExecution.caseExcution(testcase, steps, taskid,null, androiddriver, caselog, pcplist);
|
||||
} else if ("IOS".equals(properties.getProperty("platformName"))) {
|
||||
IosCaseExecution.caseExcution(testcase, steps, taskid, iosdriver, caselog, pcplist);
|
||||
IosCaseExecution.caseExcution(testcase, steps, taskid, null,iosdriver, caselog, pcplist);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
LogUtil.APP.error("用户执行过程中抛出Exception异常!", e);
|
||||
|
@ -127,56 +123,82 @@ public class AppTestControl {
|
|||
if (restartstatus.contains("Status:true")) {
|
||||
// 判断是否构建是否成功
|
||||
if (BuildResult.SUCCESS.equals(buildResult)) {
|
||||
try {
|
||||
if ("Android".equals(properties.getProperty("platformName"))) {
|
||||
androiddriver = AppiumInitialization.setAndroidAppium(properties);
|
||||
LogUtil.APP.info("完成AndroidDriver初始化动作...APPIUM Server【http://{}/wd/hub】",properties.getProperty("appiumsever"));
|
||||
} else if ("IOS".equals(properties.getProperty("platformName"))) {
|
||||
iosdriver = AppiumInitialization.setIosAppium(properties);
|
||||
LogUtil.APP.info("完成IOSDriver初始化动作...APPIUM Server【http://{}/wd/hub】",properties.getProperty("appiumsever"));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
LogUtil.APP.error("初始化AppiumDriver出错 !APPIUM Server【http://{}/wd/hub】",properties.getProperty("appiumsever"), e);
|
||||
|
||||
List<ProjectPlan> plans=new ArrayList<>();
|
||||
// 单计划执行
|
||||
if(taskScheduling.getPlanType()==1){
|
||||
ProjectPlan projectPlan=new ProjectPlan();
|
||||
projectPlan.setPlanId(taskScheduling.getPlanId());
|
||||
plans.add(projectPlan);
|
||||
}
|
||||
serverOperation caselog = new serverOperation();
|
||||
List<ProjectCase> cases = GetServerApi.getCasesbyplanId(taskScheduling.getPlanId());
|
||||
LogUtil.APP.info("当前计划【{}】中共有【{}】条待测试用例...",task.getTaskName(),cases.size());
|
||||
serverOperation.updateTaskExecuteStatusIng(taskId, cases.size());
|
||||
int i = 0;
|
||||
for (ProjectCase testcase : cases) {
|
||||
i++;
|
||||
LogUtil.APP.info("开始执行当前测试任务 {} 的第【{}】条测试用例:【{}】......",task.getTaskName(),i,testcase.getCaseSign());
|
||||
List<ProjectCaseSteps> steps = GetServerApi.getStepsbycaseid(testcase.getCaseId());
|
||||
if (steps.size() == 0) {
|
||||
continue;
|
||||
}
|
||||
// 聚合多计划执行
|
||||
else if(taskScheduling.getPlanType()==2){
|
||||
plans.addAll(GetServerApi.getPlansbysuiteId(taskScheduling.getSuiteId()));
|
||||
}
|
||||
LogUtil.APP.info("当前测试任务 {} 中共有【{}】条测试计划...",task.getTaskName(),plans.size());
|
||||
|
||||
int caseCount=0;
|
||||
for(ProjectPlan pp:plans){
|
||||
List<ProjectCase> cases = GetServerApi.getCasesbyplanId(pp.getPlanId());
|
||||
caseCount+=cases.size();
|
||||
}
|
||||
|
||||
for(ProjectPlan pp:plans){
|
||||
|
||||
try {
|
||||
//插入开始执行的用例
|
||||
caselog.insertTaskCaseExecute(taskId, taskScheduling.getProjectId(),testcase.getCaseId(),testcase.getCaseSign(), testcase.getCaseName(), 4);
|
||||
if ("Android".equals(properties.getProperty("platformName"))) {
|
||||
AndroidCaseExecution.caseExcution(testcase, steps, taskId, androiddriver, caselog, pcplist);
|
||||
androiddriver = AppiumInitialization.setAndroidAppium(properties);
|
||||
LogUtil.APP.info("完成AndroidDriver初始化动作...APPIUM Server【http://{}/wd/hub】",properties.getProperty("appiumsever"));
|
||||
} else if ("IOS".equals(properties.getProperty("platformName"))) {
|
||||
IosCaseExecution.caseExcution(testcase, steps, taskId, iosdriver, caselog, pcplist);
|
||||
iosdriver = AppiumInitialization.setIosAppium(properties);
|
||||
LogUtil.APP.info("完成IOSDriver初始化动作...APPIUM Server【http://{}/wd/hub】",properties.getProperty("appiumsever"));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
LogUtil.APP.error("用户执行过程中抛出异常!", e);
|
||||
LogUtil.APP.error("初始化AppiumDriver出错 !APPIUM Server【http://{}/wd/hub】",properties.getProperty("appiumsever"), e);
|
||||
}
|
||||
serverOperation caselog = new serverOperation();
|
||||
List<ProjectCase> cases = GetServerApi.getCasesbyplanId(pp.getPlanId());
|
||||
LogUtil.APP.info("当前计划【{}】中共有【{}】条待测试用例...",pp.getPlanName(),cases.size());
|
||||
serverOperation.updateTaskExecuteStatusIng(taskId, caseCount);
|
||||
int i = 0;
|
||||
for (ProjectCase testcase : cases) {
|
||||
i++;
|
||||
LogUtil.APP.info("开始执行当前测试任务 {} 的第【{}】条测试用例:【{}】......",task.getTaskName(),i,testcase.getCaseSign());
|
||||
List<ProjectCaseSteps> steps = GetServerApi.getStepsbycaseid(testcase.getCaseId());
|
||||
if (steps.size() == 0) {
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
//插入开始执行的用例
|
||||
caselog.insertTaskCaseExecute(taskId, taskScheduling.getProjectId(),pp.getPlanId(),testcase.getCaseId(),testcase.getCaseSign(), testcase.getCaseName(), 4);
|
||||
if ("Android".equals(properties.getProperty("platformName"))) {
|
||||
AndroidCaseExecution.caseExcution(testcase, steps, taskId, pp.getPlanId(),androiddriver, caselog, pcplist);
|
||||
} else if ("IOS".equals(properties.getProperty("platformName"))) {
|
||||
IosCaseExecution.caseExcution(testcase, steps, taskId, pp.getPlanId(),iosdriver, caselog, pcplist);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
LogUtil.APP.error("用户执行过程中抛出异常!", e);
|
||||
}
|
||||
LogUtil.APP.info("当前用例:【{}】执行完成......进入下一条",testcase.getCaseSign());
|
||||
}
|
||||
LogUtil.APP.info("当前【{}】测试计划中的用例已经全部执行完成...",pp.getPlanName());
|
||||
// 关闭APP以及appium会话
|
||||
if ("Android".equals(properties.getProperty("platformName"))) {
|
||||
assert androiddriver != null;
|
||||
androiddriver.closeApp();
|
||||
} else if ("IOS".equals(properties.getProperty("platformName"))) {
|
||||
assert iosdriver != null;
|
||||
iosdriver.closeApp();
|
||||
}
|
||||
LogUtil.APP.info("当前用例:【{}】执行完成......进入下一条",testcase.getCaseSign());
|
||||
}
|
||||
tastcount = serverOperation.updateTaskExecuteData(taskId, cases.size(),2);
|
||||
tastcount = serverOperation.updateTaskExecuteData(taskId, caseCount,2);
|
||||
tastcount[0]=caseCount;
|
||||
String testtime = serverOperation.getTestTime(taskId);
|
||||
LogUtil.APP.info("当前项目【{}】测试计划中的用例已经全部执行完成...",projectname);
|
||||
MailSendInitialization.sendMailInitialization(HtmlMail.htmlSubjectFormat(jobname),
|
||||
HtmlMail.htmlContentFormat(tastcount, taskId, buildResult.toString(), restartstatus, testtime, jobname),
|
||||
taskId, taskScheduling, tastcount,testtime,buildResult.toString(),restartstatus);
|
||||
// 关闭APP以及appium会话
|
||||
if ("Android".equals(properties.getProperty("platformName"))) {
|
||||
assert androiddriver != null;
|
||||
androiddriver.closeApp();
|
||||
} else if ("IOS".equals(properties.getProperty("platformName"))) {
|
||||
assert iosdriver != null;
|
||||
iosdriver.closeApp();
|
||||
}
|
||||
|
||||
} else {
|
||||
LogUtil.APP.warn("项目构建失败,自动化测试自动退出!请前往JENKINS中检查项目构建情况。");
|
||||
MailSendInitialization.sendMailInitialization(jobname, "构建项目过程中失败,自动化测试自动退出!请前去JENKINS查看构建情况!", taskId, taskScheduling, null,"0小时0分0秒",buildResult.toString(),restartstatus);
|
||||
|
|
|
@ -41,7 +41,7 @@ public class CaseLocalDebug{
|
|||
List<ProjectCaseParams> pcplist=GetServerApi.cgetParamsByProjectid(String.valueOf(testcase.getProjectId()));
|
||||
LogUtil.APP.info("开始执行用例:【{}】......",testCaseExternalId);
|
||||
List<ProjectCaseSteps> steps=GetServerApi.getStepsbycaseid(testcase.getCaseId());
|
||||
AndroidCaseExecution.caseExcution(testcase, steps, "888888", appium, caselog, pcplist);
|
||||
AndroidCaseExecution.caseExcution(testcase, steps, "888888", null,appium, caselog, pcplist);
|
||||
LogUtil.APP.info("当前用例:【{}】执行完成......进入下一条",testcase.getCaseSign());
|
||||
} catch (Exception e) {
|
||||
LogUtil.APP.error("用户执行过程中抛出异常!", e);
|
||||
|
|
|
@ -64,7 +64,7 @@ public class AndroidBatchExecute {
|
|||
// 删除旧的日志
|
||||
serverOperation.deleteTaskCaseLog(testcase.getCaseId(), taskid);
|
||||
try {
|
||||
AndroidCaseExecution.caseExcution(testcase, steps, taskid, ad, caselog, pcplist);
|
||||
AndroidCaseExecution.caseExcution(testcase, steps, taskid,null, ad, caselog, pcplist);
|
||||
} catch (Exception e) {
|
||||
LogUtil.APP.error("用户执行过程中抛出异常!", e);
|
||||
}
|
||||
|
@ -77,7 +77,7 @@ public class AndroidBatchExecute {
|
|||
// 删除旧的日志
|
||||
serverOperation.deleteTaskCaseLog(testcase.getCaseId(), taskid);
|
||||
try {
|
||||
AndroidCaseExecution.caseExcution(testcase, steps, taskid, ad, caselog, pcplist);
|
||||
AndroidCaseExecution.caseExcution(testcase, steps, taskid,null, ad, caselog, pcplist);
|
||||
} catch (Exception e) {
|
||||
LogUtil.APP.error("用户执行过程中抛出异常!", e);
|
||||
}
|
||||
|
|
|
@ -36,8 +36,8 @@ public class AndroidCaseExecution{
|
|||
static Map<String, String> variable = new HashMap<>();
|
||||
private static String casenote = "备注初始化";
|
||||
|
||||
public static void caseExcution(ProjectCase testcase, List<ProjectCaseSteps> steps,String taskid, AndroidDriver<AndroidElement> appium,serverOperation caselog,List<ProjectCaseParams> pcplist) {
|
||||
caselog.updateTaskCaseExecuteStatus(taskid, testcase.getCaseId(), 3);
|
||||
public static void caseExcution(ProjectCase testcase, List<ProjectCaseSteps> steps,String taskid,Integer planId, AndroidDriver<AndroidElement> appium,serverOperation caselog,List<ProjectCaseParams> pcplist) {
|
||||
caselog.updateTaskCaseExecuteStatus(taskid,planId, testcase.getCaseId(), 3);
|
||||
// 把公共参数加入到MAP中
|
||||
for (ProjectCaseParams pcp : pcplist) {
|
||||
variable.put(pcp.getParamsName(), pcp.getParamsValue());
|
||||
|
@ -106,7 +106,7 @@ public class AndroidCaseExecution{
|
|||
}
|
||||
|
||||
variable.clear();
|
||||
caselog.updateTaskCaseExecuteStatus(taskid, testcase.getCaseId(), setcaseresult);
|
||||
caselog.updateTaskCaseExecuteStatus(taskid, planId,testcase.getCaseId(), setcaseresult);
|
||||
if(setcaseresult==0){
|
||||
LogUtil.APP.info("用例【{}】全部步骤执行结果成功...",testcase.getCaseSign());
|
||||
caselog.insertTaskCaseLog(taskid, testcase.getCaseId(), "用例全部步骤执行结果成功","info", "ending","");
|
||||
|
|
|
@ -38,7 +38,7 @@ public class AndroidCaseLocalDebug {
|
|||
.cgetParamsByProjectid(String.valueOf(testcase.getProjectId()));
|
||||
LogUtil.APP.info("开始执行用例:【{}】......",testCaseExternalId);
|
||||
List<ProjectCaseSteps> steps = GetServerApi.getStepsbycaseid(testcase.getCaseId());
|
||||
AndroidCaseExecution.caseExcution(testcase, steps, "888888", androiddriver, caselog, pcplist);
|
||||
AndroidCaseExecution.caseExcution(testcase, steps, "888888",null, androiddriver, caselog, pcplist);
|
||||
|
||||
LogUtil.APP.info("当前用例:【{}】执行完成......进入下一条",testcase.getCaseSign());
|
||||
} catch (Exception e) {
|
||||
|
|
|
@ -58,7 +58,7 @@ public class AndroidOneCaseExecute {
|
|||
LogUtil.APP.info("开始执行用例:【{}】......",testcase.getCaseSign());
|
||||
try {
|
||||
List<ProjectCaseSteps> steps = GetServerApi.getStepsbycaseid(testcase.getCaseId());
|
||||
AndroidCaseExecution.caseExcution(testcase, steps, taskid, ad, caselog, pcplist);
|
||||
AndroidCaseExecution.caseExcution(testcase, steps, taskid,null, ad, caselog, pcplist);
|
||||
LogUtil.APP.info("当前用例:【{}】执行完成......进入下一条",testcase.getCaseSign());
|
||||
} catch (Exception e) {
|
||||
LogUtil.APP.error("用户执行过程中抛出异常!", e);
|
||||
|
|
|
@ -63,7 +63,7 @@ public class IosBatchExecute {
|
|||
// 删除旧的日志
|
||||
serverOperation.deleteTaskCaseLog(testcase.getCaseId(), taskid);
|
||||
try {
|
||||
IosCaseExecution.caseExcution(testcase, steps, taskid, iosd, caselog, pcplist);
|
||||
IosCaseExecution.caseExcution(testcase, steps, taskid,null, iosd, caselog, pcplist);
|
||||
} catch (Exception e) {
|
||||
LogUtil.APP.error("用户执行过程中抛出异常!", e);
|
||||
}
|
||||
|
@ -76,7 +76,7 @@ public class IosBatchExecute {
|
|||
// 删除旧的日志
|
||||
serverOperation.deleteTaskCaseLog(testcase.getCaseId(), taskid);
|
||||
try {
|
||||
IosCaseExecution.caseExcution(testcase, steps, taskid, iosd, caselog, pcplist);
|
||||
IosCaseExecution.caseExcution(testcase, steps, taskid,null, iosd, caselog, pcplist);
|
||||
} catch (Exception e) {
|
||||
// TODO Auto-generated catch block
|
||||
LogUtil.APP.error("用户执行过程中抛出异常!", e);
|
||||
|
|
|
@ -37,8 +37,8 @@ public class IosCaseExecution{
|
|||
static Map<String, String> variable = new HashMap<>();
|
||||
private static String casenote = "备注初始化";
|
||||
|
||||
public static void caseExcution(ProjectCase testcase, List<ProjectCaseSteps> steps,String taskid, IOSDriver<IOSElement> appium,serverOperation caselog,List<ProjectCaseParams> pcplist) {
|
||||
caselog.updateTaskCaseExecuteStatus(taskid, testcase.getCaseId(), 3);
|
||||
public static void caseExcution(ProjectCase testcase, List<ProjectCaseSteps> steps,String taskid,Integer planId, IOSDriver<IOSElement> appium,serverOperation caselog,List<ProjectCaseParams> pcplist) {
|
||||
caselog.updateTaskCaseExecuteStatus(taskid,planId, testcase.getCaseId(), 3);
|
||||
// 把公共参数加入到MAP中
|
||||
for (ProjectCaseParams pcp : pcplist) {
|
||||
variable.put(pcp.getParamsName(), pcp.getParamsValue());
|
||||
|
@ -109,7 +109,7 @@ public class IosCaseExecution{
|
|||
}
|
||||
|
||||
variable.clear();
|
||||
caselog.updateTaskCaseExecuteStatus(taskid, testcase.getCaseId(), setcaseresult);
|
||||
caselog.updateTaskCaseExecuteStatus(taskid, planId,testcase.getCaseId(), setcaseresult);
|
||||
if(setcaseresult==0){
|
||||
LogUtil.APP.info("用例【{}】全部步骤执行结果成功...",testcase.getCaseSign());
|
||||
caselog.insertTaskCaseLog(taskid, testcase.getCaseId(), "用例全部步骤执行结果成功","info", "ending","");
|
||||
|
|
|
@ -34,7 +34,7 @@ public class IosCaseLocalDebug {
|
|||
.cgetParamsByProjectid(String.valueOf(testcase.getProjectId()));
|
||||
LogUtil.APP.info("开始执行用例:【{}】......",testCaseExternalId);
|
||||
List<ProjectCaseSteps> steps = GetServerApi.getStepsbycaseid(testcase.getCaseId());
|
||||
IosCaseExecution.caseExcution(testcase, steps, "888888", iosdriver, caselog, pcplist);
|
||||
IosCaseExecution.caseExcution(testcase, steps, "888888",null, iosdriver, caselog, pcplist);
|
||||
|
||||
LogUtil.APP.info("当前用例:【{}】执行完成......进入下一条",testcase.getCaseSign());
|
||||
} catch (Exception e) {
|
||||
|
|
|
@ -57,7 +57,7 @@ public class IosOneCaseExecute {
|
|||
LogUtil.APP.info("开始执行用例:【{}】......",testcase.getCaseSign());
|
||||
try {
|
||||
List<ProjectCaseSteps> steps = GetServerApi.getStepsbycaseid(testcase.getCaseId());
|
||||
IosCaseExecution.caseExcution(testcase, steps, taskid, iosd, caselog, pcplist);
|
||||
IosCaseExecution.caseExcution(testcase, steps, taskid,null, iosd, caselog, pcplist);
|
||||
LogUtil.APP.info("当前用例:【{}】执行完成......进入下一条",testcase.getCaseSign());
|
||||
} catch (Exception e) {
|
||||
LogUtil.APP.error("用户执行过程中抛出异常!", e);
|
||||
|
|
|
@ -29,6 +29,9 @@ public class ParamsManageForSteps {
|
|||
* @date 2019年1月15日
|
||||
*/
|
||||
public static String paramsManage(String params) {
|
||||
if(null==params){
|
||||
return params;
|
||||
}
|
||||
ParamsManageForSteps pmfs = new ParamsManageForSteps();
|
||||
params = pmfs.replaceRandomInt(params);
|
||||
params = pmfs.replaceTimeNow(params);
|
||||
|
|
|
@ -10,11 +10,7 @@ import com.offbytwo.jenkins.model.BuildResult;
|
|||
|
||||
import luckyclient.remote.api.GetServerApi;
|
||||
import luckyclient.remote.api.serverOperation;
|
||||
import luckyclient.remote.entity.ProjectCase;
|
||||
import luckyclient.remote.entity.ProjectCaseParams;
|
||||
import luckyclient.remote.entity.ProjectCaseSteps;
|
||||
import luckyclient.remote.entity.TaskExecute;
|
||||
import luckyclient.remote.entity.TaskScheduling;
|
||||
import luckyclient.remote.entity.*;
|
||||
import luckyclient.tool.jenkins.BuildingInitialization;
|
||||
import luckyclient.tool.mail.HtmlMail;
|
||||
import luckyclient.tool.mail.MailSendInitialization;
|
||||
|
@ -64,7 +60,7 @@ public class TestControl {
|
|||
continue;
|
||||
}
|
||||
THREAD_COUNT++; // 多线程计数++,用于检测线程是否全部执行完
|
||||
threadExecute.execute(new ThreadForExecuteCase(testcase, steps, taskid, pcplist, caselog));
|
||||
threadExecute.execute(new ThreadForExecuteCase(testcase, steps, taskid,null, pcplist, caselog));
|
||||
}
|
||||
// 多线程计数,用于检测线程是否全部执行完
|
||||
int i = 0;
|
||||
|
@ -105,50 +101,72 @@ public class TestControl {
|
|||
ThreadPoolExecutor threadExecute = new ThreadPoolExecutor(threadcount, 20, 3, TimeUnit.SECONDS,
|
||||
new ArrayBlockingQueue<>(1000), new ThreadPoolExecutor.CallerRunsPolicy());
|
||||
|
||||
List<ProjectCase> cases = GetServerApi.getCasesbyplanId(taskScheduling.getPlanId());
|
||||
LogUtil.APP.info("当前测试任务 {} 中共有【{}】条待测试用例...",task.getTaskName(),cases.size());
|
||||
serverOperation.updateTaskExecuteStatusIng(taskid, cases.size());
|
||||
int casepriority = 0;
|
||||
for (int j = 0; j < cases.size(); j++) {
|
||||
ProjectCase projectcase = cases.get(j);
|
||||
List<ProjectCaseSteps> steps = GetServerApi.getStepsbycaseid(projectcase.getCaseId());
|
||||
if (steps.size() == 0) {
|
||||
caselog.insertTaskCaseExecute(taskid, taskScheduling.getProjectId(),projectcase.getCaseId(),projectcase.getCaseSign(), projectcase.getCaseName(), 2);
|
||||
LogUtil.APP.warn("用例【{}】没有找到步骤,直接跳过,请检查!",projectcase.getCaseSign());
|
||||
caselog.insertTaskCaseLog(taskid, projectcase.getCaseId(), "在用例中没有找到步骤,请检查", "error", "1", "");
|
||||
continue;
|
||||
}
|
||||
// 多线程计数,如果用例设置了优先级,必须等优先级高的用例执行完成,才继续后面的用例
|
||||
if (casepriority < projectcase.getPriority()) {
|
||||
LogUtil.APP.info("用例编号:{} 上条用例优先级:{} 当前用例优先级:{}",projectcase.getCaseSign(),casepriority,projectcase.getPriority());
|
||||
int i = 0;
|
||||
while (THREAD_COUNT != 0) {
|
||||
i++;
|
||||
if (i > timeout * 60 * 5 / cases.size()) {
|
||||
LogUtil.APP.warn("用例编号:{} 上条用例优先级:{} 当前用例优先级:{} 等待时间已经超过设置的用例平均超时间{}秒(计算公式:任务超时时间*5/用例总数),现在继续往下执行...",projectcase.getCaseSign(),casepriority,projectcase.getPriority(),i);
|
||||
break;
|
||||
}
|
||||
Thread.sleep(1000);
|
||||
List<ProjectPlan> plans=new ArrayList<>();
|
||||
|
||||
// 单计划执行
|
||||
if(taskScheduling.getPlanType()==1){
|
||||
ProjectPlan projectPlan=new ProjectPlan();
|
||||
projectPlan.setPlanId(taskScheduling.getPlanId());
|
||||
plans.add(projectPlan);
|
||||
}
|
||||
// 聚合多计划执行
|
||||
else if(taskScheduling.getPlanType()==2){
|
||||
plans.addAll(GetServerApi.getPlansbysuiteId(taskScheduling.getSuiteId()));
|
||||
}
|
||||
LogUtil.APP.info("当前测试任务 {} 中共有【{}】条测试计划...",task.getTaskName(),plans.size());
|
||||
|
||||
int caseCount=0;
|
||||
int taskStatus = 2;
|
||||
for(ProjectPlan pp:plans){
|
||||
List<ProjectCase> cases = GetServerApi.getCasesbyplanId(pp.getPlanId());
|
||||
caseCount+=cases.size();
|
||||
}
|
||||
|
||||
for(ProjectPlan pp:plans) {
|
||||
List<ProjectCase> cases = GetServerApi.getCasesbyplanId(pp.getPlanId());
|
||||
LogUtil.APP.info("当前测试计划 {} 中共有【{}】条待测试用例...", pp.getPlanName(), cases.size());
|
||||
serverOperation.updateTaskExecuteStatusIng(taskid, caseCount);
|
||||
int casepriority = 0;
|
||||
for (int j = 0; j < cases.size(); j++) {
|
||||
ProjectCase projectcase = cases.get(j);
|
||||
List<ProjectCaseSteps> steps = GetServerApi.getStepsbycaseid(projectcase.getCaseId());
|
||||
if (steps.size() == 0) {
|
||||
caselog.insertTaskCaseExecute(taskid, taskScheduling.getProjectId(),pp.getPlanId(), projectcase.getCaseId(), projectcase.getCaseSign(), projectcase.getCaseName(), 2);
|
||||
LogUtil.APP.warn("用例【{}】没有找到步骤,直接跳过,请检查!", projectcase.getCaseSign());
|
||||
caselog.insertTaskCaseLog(taskid, projectcase.getCaseId(), "在用例中没有找到步骤,请检查", "error", "1", "");
|
||||
continue;
|
||||
}
|
||||
// 多线程计数,如果用例设置了优先级,必须等优先级高的用例执行完成,才继续后面的用例
|
||||
if (casepriority < projectcase.getPriority()) {
|
||||
LogUtil.APP.info("用例编号:{} 上条用例优先级:{} 当前用例优先级:{}", projectcase.getCaseSign(), casepriority, projectcase.getPriority());
|
||||
int i = 0;
|
||||
while (THREAD_COUNT != 0) {
|
||||
i++;
|
||||
if (i > timeout * 60 * 5 / cases.size()) {
|
||||
LogUtil.APP.warn("用例编号:{} 上条用例优先级:{} 当前用例优先级:{} 等待时间已经超过设置的用例平均超时间{}秒(计算公式:任务超时时间*5/用例总数),现在继续往下执行...", projectcase.getCaseSign(), casepriority, projectcase.getPriority(), i);
|
||||
break;
|
||||
}
|
||||
Thread.sleep(1000);
|
||||
}
|
||||
}
|
||||
casepriority = projectcase.getPriority();
|
||||
THREAD_COUNT++; // 多线程计数++,用于检测线程是否全部执行完
|
||||
LogUtil.APP.info("开始执行当前测试任务 {} 的第【{}】条测试用例...", task.getTaskName(), j + 1);
|
||||
threadExecute.execute(new ThreadForExecuteCase(projectcase, steps, taskid,pp.getPlanId(), pcplist, caselog));
|
||||
}
|
||||
casepriority = projectcase.getPriority();
|
||||
THREAD_COUNT++; // 多线程计数++,用于检测线程是否全部执行完
|
||||
LogUtil.APP.info("开始执行当前测试任务 {} 的第【{}】条测试用例...",task.getTaskName(),j+1);
|
||||
threadExecute.execute(new ThreadForExecuteCase(projectcase, steps, taskid, pcplist, caselog));
|
||||
}
|
||||
// 多线程计数,用于检测线程是否全部执行完
|
||||
int i = 0;
|
||||
int taskStatus=2;
|
||||
while (THREAD_COUNT != 0) {
|
||||
i++;
|
||||
if (i > timeout * 10) {
|
||||
taskStatus=3;
|
||||
LogUtil.APP.warn("当前测试任务 {} 执行已经超过设置的最大任务超时时间【{}】分钟,现在即将停止任务执行...",task.getTaskName(),timeout);
|
||||
break;
|
||||
// 多线程计数,用于检测线程是否全部执行完
|
||||
int i = 0;
|
||||
while (THREAD_COUNT != 0) {
|
||||
i++;
|
||||
if (i > timeout * 10) {
|
||||
taskStatus = 3;
|
||||
LogUtil.APP.warn("当前测试任务 {} 执行已经超过设置的最大任务超时时间【{}】分钟,现在即将停止任务执行...", task.getTaskName(), timeout);
|
||||
break;
|
||||
}
|
||||
Thread.sleep(6000);
|
||||
}
|
||||
Thread.sleep(6000);
|
||||
}
|
||||
tastcount = serverOperation.updateTaskExecuteData(taskid, cases.size(),taskStatus);
|
||||
tastcount = serverOperation.updateTaskExecuteData(taskid, caseCount,taskStatus);
|
||||
|
||||
String testtime = serverOperation.getTestTime(taskid);
|
||||
MailSendInitialization.sendMailInitialization(HtmlMail.htmlSubjectFormat(jobname),
|
||||
|
|
|
@ -36,17 +36,19 @@ public class ThreadForExecuteCase extends Thread {
|
|||
private String caseSign;
|
||||
private ProjectCase testcase;
|
||||
private String taskid;
|
||||
private Integer planId;
|
||||
private Integer projectId;
|
||||
private List<ProjectCaseSteps> steps;
|
||||
private List<ProjectCaseParams> pcplist;
|
||||
private serverOperation caselog;
|
||||
|
||||
public ThreadForExecuteCase(ProjectCase projectcase, List<ProjectCaseSteps> steps, String taskid, List<ProjectCaseParams> pcplist, serverOperation caselog) {
|
||||
public ThreadForExecuteCase(ProjectCase projectcase, List<ProjectCaseSteps> steps, String taskid,Integer planId, List<ProjectCaseParams> pcplist, serverOperation caselog) {
|
||||
this.caseId = projectcase.getCaseId();
|
||||
this.testcase = projectcase;
|
||||
this.projectId = projectcase.getProjectId();
|
||||
this.caseSign = projectcase.getCaseSign();
|
||||
this.taskid = taskid;
|
||||
this.planId=planId;
|
||||
this.steps = steps;
|
||||
this.pcplist = pcplist;
|
||||
this.caselog = caselog;
|
||||
|
@ -71,7 +73,7 @@ public class ThreadForExecuteCase extends Thread {
|
|||
int stepJumpNo=0;
|
||||
// 进入循环,解析单个用例所有步骤
|
||||
// 插入开始执行的用例
|
||||
caselog.insertTaskCaseExecute(taskid, projectId, caseId, caseSign, testcase.getCaseName(), 3);
|
||||
caselog.insertTaskCaseExecute(taskid, projectId, planId,caseId, caseSign, testcase.getCaseName(), 3);
|
||||
for (int i = 0; i < steps.size(); i++) {
|
||||
//处理步骤跳转语法
|
||||
if(stepJumpNo!=0&&setcaseresult!=0){
|
||||
|
@ -274,7 +276,7 @@ public class ThreadForExecuteCase extends Thread {
|
|||
caselog.insertTaskCaseLog(taskid, caseId, "设置执行结果为锁定,请参考错误日志查找锁定用例的原因.....", "error", "SETCASERESULT...", "");
|
||||
setcaseresult = 2;
|
||||
}
|
||||
caselog.updateTaskCaseExecuteStatus(taskid, caseId, setcaseresult);
|
||||
caselog.updateTaskCaseExecuteStatus(taskid, planId,caseId, setcaseresult);
|
||||
if (0 == setcaseresult) {
|
||||
LogUtil.APP.info("用例:{}执行结果成功......",testcase.getCaseSign());
|
||||
caselog.insertTaskCaseLog(taskid, caseId, "用例步骤执行全部成功......", "info", "ending", "");
|
||||
|
|
|
@ -41,7 +41,7 @@ public class CaseLocalDebug{
|
|||
List<ProjectCaseParams> pcplist=GetServerApi.cgetParamsByProjectid(String.valueOf(testcase.getProjectId()));
|
||||
LogUtil.APP.info("开始执行用例:【{}】......",testCaseExternalId);
|
||||
List<ProjectCaseSteps> steps=GetServerApi.getStepsbycaseid(testcase.getCaseId());
|
||||
WebCaseExecution.caseExcution(testcase,steps, "888888",wd,caselog,pcplist);
|
||||
WebCaseExecution.caseExcution(testcase,steps, "888888",null,wd,caselog,pcplist);
|
||||
LogUtil.APP.info("当前用例:【{}】执行完成......进入下一条",testcase.getCaseSign());
|
||||
} catch (Exception e) {
|
||||
LogUtil.APP.error("用户执行过程中抛出异常!", e);
|
||||
|
|
|
@ -1,39 +1,33 @@
|
|||
package luckyclient.execution.webdriver;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.openqa.selenium.WebDriver;
|
||||
import org.openqa.selenium.WebDriverException;
|
||||
|
||||
import com.offbytwo.jenkins.model.BuildResult;
|
||||
|
||||
import luckyclient.execution.httpinterface.TestControl;
|
||||
import luckyclient.execution.webdriver.ex.WebCaseExecution;
|
||||
import luckyclient.remote.api.GetServerApi;
|
||||
import luckyclient.remote.api.serverOperation;
|
||||
import luckyclient.remote.entity.ProjectCase;
|
||||
import luckyclient.remote.entity.ProjectCaseParams;
|
||||
import luckyclient.remote.entity.ProjectCaseSteps;
|
||||
import luckyclient.remote.entity.TaskExecute;
|
||||
import luckyclient.remote.entity.TaskScheduling;
|
||||
import luckyclient.remote.entity.*;
|
||||
import luckyclient.tool.jenkins.BuildingInitialization;
|
||||
import luckyclient.tool.mail.HtmlMail;
|
||||
import luckyclient.tool.mail.MailSendInitialization;
|
||||
import luckyclient.tool.shell.RestartServerInitialization;
|
||||
import luckyclient.utils.LogUtil;
|
||||
import org.openqa.selenium.WebDriver;
|
||||
import org.openqa.selenium.WebDriverException;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* =================================================================
|
||||
* 这是一个受限制的自由软件!您不能在任何未经允许的前提下对程序代码进行修改和用于商业用途;也不允许对程序代码修改后以任何形式任何目的的再发布。
|
||||
* 为了尊重作者的劳动成果,LuckyFrame关键版权信息严禁篡改 有任何疑问欢迎联系作者讨论。 QQ:1573584944 seagull1985
|
||||
* =================================================================
|
||||
*
|
||||
*
|
||||
* @author: seagull
|
||||
*
|
||||
*
|
||||
* @date 2017年12月1日 上午9:29:40
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class WebTestControl {
|
||||
|
||||
|
@ -68,7 +62,7 @@ public class WebTestControl {
|
|||
i++;
|
||||
LogUtil.APP.info("开始执行第{}条用例:【{}】......",i,testcase.getCaseSign());
|
||||
try {
|
||||
WebCaseExecution.caseExcution(testcase, steps, taskid, wd, caselog, pcplist);
|
||||
WebCaseExecution.caseExcution(testcase, steps, taskid, null,wd, caselog, pcplist);
|
||||
} catch (Exception e) {
|
||||
LogUtil.APP.error("用户执行过程中抛出异常!", e);
|
||||
}
|
||||
|
@ -87,58 +81,82 @@ public class WebTestControl {
|
|||
TestControl.TASKID = taskid;
|
||||
String restartstatus = RestartServerInitialization.restartServerRun(taskid);
|
||||
BuildResult buildResult = BuildingInitialization.buildingRun(taskid);
|
||||
List<ProjectCaseParams> pcplist = GetServerApi.cgetParamsByProjectid(task.getProjectId().toString());
|
||||
TaskScheduling taskScheduling = GetServerApi.cGetTaskSchedulingByTaskId(task.getTaskId());
|
||||
List<ProjectCaseParams> pcplist = GetServerApi.cgetParamsByProjectid(task.getProjectId().toString());
|
||||
String projectname = taskScheduling.getProject().getProjectName();
|
||||
task = GetServerApi.cgetTaskbyid(Integer.parseInt(taskid));
|
||||
String jobname = taskScheduling.getSchedulingName();
|
||||
int drivertype = serverOperation.querydrivertype(taskid);
|
||||
int[] tastcount;
|
||||
int[] tastcount=new int[5];
|
||||
// 判断是否要自动重启TOMCAT
|
||||
if (restartstatus.contains("Status:true")) {
|
||||
// 判断是否构建是否成功
|
||||
if (BuildResult.SUCCESS.equals(buildResult)) {
|
||||
WebDriver wd = null;
|
||||
try {
|
||||
wd = WebDriverInitialization.setWebDriverForTask(drivertype);
|
||||
} catch (WebDriverException e1) {
|
||||
LogUtil.APP.error("初始化WebDriver出错 WebDriverException!", e1);
|
||||
} catch (IOException e2) {
|
||||
LogUtil.APP.error("初始化WebDriver出错 IOException!", e2);
|
||||
}
|
||||
serverOperation caselog = new serverOperation();
|
||||
|
||||
List<ProjectCase> cases = GetServerApi.getCasesbyplanId(taskScheduling.getPlanId());
|
||||
LogUtil.APP.info("当前测试任务 {} 中共有【{}】条待测试用例...",task.getTaskName(),cases.size());
|
||||
serverOperation.updateTaskExecuteStatusIng(taskid, cases.size());
|
||||
int i = 0;
|
||||
for (ProjectCase testcase : cases) {
|
||||
i++;
|
||||
LogUtil.APP.info("开始执行当前测试任务 {} 的第【{}】条测试用例:【{}】......",task.getTaskName(),i,testcase.getCaseSign());
|
||||
List<ProjectCaseSteps> steps = GetServerApi.getStepsbycaseid(testcase.getCaseId());
|
||||
if (steps.size() == 0) {
|
||||
continue;
|
||||
}
|
||||
List<ProjectPlan> plans=new ArrayList<>();
|
||||
// 单计划执行
|
||||
if(taskScheduling.getPlanType()==1){
|
||||
ProjectPlan projectPlan=new ProjectPlan();
|
||||
projectPlan.setPlanId(taskScheduling.getPlanId());
|
||||
plans.add(projectPlan);
|
||||
}
|
||||
// 聚合多计划执行
|
||||
else if(taskScheduling.getPlanType()==2){
|
||||
plans.addAll(GetServerApi.getPlansbysuiteId(taskScheduling.getSuiteId()));
|
||||
}
|
||||
LogUtil.APP.info("当前测试任务 {} 中共有【{}】条测试计划...",task.getTaskName(),plans.size());
|
||||
|
||||
int caseCount=0;
|
||||
for(ProjectPlan pp:plans){
|
||||
List<ProjectCase> cases = GetServerApi.getCasesbyplanId(pp.getPlanId());
|
||||
caseCount+=cases.size();
|
||||
}
|
||||
|
||||
for(ProjectPlan pp:plans){
|
||||
WebDriver wd = null;
|
||||
try {
|
||||
// 插入开始执行的用例
|
||||
caselog.insertTaskCaseExecute(taskid, taskScheduling.getProjectId(),testcase.getCaseId(),testcase.getCaseSign(), testcase.getCaseName(), 4);
|
||||
WebCaseExecution.caseExcution(testcase, steps, taskid, wd, caselog, pcplist);
|
||||
} catch (Exception e) {
|
||||
// TODO Auto-generated catch block
|
||||
LogUtil.APP.error("用户执行过程中抛出异常!", e);
|
||||
wd = WebDriverInitialization.setWebDriverForTask(drivertype);
|
||||
} catch (WebDriverException e1) {
|
||||
LogUtil.APP.error("初始化WebDriver出错 WebDriverException!", e1);
|
||||
} catch (IOException e2) {
|
||||
LogUtil.APP.error("初始化WebDriver出错 IOException!", e2);
|
||||
}
|
||||
LogUtil.APP.info("当前用例:【{}】执行完成......进入下一条",testcase.getCaseSign());
|
||||
}
|
||||
tastcount = serverOperation.updateTaskExecuteData(taskid, cases.size(),2);
|
||||
|
||||
serverOperation caselog = new serverOperation();
|
||||
List<ProjectCase> cases = GetServerApi.getCasesbyplanId(pp.getPlanId());
|
||||
LogUtil.APP.info("当前测试计划 {} 中共有【{}】条待测试用例...",pp.getPlanName(),cases.size());
|
||||
LogUtil.APP.info("开始执行当前测试计划 {} ......",pp.getPlanName());
|
||||
serverOperation.updateTaskExecuteStatusIng(taskid, caseCount);
|
||||
int i = 0;
|
||||
for (ProjectCase testcase : cases) {
|
||||
i++;
|
||||
LogUtil.APP.info("开始执行当前测试任务 {} 的第【{}】条测试用例:【{}】......",task.getTaskName(),i,testcase.getCaseSign());
|
||||
List<ProjectCaseSteps> steps = GetServerApi.getStepsbycaseid(testcase.getCaseId());
|
||||
if (steps.size() == 0) {
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
// 插入开始执行的用例
|
||||
caselog.insertTaskCaseExecute(taskid, taskScheduling.getProjectId(),pp.getPlanId(),testcase.getCaseId(),testcase.getCaseSign(), testcase.getCaseName(), 4);
|
||||
WebCaseExecution.caseExcution(testcase, steps, taskid,pp.getPlanId(),wd, caselog, pcplist);
|
||||
} catch (Exception e) {
|
||||
// TODO Auto-generated catch block
|
||||
LogUtil.APP.error("用户执行过程中抛出异常!", e);
|
||||
}
|
||||
LogUtil.APP.info("当前用例:【{}】执行完成......进入下一条",testcase.getCaseSign());
|
||||
}
|
||||
LogUtil.APP.info("当前【{}】测试计划中的用例已经全部执行完成...",pp.getPlanName());
|
||||
assert wd != null;
|
||||
wd.quit();
|
||||
}
|
||||
|
||||
tastcount = serverOperation.updateTaskExecuteData(taskid, caseCount,2);
|
||||
tastcount[0]=caseCount;
|
||||
String testtime = serverOperation.getTestTime(taskid);
|
||||
LogUtil.APP.info("当前项目【{}】测试计划中的用例已经全部执行完成...",projectname);
|
||||
MailSendInitialization.sendMailInitialization(HtmlMail.htmlSubjectFormat(jobname),
|
||||
HtmlMail.htmlContentFormat(tastcount, taskid, buildResult.toString(), restartstatus, testtime, jobname),
|
||||
taskid, taskScheduling, tastcount,testtime,buildResult.toString(),restartstatus);
|
||||
// 关闭浏览器
|
||||
assert wd != null;
|
||||
wd.quit();
|
||||
} else {
|
||||
LogUtil.APP.warn("项目构建失败,自动化测试自动退出!请前往JENKINS中检查项目构建情况。");
|
||||
MailSendInitialization.sendMailInitialization(jobname, "构建项目过程中失败,自动化测试自动退出!请前去JENKINS查看构建情况!", taskid,
|
||||
|
|
|
@ -52,7 +52,7 @@ public class WebBatchExecute{
|
|||
//删除旧的日志
|
||||
serverOperation.deleteTaskCaseLog(testcase.getCaseId(), taskid);
|
||||
try {
|
||||
WebCaseExecution.caseExcution(testcase, steps, taskid, wd, caselog, pcplist);
|
||||
WebCaseExecution.caseExcution(testcase, steps, taskid,null, wd, caselog, pcplist);
|
||||
} catch (Exception e) {
|
||||
LogUtil.APP.error("用户执行过程中抛出异常!", e);
|
||||
}
|
||||
|
@ -65,7 +65,7 @@ public class WebBatchExecute{
|
|||
//删除旧的日志
|
||||
serverOperation.deleteTaskCaseLog(testcase.getCaseId(), taskid);
|
||||
try {
|
||||
WebCaseExecution.caseExcution(testcase, steps, taskid, wd, caselog, pcplist);
|
||||
WebCaseExecution.caseExcution(testcase, steps, taskid,null, wd, caselog, pcplist);
|
||||
} catch (Exception e) {
|
||||
LogUtil.APP.error("用户执行过程中抛出异常!", e);
|
||||
}
|
||||
|
|
|
@ -39,8 +39,8 @@ public class WebCaseExecution{
|
|||
private static Map<String, String> variable = new HashMap<>();
|
||||
private static String casenote = "备注初始化";
|
||||
|
||||
public static void caseExcution(ProjectCase testcase, List<ProjectCaseSteps> steps, String taskid, WebDriver wd, serverOperation caselog, List<ProjectCaseParams> pcplist) {
|
||||
caselog.updateTaskCaseExecuteStatus(taskid, testcase.getCaseId(), 3);
|
||||
public static void caseExcution(ProjectCase testcase, List<ProjectCaseSteps> steps, String taskid,Integer planId, WebDriver wd, serverOperation caselog, List<ProjectCaseParams> pcplist) {
|
||||
caselog.updateTaskCaseExecuteStatus(taskid,planId, testcase.getCaseId(), 3);
|
||||
// 把公共参数加入到MAP中
|
||||
for (ProjectCaseParams pcp : pcplist) {
|
||||
variable.put(pcp.getParamsName(), pcp.getParamsValue());
|
||||
|
@ -109,7 +109,7 @@ public class WebCaseExecution{
|
|||
}
|
||||
|
||||
variable.clear();
|
||||
caselog.updateTaskCaseExecuteStatus(taskid, testcase.getCaseId(), setcaseresult);
|
||||
caselog.updateTaskCaseExecuteStatus(taskid,planId, testcase.getCaseId(), setcaseresult);
|
||||
if (setcaseresult == 0) {
|
||||
LogUtil.APP.info("用例【{}】全部步骤执行结果成功...",testcase.getCaseSign());
|
||||
caselog.insertTaskCaseLog(taskid, testcase.getCaseId(), "用例全部步骤执行结果成功", "info", "ending", "");
|
||||
|
|
|
@ -47,7 +47,7 @@ public class WebOneCaseExecute{
|
|||
LogUtil.APP.info("开始执行用例:【{}】......",testcase.getCaseSign());
|
||||
try {
|
||||
List<ProjectCaseSteps> steps=GetServerApi.getStepsbycaseid(testcase.getCaseId());
|
||||
WebCaseExecution.caseExcution(testcase, steps, taskid,wd,caselog,pcplist);
|
||||
WebCaseExecution.caseExcution(testcase, steps, taskid,null,wd,caselog,pcplist);
|
||||
LogUtil.APP.info("当前用例:【{}】执行完成......进入下一条",testcase.getCaseSign());
|
||||
} catch (Exception e) {
|
||||
LogUtil.APP.error("用户执行过程中抛出异常!", e);
|
||||
|
|
|
@ -34,6 +34,16 @@ public class GetServerApi {
|
|||
return JSONObject.parseArray(result, ProjectCase.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过计划ID获取测试用例对象集
|
||||
* @param suiteId 测试计划ID
|
||||
* @return 返回用例List
|
||||
*/
|
||||
public static List<ProjectPlan> getPlansbysuiteId(int suiteId) {
|
||||
String result = HttpRequest.loadJSON(PREFIX+"/clientGetPlanListBySuiteId.do?suiteId=" + suiteId);
|
||||
return JSONObject.parseArray(result, ProjectPlan.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过计划名称获取测试用例对象集
|
||||
* @param name 测试计划名称
|
||||
|
|
|
@ -63,6 +63,19 @@ public class PostServerApi {
|
|||
|
||||
HttpRequest.httpClientPostJson(PREFIX+"/clientPostTaskCaseExecute", JSONObject.toJSONString(taskCaseExecute));
|
||||
}
|
||||
|
||||
public static void clientPostInsertTaskCaseExecute(Integer taskId, Integer projectId,Integer planId, Integer caseId, String caseSign, String caseName, Integer caseStatus){
|
||||
TaskCaseExecute taskCaseExecute = new TaskCaseExecute();
|
||||
taskCaseExecute.setTaskId(taskId);
|
||||
taskCaseExecute.setPlanId(planId);
|
||||
taskCaseExecute.setProjectId(projectId);
|
||||
taskCaseExecute.setCaseId(caseId);
|
||||
taskCaseExecute.setCaseSign(caseSign);
|
||||
taskCaseExecute.setCaseName(caseName);
|
||||
taskCaseExecute.setCaseStatus(caseStatus);
|
||||
|
||||
HttpRequest.httpClientPostJson(PREFIX+"/clientPostTaskCaseExecute", JSONObject.toJSONString(taskCaseExecute));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改用例执行状态
|
||||
|
@ -80,6 +93,16 @@ public class PostServerApi {
|
|||
|
||||
HttpRequest.httpClientPostJson(PREFIX+"/clientUpdateTaskCaseExecuteStatus", JSONObject.toJSONString(taskCaseExecute));
|
||||
}
|
||||
|
||||
public static void clientUpdateTaskCaseExecuteStatus(Integer taskId,Integer planId, Integer caseId, Integer caseStatus){
|
||||
TaskCaseExecute taskCaseExecute = new TaskCaseExecute();
|
||||
taskCaseExecute.setTaskId(taskId);
|
||||
taskCaseExecute.setPlanId(planId);
|
||||
taskCaseExecute.setCaseId(caseId);
|
||||
taskCaseExecute.setCaseStatus(caseStatus);
|
||||
|
||||
HttpRequest.httpClientPostJson(PREFIX+"/clientUpdateTaskCaseExecuteStatus", JSONObject.toJSONString(taskCaseExecute));
|
||||
}
|
||||
|
||||
/**
|
||||
* 插入用例执行明细到数据库
|
||||
|
|
|
@ -35,6 +35,16 @@ public class serverOperation {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 插入用例执行状态 0通过 1失败 2锁定 3执行中 4未执行
|
||||
*/
|
||||
public void insertTaskCaseExecute(String taskIdStr, Integer projectId,Integer planId,Integer caseId, String caseSign,String caseName, Integer caseStatus) {
|
||||
if (0 == exetype) {
|
||||
Integer taskId=Integer.valueOf(taskIdStr);
|
||||
PostServerApi.clientPostInsertTaskCaseExecute(taskId, projectId,planId, caseId, caseSign, caseName, caseStatus);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新用例执行状态 0通过 1失败 2锁定 3执行中 4未执行
|
||||
*/
|
||||
|
@ -45,6 +55,15 @@ public class serverOperation {
|
|||
}
|
||||
}
|
||||
|
||||
public void updateTaskCaseExecuteStatus(String taskIdStr,Integer planId, Integer caseId, Integer caseStatus) {
|
||||
if (0 == exetype) {
|
||||
Integer taskId=Integer.valueOf(taskIdStr);
|
||||
PostServerApi.clientUpdateTaskCaseExecuteStatus(taskId,planId, caseId, caseStatus);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 插入用例执行日志
|
||||
*/
|
||||
|
|
|
@ -0,0 +1,129 @@
|
|||
package luckyclient.remote.entity;
|
||||
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
public class ProjectSuite extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 聚合计划ID */
|
||||
private Integer suiteId;
|
||||
/** 聚合计划名称 */
|
||||
private String suiteName;
|
||||
/** 聚合中的计划总数 */
|
||||
private Integer suitePlanCount;
|
||||
/** 项目ID */
|
||||
private Integer projectId;
|
||||
/** 创建者 */
|
||||
private String createBy;
|
||||
/** 创建时间 */
|
||||
private Date createTime;
|
||||
/** 更新者 */
|
||||
private String updateBy;
|
||||
/** 更新时间 */
|
||||
private Date updateTime;
|
||||
/** 备注 */
|
||||
private String remark;
|
||||
/** 关联项目实体 */
|
||||
private Project project;
|
||||
|
||||
public Integer getSuiteId() {
|
||||
return suiteId;
|
||||
}
|
||||
|
||||
public void setSuiteId(Integer suiteId) {
|
||||
this.suiteId = suiteId;
|
||||
}
|
||||
|
||||
public String getSuiteName() {
|
||||
return suiteName;
|
||||
}
|
||||
|
||||
public void setSuiteName(String suiteName) {
|
||||
this.suiteName = suiteName;
|
||||
}
|
||||
|
||||
public Integer getSuitePlanCount() {
|
||||
return suitePlanCount;
|
||||
}
|
||||
|
||||
public void setSuitePlanCount(Integer suitePlanCount) {
|
||||
this.suitePlanCount = suitePlanCount;
|
||||
}
|
||||
|
||||
public Integer getProjectId() {
|
||||
return projectId;
|
||||
}
|
||||
|
||||
public void setProjectId(Integer projectId) {
|
||||
this.projectId = projectId;
|
||||
}
|
||||
|
||||
public String getCreateBy() {
|
||||
return createBy;
|
||||
}
|
||||
|
||||
public void setCreateBy(String createBy) {
|
||||
this.createBy = createBy;
|
||||
}
|
||||
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
public String getUpdateBy() {
|
||||
return updateBy;
|
||||
}
|
||||
|
||||
public void setUpdateBy(String updateBy) {
|
||||
this.updateBy = updateBy;
|
||||
}
|
||||
|
||||
public Date getUpdateTime() {
|
||||
return updateTime;
|
||||
}
|
||||
|
||||
public void setUpdateTime(Date updateTime) {
|
||||
this.updateTime = updateTime;
|
||||
}
|
||||
|
||||
public String getRemark() {
|
||||
return remark;
|
||||
}
|
||||
|
||||
public void setRemark(String remark) {
|
||||
this.remark = remark;
|
||||
}
|
||||
|
||||
public Project getProject() {
|
||||
return project;
|
||||
}
|
||||
|
||||
public void setProject(Project project) {
|
||||
this.project = project;
|
||||
}
|
||||
|
||||
public String toString(){
|
||||
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("suiteId", getSuiteId())
|
||||
.append("suiteName", getSuiteName())
|
||||
.append("suitePlanCount", getSuitePlanCount())
|
||||
.append("projectId", getProjectId())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("updateBy", getUpdateBy())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.append("remark", getRemark())
|
||||
.append("project", getProject())
|
||||
.toString();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -19,6 +19,8 @@ public class TaskCaseExecute extends BaseEntity
|
|||
private Integer taskCaseId;
|
||||
/** 任务ID */
|
||||
private Integer taskId;
|
||||
/** ¼Æ»®ID */
|
||||
private Integer planId;
|
||||
/** 项目ID */
|
||||
private Integer projectId;
|
||||
/** 用例ID */
|
||||
|
@ -58,6 +60,13 @@ public class TaskCaseExecute extends BaseEntity
|
|||
{
|
||||
return taskId;
|
||||
}
|
||||
public Integer getPlanId() {
|
||||
return planId;
|
||||
}
|
||||
|
||||
public void setPlanId(Integer planId) {
|
||||
this.planId = planId;
|
||||
}
|
||||
public void setProjectId(Integer projectId)
|
||||
{
|
||||
this.projectId = projectId;
|
||||
|
|
|
@ -15,7 +15,7 @@ import org.apache.commons.lang3.builder.ToStringStyle;
|
|||
public class TaskScheduling extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
/** 预约调度ID */
|
||||
private Integer schedulingId;
|
||||
/** 预约调度名称 */
|
||||
|
@ -26,6 +26,8 @@ public class TaskScheduling extends BaseEntity
|
|||
private Integer projectId;
|
||||
/** 测试计划ID */
|
||||
private Integer planId;
|
||||
/** 聚合计划ID */
|
||||
private Integer suiteId;
|
||||
/** 客户端ID */
|
||||
private Integer clientId;
|
||||
/** 环境 */
|
||||
|
@ -46,6 +48,8 @@ public class TaskScheduling extends BaseEntity
|
|||
private Integer taskType;
|
||||
/** UI自动化浏览器类型 0 IE 1 火狐 2 谷歌 3 Edge */
|
||||
private Integer browserType;
|
||||
/** 计划类型 1 单计划 2 聚合计划 */
|
||||
private Integer planType;
|
||||
/** 任务超时时间(分钟) */
|
||||
private Integer taskTimeout;
|
||||
/** 客户端测试驱动桩路径 */
|
||||
|
@ -54,12 +58,22 @@ public class TaskScheduling extends BaseEntity
|
|||
private Project project;
|
||||
/** 关联项目计划 */
|
||||
private ProjectPlan projectPlan;
|
||||
/** 关联聚合计划 */
|
||||
private ProjectSuite projectSuite;
|
||||
/** 任务名称 */
|
||||
private String jobName;
|
||||
/** cron执行表达式 */
|
||||
private String cronExpression;
|
||||
/** 任务状态(0正常 1暂停) */
|
||||
private String status;
|
||||
private String jobName;
|
||||
/** cron执行表达式 */
|
||||
private String cronExpression;
|
||||
/** 任务状态(0正常 1暂停) */
|
||||
private String status;
|
||||
|
||||
public Integer getSchedulingId() {
|
||||
return schedulingId;
|
||||
}
|
||||
|
||||
public void setSchedulingId(Integer schedulingId) {
|
||||
this.schedulingId = schedulingId;
|
||||
}
|
||||
|
||||
public String getSchedulingName() {
|
||||
return schedulingName;
|
||||
|
@ -69,6 +83,166 @@ public class TaskScheduling extends BaseEntity
|
|||
this.schedulingName = schedulingName;
|
||||
}
|
||||
|
||||
public Integer getJobId() {
|
||||
return jobId;
|
||||
}
|
||||
|
||||
public void setJobId(Integer jobId) {
|
||||
this.jobId = jobId;
|
||||
}
|
||||
|
||||
public Integer getProjectId() {
|
||||
return projectId;
|
||||
}
|
||||
|
||||
public void setProjectId(Integer projectId) {
|
||||
this.projectId = projectId;
|
||||
}
|
||||
|
||||
public Integer getPlanId() {
|
||||
return planId;
|
||||
}
|
||||
|
||||
public void setPlanId(Integer planId) {
|
||||
this.planId = planId;
|
||||
}
|
||||
|
||||
public Integer getSuiteId() {
|
||||
return suiteId;
|
||||
}
|
||||
|
||||
public void setSuiteId(Integer suiteId) {
|
||||
this.suiteId = suiteId;
|
||||
}
|
||||
|
||||
public Integer getClientId() {
|
||||
return clientId;
|
||||
}
|
||||
|
||||
public void setClientId(Integer clientId) {
|
||||
this.clientId = clientId;
|
||||
}
|
||||
|
||||
public String getEnvName() {
|
||||
return envName;
|
||||
}
|
||||
|
||||
public void setEnvName(String envName) {
|
||||
this.envName = envName;
|
||||
}
|
||||
|
||||
public String getEmailAddress() {
|
||||
return emailAddress;
|
||||
}
|
||||
|
||||
public void setEmailAddress(String emailAddress) {
|
||||
this.emailAddress = emailAddress;
|
||||
}
|
||||
|
||||
public String getPushUrl() {
|
||||
return pushUrl;
|
||||
}
|
||||
|
||||
public void setPushUrl(String pushUrl) {
|
||||
this.pushUrl = pushUrl;
|
||||
}
|
||||
|
||||
public Integer getEmailSendCondition() {
|
||||
return emailSendCondition;
|
||||
}
|
||||
|
||||
public void setEmailSendCondition(Integer emailSendCondition) {
|
||||
this.emailSendCondition = emailSendCondition;
|
||||
}
|
||||
|
||||
public String getBuildingLink() {
|
||||
return buildingLink;
|
||||
}
|
||||
|
||||
public void setBuildingLink(String buildingLink) {
|
||||
this.buildingLink = buildingLink;
|
||||
}
|
||||
|
||||
public String getRemoteShell() {
|
||||
return remoteShell;
|
||||
}
|
||||
|
||||
public void setRemoteShell(String remoteShell) {
|
||||
this.remoteShell = remoteShell;
|
||||
}
|
||||
|
||||
public Integer getExThreadCount() {
|
||||
return exThreadCount;
|
||||
}
|
||||
|
||||
public void setExThreadCount(Integer exThreadCount) {
|
||||
this.exThreadCount = exThreadCount;
|
||||
}
|
||||
|
||||
public Integer getTaskType() {
|
||||
return taskType;
|
||||
}
|
||||
|
||||
public void setTaskType(Integer taskType) {
|
||||
this.taskType = taskType;
|
||||
}
|
||||
|
||||
public Integer getBrowserType() {
|
||||
return browserType;
|
||||
}
|
||||
|
||||
public void setBrowserType(Integer browserType) {
|
||||
this.browserType = browserType;
|
||||
}
|
||||
|
||||
public Integer getPlanType() {
|
||||
return planType;
|
||||
}
|
||||
|
||||
public void setPlanType(Integer planType) {
|
||||
this.planType = planType;
|
||||
}
|
||||
|
||||
public Integer getTaskTimeout() {
|
||||
return taskTimeout;
|
||||
}
|
||||
|
||||
public void setTaskTimeout(Integer taskTimeout) {
|
||||
this.taskTimeout = taskTimeout;
|
||||
}
|
||||
|
||||
public String getClientDriverPath() {
|
||||
return clientDriverPath;
|
||||
}
|
||||
|
||||
public void setClientDriverPath(String clientDriverPath) {
|
||||
this.clientDriverPath = clientDriverPath;
|
||||
}
|
||||
|
||||
public Project getProject() {
|
||||
return project;
|
||||
}
|
||||
|
||||
public void setProject(Project project) {
|
||||
this.project = project;
|
||||
}
|
||||
|
||||
public ProjectPlan getProjectPlan() {
|
||||
return projectPlan;
|
||||
}
|
||||
|
||||
public void setProjectPlan(ProjectPlan projectPlan) {
|
||||
this.projectPlan = projectPlan;
|
||||
}
|
||||
|
||||
public ProjectSuite getProjectSuite() {
|
||||
return projectSuite;
|
||||
}
|
||||
|
||||
public void setProjectSuite(ProjectSuite projectSuite) {
|
||||
this.projectSuite = projectSuite;
|
||||
}
|
||||
|
||||
public String getJobName() {
|
||||
return jobName;
|
||||
}
|
||||
|
@ -93,186 +267,28 @@ public class TaskScheduling extends BaseEntity
|
|||
this.status = status;
|
||||
}
|
||||
|
||||
public ProjectPlan getProjectPlan() {
|
||||
return projectPlan;
|
||||
}
|
||||
|
||||
public void setProjectPlan(ProjectPlan projectPlan) {
|
||||
this.projectPlan = projectPlan;
|
||||
}
|
||||
|
||||
public Project getProject() {
|
||||
return project;
|
||||
}
|
||||
|
||||
public void setProject(Project project) {
|
||||
this.project = project;
|
||||
}
|
||||
|
||||
public void setSchedulingId(Integer schedulingId)
|
||||
{
|
||||
this.schedulingId = schedulingId;
|
||||
}
|
||||
|
||||
public Integer getSchedulingId()
|
||||
{
|
||||
return schedulingId;
|
||||
}
|
||||
public void setJobId(Integer jobId)
|
||||
{
|
||||
this.jobId = jobId;
|
||||
}
|
||||
|
||||
public Integer getJobId()
|
||||
{
|
||||
return jobId;
|
||||
}
|
||||
public void setProjectId(Integer projectId)
|
||||
{
|
||||
this.projectId = projectId;
|
||||
}
|
||||
|
||||
public Integer getProjectId()
|
||||
{
|
||||
return projectId;
|
||||
}
|
||||
public void setPlanId(Integer planId)
|
||||
{
|
||||
this.planId = planId;
|
||||
}
|
||||
|
||||
public Integer getPlanId()
|
||||
{
|
||||
return planId;
|
||||
}
|
||||
public void setClientId(Integer clientId)
|
||||
{
|
||||
this.clientId = clientId;
|
||||
}
|
||||
|
||||
public Integer getClientId()
|
||||
{
|
||||
return clientId;
|
||||
}
|
||||
public void setEmailAddress(String emailAddress)
|
||||
{
|
||||
this.emailAddress = emailAddress;
|
||||
}
|
||||
|
||||
public String getEnvName() {
|
||||
return envName;
|
||||
}
|
||||
|
||||
public void setEnvName(String envName) {
|
||||
this.envName = envName;
|
||||
}
|
||||
|
||||
public String getEmailAddress()
|
||||
{
|
||||
return emailAddress;
|
||||
}
|
||||
|
||||
public void setPushUrl(String pushUrl)
|
||||
{
|
||||
this.pushUrl = pushUrl;
|
||||
}
|
||||
public String getPushUrl()
|
||||
{
|
||||
return pushUrl;
|
||||
}
|
||||
|
||||
public void setEmailSendCondition(Integer emailSendCondition)
|
||||
{
|
||||
this.emailSendCondition = emailSendCondition;
|
||||
}
|
||||
|
||||
public Integer getEmailSendCondition()
|
||||
{
|
||||
return emailSendCondition;
|
||||
}
|
||||
public void setBuildingLink(String buildingLink)
|
||||
{
|
||||
this.buildingLink = buildingLink;
|
||||
}
|
||||
|
||||
public String getBuildingLink()
|
||||
{
|
||||
return buildingLink;
|
||||
}
|
||||
public void setRemoteShell(String remoteShell)
|
||||
{
|
||||
this.remoteShell = remoteShell;
|
||||
}
|
||||
|
||||
public String getRemoteShell()
|
||||
{
|
||||
return remoteShell;
|
||||
}
|
||||
public void setExThreadCount(Integer exThreadCount)
|
||||
{
|
||||
this.exThreadCount = exThreadCount;
|
||||
}
|
||||
|
||||
public Integer getExThreadCount()
|
||||
{
|
||||
return exThreadCount;
|
||||
}
|
||||
public void setTaskType(Integer taskType)
|
||||
{
|
||||
this.taskType = taskType;
|
||||
}
|
||||
|
||||
public Integer getTaskType()
|
||||
{
|
||||
return taskType;
|
||||
}
|
||||
public void setBrowserType(Integer browserType)
|
||||
{
|
||||
this.browserType = browserType;
|
||||
}
|
||||
|
||||
public Integer getBrowserType()
|
||||
{
|
||||
return browserType;
|
||||
}
|
||||
public void setTaskTimeout(Integer taskTimeout)
|
||||
{
|
||||
this.taskTimeout = taskTimeout;
|
||||
}
|
||||
|
||||
public Integer getTaskTimeout()
|
||||
{
|
||||
return taskTimeout;
|
||||
}
|
||||
public void setClientDriverPath(String clientDriverPath)
|
||||
{
|
||||
this.clientDriverPath = clientDriverPath;
|
||||
}
|
||||
|
||||
public String getClientDriverPath()
|
||||
{
|
||||
return clientDriverPath;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("schedulingId", getSchedulingId())
|
||||
.append("jobId", getJobId())
|
||||
.append("projectId", getProjectId())
|
||||
.append("planId", getPlanId())
|
||||
.append("clientId", getClientId())
|
||||
.append("envName", getEnvName())
|
||||
.append("emailAddress", getEmailAddress())
|
||||
.append("pushUrl", getPushUrl())
|
||||
.append("emailSendCondition", getEmailSendCondition())
|
||||
.append("buildingLink", getBuildingLink())
|
||||
.append("remoteShell", getRemoteShell())
|
||||
.append("exThreadCount", getExThreadCount())
|
||||
.append("taskType", getTaskType())
|
||||
.append("browserType", getBrowserType())
|
||||
.append("taskTimeout", getTaskTimeout())
|
||||
.append("clientDriverPath", getClientDriverPath())
|
||||
.toString();
|
||||
}
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("schedulingId", getSchedulingId())
|
||||
.append("jobId", getJobId())
|
||||
.append("projectId", getProjectId())
|
||||
.append("planId", getPlanId())
|
||||
.append("suiteId", getSuiteId())
|
||||
.append("clientId", getClientId())
|
||||
.append("envName", getEnvName())
|
||||
.append("emailAddress", getEmailAddress())
|
||||
.append("pushUrl", getPushUrl())
|
||||
.append("emailSendCondition", getEmailSendCondition())
|
||||
.append("buildingLink", getBuildingLink())
|
||||
.append("remoteShell", getRemoteShell())
|
||||
.append("exThreadCount", getExThreadCount())
|
||||
.append("taskType", getTaskType())
|
||||
.append("planType", getPlanType())
|
||||
.append("browserType", getBrowserType())
|
||||
.append("taskTimeout", getTaskTimeout())
|
||||
.append("clientDriverPath", getClientDriverPath())
|
||||
.toString();
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue