Merge remote-tracking branch 'origin_gitee/Develop_Branch' into Develop_Branch

This commit is contained in:
seagull 2022-01-25 19:27:38 +08:00
commit 27111d0b29
28 changed files with 636 additions and 344 deletions

View File

@ -40,6 +40,8 @@ public class BatchCaseExecute extends TestControl {
TaskExecute task = GetServerApi.cgetTaskbyid(Integer.parseInt(taskid));
TaskScheduling taskScheduling = GetServerApi.cGetTaskSchedulingByTaskId(Integer.parseInt(taskid));
ClientHandler.clientId = taskScheduling.getClientId();
//获取到调度任务的环境信息
SchedulingConstants.envName=taskScheduling.getEnvName();
if (taskScheduling.getTaskType() == 0) {
BatchTestCaseExecution.batchCaseExecuteForTast(
String.valueOf(task.getTaskId()), batchcase);

View File

@ -39,6 +39,7 @@ public class OneCaseExecute extends TestControl {
TaskExecute task = GetServerApi.cgetTaskbyid(Integer.parseInt(taskId));
TaskScheduling taskScheduling = GetServerApi.cGetTaskSchedulingByTaskId(Integer.parseInt(taskId));
ClientHandler.clientId = taskScheduling.getClientId();
SchedulingConstants.envName=taskScheduling.getEnvName();
if (taskScheduling.getTaskType() == 0) {
// ½Ó¿Ú²âÊÔ
TestCaseExecution testCaseExecution=new TestCaseExecution();

View File

@ -33,6 +33,7 @@ public class RunAutomationTest extends TestControl {
TaskExecute task = GetServerApi.cgetTaskbyid(Integer.parseInt(taskid));
TaskScheduling taskScheduling = GetServerApi.cGetTaskSchedulingByTaskId(Integer.parseInt(taskid));
ClientHandler.clientId = taskScheduling.getClientId();
SchedulingConstants.envName=taskScheduling.getEnvName();
if (taskScheduling.getTaskType() == 0) {
// ½Ó¿Ú²âÊÔ
TestControl.taskExecutionPlan(task);

View File

@ -0,0 +1,7 @@
package luckyclient.execution;
public class SchedulingConstants {
//µ÷ÈÈÎÎñ»·¾³
public static String envName = "";
}

View File

@ -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);

View File

@ -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);

View File

@ -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);
}

View File

@ -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","");

View File

@ -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) {

View File

@ -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);

View File

@ -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);

View File

@ -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","");

View File

@ -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) {

View File

@ -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);

View File

@ -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);

View File

@ -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),

View File

@ -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", "");

View File

@ -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);

View File

@ -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,

View File

@ -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);
}

View File

@ -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", "");

View File

@ -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);

View File

@ -1,6 +1,7 @@
package luckyclient.remote.api;
import com.alibaba.fastjson.JSONObject;
import luckyclient.execution.SchedulingConstants;
import luckyclient.execution.dispose.ParamsManageForSteps;
import luckyclient.remote.entity.*;
import luckyclient.utils.httputils.HttpRequest;
@ -33,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 测试计划名称
@ -99,7 +110,7 @@ public class GetServerApi {
* @return 公共参数集合
*/
public static List<ProjectCaseParams> cgetParamsByProjectid(String projectid) {
String result = HttpRequest.loadJSON(PREFIX+"/clientGetParamsByProjectId.do?projectId="+projectid);
String result = HttpRequest.loadJSON(PREFIX+"/clientGetParamsByProjectIdAndEnvName.do?projectId="+projectid+"&envName="+ SchedulingConstants.envName);
List<ProjectCaseParams> paramsList = JSONObject.parseArray(result, ProjectCaseParams.class);
//当公共参数存在内置函数时先进行数据转换
for(ProjectCaseParams pcp:paramsList){

View File

@ -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));
}
/**
* 插入用例执行明细到数据库

View File

@ -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);
}
}
/**
* 插入用例执行日志
*/

View File

@ -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();
}
}

View File

@ -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;

View File

@ -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,8 +26,12 @@ public class TaskScheduling extends BaseEntity
private Integer projectId;
/** 测试计划ID */
private Integer planId;
/** 聚合计划ID */
private Integer suiteId;
/** 客户端ID */
private Integer clientId;
/** 环境 */
private String envName;
/** 邮件通知地址 */
private String emailAddress;
/** 第三方推送地址 */
@ -44,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;
/** 客户端测试驱动桩路径 */
@ -52,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;
@ -67,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;
}
@ -91,177 +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 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("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();
}
}