优化代码结构以及类名称

This commit is contained in:
seagull 2019-11-07 10:08:56 +08:00
parent b200c94d13
commit 7bb87e7585
118 changed files with 1117 additions and 851 deletions

View File

@ -302,5 +302,11 @@
<groupId>com.jayway.jsonpath</groupId>
<artifactId>json-path</artifactId>
</dependency>
<!-- Jenkins API -->
<dependency>
<groupId>com.offbytwo.jenkins</groupId>
<artifactId>jenkins-client</artifactId>
<version>0.3.8</version>
</dependency>
</dependencies>
</project>

View File

@ -1,6 +1,4 @@
spring.application.name = LuckyFrameClient
server.port = 6633
spring.servlet.multipart.max-file-size=30MB
spring.servlet.multipart.max-request-size=30MB

View File

@ -1,5 +1,5 @@
set classpath=%CLASSPATH%;.\lib;.\bin;
@echo 查找重复jar包输入包路径或是直接类名
@echo path="D:\\web_task\\TestFrame\\lib\\"
java -D luckyclient.publicclass.JarClassFind "D:\\web_task\\TestFrame\\lib\\" "TestLinkAPI"
java -D luckyclient.utils.JarClassFind "D:\\web_task\\TestFrame\\lib\\" "TestLinkAPI"
pause

View File

@ -2,7 +2,7 @@
client.verison=3.1 Beta
server.web.ip=localhost
server.web.port=80
#==================================邮件============================================
#================================ 邮件=======================================
#smtp邮件IP 例smtp.qq.com
mail.smtp.ip=smtp.qq.com
#smtp邮件端口 例25
@ -15,8 +15,15 @@ mail.smtp.username=xxxxx@xx.com
mail.smtp.password=xxxxx
#邮件模板路径
mail.freemarker.template=/email_template/
#==================================向第三方应用推送任务执行结果(JSON)============================================
#==================向第三方应用推送任务执行结果(JSON)========================
#第三方平台推送开关 true打开 false关闭
task.push.switch=false
#第三方平台推送URL
task.push.url=localhost
task.push.url=localhost
#==================Jenkins API配置========================
#jenkins访问地址示例 http://192.168.100.100:8080/jenkins/
jenkins.url=http://localhost
#jenkins用户名
jenkins.username=test
#jenkins密码
jenkins.password=test1

View File

@ -2,7 +2,7 @@ title
set classpath=%CLASSPATH%;.\luckyclient;
@echo 指定任务执行
@echo 项目名称 任务ID
java -Djava.ext.dirs=./lib;.%2 luckyclient.caserun.RunAutomationTest %1
java -Djava.ext.dirs=./lib;.%2 luckyclient.execution.RunAutomationTest %1
@echo 当前测试任务执行窗口将在90秒后退出
ping 127.0.0.1 -n 90 >nul
exit

View File

@ -3,7 +3,7 @@ BASE_DIR="."
LIB="${BASE_DIR}/lib"
DRIVENPATH="${BASE_DIR}/$2"
JAVA_OPTS=" -Xmx2048m -XX:PermSize=64m -XX:MaxPermSize=512m -XX:+PrintGCDateStamps -XX:+PrintGCDetails -Xloggc:logs/gc.log -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=1 -XX:GCLogFileSize=1024k -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=logs/mtdperf.hprof -server -Dfile.encoding=UTF-8"
START_CLASS="luckyclient.caserun.RunAutomationTest $1"
START_CLASS="luckyclient.execution.RunAutomationTest $1"
echo ${LIB}

View File

@ -2,7 +2,7 @@ title
set classpath=%CLASSPATH%;.\luckyclient;
@echo 批量执行用例
@echo 参数说明 依次为:项目名称 tastId 用例集
java -Djava.ext.dirs=./lib;.%3 luckyclient.caserun.BatchCaseExecute %1 %2
java -Djava.ext.dirs=./lib;.%3 luckyclient.execution.BatchCaseExecute %1 %2
@echo 当前用例批量执行窗口将在90秒后退出
ping 127.0.0.1 -n 90 >nul
exit

View File

@ -3,7 +3,7 @@ BASE_DIR="."
LIB="${BASE_DIR}/lib"
DRIVENPATH="${BASE_DIR}/$3"
JAVA_OPTS=" -Xmx2048m -XX:PermSize=64m -XX:MaxPermSize=512m -XX:+PrintGCDateStamps -XX:+PrintGCDetails -Xloggc:logs/gc.log -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=1 -XX:GCLogFileSize=1024k -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=logs/mtdperf.hprof -server -Dfile.encoding=UTF-8"
START_CLASS="luckyclient.caserun.BatchCaseExecute $1 $2"
START_CLASS="luckyclient.execution.BatchCaseExecute $1 $2"
echo ${LIB}

View File

@ -2,7 +2,7 @@ title
set classpath=%CLASSPATH%;.\luckyclient;
@echo 项目单条用例执行
@echo 参数说明 依次为:项目名称 tastId 用例编号 用例版本号
java -Djava.ext.dirs=./lib;.%4 luckyclient.caserun.OneCaseExecute %1 %2 %3
java -Djava.ext.dirs=./lib;.%4 luckyclient.execution.OneCaseExecute %1 %2 %3
@echo 当前用例单条执行窗口将在90秒后退出
ping 127.0.0.1 -n 90 >nul
exit

View File

@ -3,7 +3,7 @@ BASE_DIR="."
LIB="${BASE_DIR}/lib"
DRIVENPATH="${BASE_DIR}/$4"
JAVA_OPTS=" -Xmx2048m -XX:PermSize=64m -XX:MaxPermSize=512m -XX:+PrintGCDateStamps -XX:+PrintGCDetails -Xloggc:logs/gc.log -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=1 -XX:GCLogFileSize=1024k -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=logs/mtdperf.hprof -server -Dfile.encoding=UTF-8"
START_CLASS="luckyclient.caserun.OneCaseExecute $1 $2 $3"
START_CLASS="luckyclient.execution.OneCaseExecute $1 $2 $3"
echo ${LIB}

View File

@ -2,7 +2,7 @@ title Web
set classpath=%CLASSPATH%;.\luckyclient;
@echo Web界面调试用例接口
@echo 参数说明 依次为:用例编号 执行者
java -Djava.ext.dirs=./lib;.%3 luckyclient.caserun.WebDebugExecute %1 %2
java -Djava.ext.dirs=./lib;.%3 luckyclient.execution.WebDebugExecute %1 %2
@echo 当前用例调试窗口将在90秒后退出
ping 127.0.0.1 -n 90 >nul
exit

View File

@ -3,7 +3,7 @@ BASE_DIR="."
LIB="${BASE_DIR}/lib"
DRIVENPATH="${BASE_DIR}/$3"
JAVA_OPTS=" -Xmx2048m -XX:PermSize=64m -XX:MaxPermSize=512m -XX:+PrintGCDateStamps -XX:+PrintGCDetails -Xloggc:logs/gc.log -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=1 -XX:GCLogFileSize=1024k -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=logs/mtdperf.hprof -server -Dfile.encoding=UTF-8"
START_CLASS="luckyclient.caserun.WebDebugExecute $1 $2"
START_CLASS="luckyclient.execution.WebDebugExecute $1 $2"
echo ${LIB}

View File

@ -1,84 +0,0 @@
package luckyclient.caserun.publicdispose;
import org.apache.commons.lang.StringUtils;
import luckyclient.publicclass.Constants;
import luckyclient.publicclass.LogUtil;
/**
* 动作关键字处理
* =================================================================
* 这是一个受限制的自由软件您不能在任何未经允许的前提下对程序代码进行修改和用于商业用途也不允许对程序代码修改后以任何形式任何目的的再发布
* 为了尊重作者的劳动成果LuckyFrame关键版权信息严禁篡改 有任何疑问欢迎联系作者讨论 QQ:1573584944 seagull
* =================================================================
* @author Seagull
* @date 2019年1月15日
*/
public class ActionManageForSteps {
/**
* 解析用例步骤
* @param stepsaction
* @param testresult
* @return
*/
public static String actionManage(String stepsaction,String testresult){
LogUtil.APP.info("Action(动作)处理前,测试结果是:{}",testresult);
LogUtil.APP.info("现在进入到Action(动作)处理......ACTION值{}",stepsaction);
if(null==stepsaction||"".equals(stepsaction.trim())){
LogUtil.APP.info("Action(动作)无需处理......");
return testresult;
}
//去除测试响应头域消息
if(testresult.startsWith(Constants.RESPONSE_HEAD)){
testresult = testresult.substring(testresult.indexOf(Constants.RESPONSE_END)+1);
}
//去除测试响应头域消息
if(testresult.startsWith(Constants.RESPONSE_CODE)){
testresult = testresult.substring(testresult.indexOf(Constants.RESPONSE_END)+1);
}
stepsaction=stepsaction.trim();
String[] temp=stepsaction.split("\\|",-1);
for(String actionorder:temp){
if(null!=actionorder&&!"".equals(actionorder.trim())){
testresult=actionExecute(actionorder,testresult);
}
}
return testresult;
}
/**
* 动作关键字执行
* @param actionKeyWord
* @param testResult
* @return
*/
private static String actionExecute(String actionKeyWord,String testResult){
try{
String keyWord = actionKeyWord.substring(actionKeyWord.lastIndexOf("#")+1, actionKeyWord.length());
String actionParams = actionKeyWord.substring(0, actionKeyWord.lastIndexOf("#"));
if(StringUtils.isNotEmpty(keyWord)&& keyWord.length()>0){
ActionContext actionContext = new ActionContext(keyWord.toLowerCase());
testResult = actionContext.parse(actionParams, testResult, actionKeyWord);
}else {
testResult="关键字语法书写有误,请检查关键字:"+actionKeyWord;
LogUtil.APP.warn("关键字语法书写有误,请检查关键字:{}",actionKeyWord);
}
return testResult;
}catch(Exception e){
testResult="处理步骤动作事件过程中出现异常,直接返回测试结果:"+actionKeyWord;
LogUtil.APP.error("处理步骤动作事件过程中出现异常,直接返回测试结果!" ,e);
return testResult;
}
}
public static void main(String[] args) {
String testresult = Constants.RESPONSE_HEAD+"gfdssa"+Constants.RESPONSE_END+"21111"+Constants.RESPONSE_END+"111";
testresult = testresult.substring(testresult.indexOf(Constants.RESPONSE_END)+1);
System.out.println(testresult);
}
}

View File

@ -1,21 +0,0 @@
package luckyclient.dblog;
/**
* =================================================================
* 这是一个受限制的自由软件您不能在任何未经允许的前提下对程序代码进行修改和用于商业用途也不允许对程序代码修改后以任何形式任何目的的再发布
* 为了尊重作者的劳动成果LuckyFrame关键版权信息严禁篡改
* 有任何疑问欢迎联系作者讨论 QQ:1573584944 seagull1985
* =================================================================
*
* @author seagull
* @date 2017年12月1日 上午9:29:40
*
*/
public class DbLink {
/**
* 任务执行类型 0 任务调度模式 1 控制台模式
*/
public static int exetype;
}

View File

@ -16,8 +16,8 @@ import com.alibaba.fastjson.parser.Feature;
import com.jayway.jsonpath.JsonPath;
import com.jayway.jsonpath.PathNotFoundException;
import luckyclient.publicclass.Constants;
import luckyclient.publicclass.LogUtil;
import luckyclient.utils.Constants;
import luckyclient.utils.LogUtil;
/**
* 公用驱动

View File

@ -1,20 +1,20 @@
package luckyclient.caserun;
package luckyclient.execution;
import java.io.File;
import java.util.Properties;
import org.apache.log4j.PropertyConfigurator;
import luckyclient.caserun.exappium.androidex.AndroidBatchExecute;
import luckyclient.caserun.exappium.iosex.IosBatchExecute;
import luckyclient.caserun.exinterface.BatchTestCaseExecution;
import luckyclient.caserun.exinterface.TestControl;
import luckyclient.caserun.exwebdriver.ex.WebBatchExecute;
import luckyclient.publicclass.AppiumConfig;
import luckyclient.publicclass.LogUtil;
import luckyclient.serverapi.api.GetServerApi;
import luckyclient.serverapi.entity.TaskExecute;
import luckyclient.serverapi.entity.TaskScheduling;
import luckyclient.execution.appium.androidex.AndroidBatchExecute;
import luckyclient.execution.appium.iosex.IosBatchExecute;
import luckyclient.execution.httpinterface.BatchTestCaseExecution;
import luckyclient.execution.httpinterface.TestControl;
import luckyclient.execution.webdriver.ex.WebBatchExecute;
import luckyclient.remote.api.GetServerApi;
import luckyclient.remote.entity.TaskExecute;
import luckyclient.remote.entity.TaskScheduling;
import luckyclient.utils.AppiumConfig;
import luckyclient.utils.LogUtil;
/**
* =================================================================

View File

@ -1,20 +1,20 @@
package luckyclient.caserun;
package luckyclient.execution;
import java.io.File;
import java.util.Properties;
import org.apache.log4j.PropertyConfigurator;
import luckyclient.caserun.exappium.androidex.AndroidOneCaseExecute;
import luckyclient.caserun.exappium.iosex.IosOneCaseExecute;
import luckyclient.caserun.exinterface.TestCaseExecution;
import luckyclient.caserun.exinterface.TestControl;
import luckyclient.caserun.exwebdriver.ex.WebOneCaseExecute;
import luckyclient.publicclass.AppiumConfig;
import luckyclient.publicclass.LogUtil;
import luckyclient.serverapi.api.GetServerApi;
import luckyclient.serverapi.entity.TaskExecute;
import luckyclient.serverapi.entity.TaskScheduling;
import luckyclient.execution.appium.androidex.AndroidOneCaseExecute;
import luckyclient.execution.appium.iosex.IosOneCaseExecute;
import luckyclient.execution.httpinterface.TestCaseExecution;
import luckyclient.execution.httpinterface.TestControl;
import luckyclient.execution.webdriver.ex.WebOneCaseExecute;
import luckyclient.remote.api.GetServerApi;
import luckyclient.remote.entity.TaskExecute;
import luckyclient.remote.entity.TaskScheduling;
import luckyclient.utils.AppiumConfig;
import luckyclient.utils.LogUtil;
/**
* =================================================================

View File

@ -1,16 +1,16 @@
package luckyclient.caserun;
package luckyclient.execution;
import java.io.File;
import org.apache.log4j.PropertyConfigurator;
import luckyclient.caserun.exappium.AppTestControl;
import luckyclient.caserun.exinterface.TestControl;
import luckyclient.caserun.exwebdriver.WebTestControl;
import luckyclient.publicclass.LogUtil;
import luckyclient.serverapi.api.GetServerApi;
import luckyclient.serverapi.entity.TaskExecute;
import luckyclient.serverapi.entity.TaskScheduling;
import luckyclient.execution.appium.AppTestControl;
import luckyclient.execution.httpinterface.TestControl;
import luckyclient.execution.webdriver.WebTestControl;
import luckyclient.remote.api.GetServerApi;
import luckyclient.remote.entity.TaskExecute;
import luckyclient.remote.entity.TaskScheduling;
import luckyclient.utils.LogUtil;
/**
* =================================================================

View File

@ -1,12 +1,12 @@
package luckyclient.caserun;
package luckyclient.execution;
import java.io.File;
import org.apache.log4j.PropertyConfigurator;
import luckyclient.caserun.exinterface.TestControl;
import luckyclient.caserun.exinterface.WebTestCaseDebug;
import luckyclient.publicclass.LogUtil;
import luckyclient.execution.httpinterface.TestControl;
import luckyclient.execution.httpinterface.WebTestCaseDebug;
import luckyclient.utils.LogUtil;
/**
* =================================================================

View File

@ -1,4 +1,4 @@
package luckyclient.caserun.exappium;
package luckyclient.execution.appium;
import java.util.HashMap;
import java.util.Map;
@ -7,11 +7,11 @@ import java.util.regex.Pattern;
import org.apache.commons.lang3.StringUtils;
import luckyclient.caserun.publicdispose.ChangString;
import luckyclient.dblog.LogOperation;
import luckyclient.publicclass.LogUtil;
import luckyclient.serverapi.entity.ProjectCase;
import luckyclient.serverapi.entity.ProjectCaseSteps;
import luckyclient.execution.dispose.ChangString;
import luckyclient.remote.api.serverOperation;
import luckyclient.remote.entity.ProjectCase;
import luckyclient.remote.entity.ProjectCaseSteps;
import luckyclient.utils.LogUtil;
/**
* =================================================================
* 这是一个受限制的自由软件您不能在任何未经允许的前提下对程序代码进行修改和用于商业用途也不允许对程序代码修改后以任何形式任何目的的再发布
@ -37,7 +37,7 @@ public class AppDriverAnalyticCase {
* @author Seagull
* @date 2019年1月17日
*/
public static Map<String,String> analyticCaseStep(ProjectCase projectcase,ProjectCaseSteps step,String taskid,LogOperation caselog, Map<String, String> variable){
public static Map<String,String> analyticCaseStep(ProjectCase projectcase,ProjectCaseSteps step,String taskid,serverOperation caselog, Map<String, String> variable){
Map<String,String> params = new HashMap<String,String>(0);
String resultstr = null;

View File

@ -1,4 +1,4 @@
package luckyclient.caserun.exappium;
package luckyclient.execution.appium;
import java.io.IOException;
import java.util.ArrayList;
@ -9,23 +9,22 @@ import io.appium.java_client.android.AndroidDriver;
import io.appium.java_client.android.AndroidElement;
import io.appium.java_client.ios.IOSDriver;
import io.appium.java_client.ios.IOSElement;
import luckyclient.caserun.exappium.androidex.AndroidCaseExecution;
import luckyclient.caserun.exappium.iosex.IosCaseExecution;
import luckyclient.caserun.exinterface.TestControl;
import luckyclient.dblog.DbLink;
import luckyclient.dblog.LogOperation;
import luckyclient.jenkinsapi.BuildingInitialization;
import luckyclient.jenkinsapi.RestartServerInitialization;
import luckyclient.mail.HtmlMail;
import luckyclient.mail.MailSendInitialization;
import luckyclient.publicclass.AppiumConfig;
import luckyclient.publicclass.LogUtil;
import luckyclient.serverapi.api.GetServerApi;
import luckyclient.serverapi.entity.ProjectCase;
import luckyclient.serverapi.entity.ProjectCaseParams;
import luckyclient.serverapi.entity.ProjectCaseSteps;
import luckyclient.serverapi.entity.TaskExecute;
import luckyclient.serverapi.entity.TaskScheduling;
import luckyclient.execution.appium.androidex.AndroidCaseExecution;
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.tool.jenkins.BuildingInitialization;
import luckyclient.tool.mail.HtmlMail;
import luckyclient.tool.mail.MailSendInitialization;
import luckyclient.tool.shell.RestartServerInitialization;
import luckyclient.utils.AppiumConfig;
import luckyclient.utils.LogUtil;
/**
* =================================================================
@ -48,7 +47,7 @@ public class AppTestControl {
public static void manualExecutionPlan(String planname) {
// 不记日志到数据库
DbLink.exetype = 1;
serverOperation.exetype = 1;
String taskid = "888888";
AndroidDriver<AndroidElement> androiddriver = null;
IOSDriver<IOSElement> iosdriver = null;
@ -64,7 +63,7 @@ public class AppTestControl {
// TODO Auto-generated catch block
LogUtil.APP.error("控制台模式初始化Appium Driver异常", e);
}
LogOperation caselog = new LogOperation();
serverOperation caselog = new serverOperation();
List<ProjectCase> testCases = GetServerApi.getCasesbyplanname(planname);
List<ProjectCaseParams> pcplist = new ArrayList<ProjectCaseParams>();
if (testCases.size() != 0) {
@ -107,7 +106,7 @@ public class AppTestControl {
public static void taskExecutionPlan(TaskExecute task) throws InterruptedException {
// 记录日志到数据库
String taskId=task.getTaskId().toString();
DbLink.exetype = 0;
serverOperation.exetype = 0;
TestControl.TASKID = taskId;
AndroidDriver<AndroidElement> androiddriver = null;
IOSDriver<IOSElement> iosdriver = null;
@ -142,10 +141,10 @@ public class AppTestControl {
} catch (Exception e) {
LogUtil.APP.error("初始化AppiumDriver出错 APPIUM Server【http://{}/wd/hub】",properties.getProperty("appiumsever"), e);
}
LogOperation caselog = new LogOperation();
serverOperation caselog = new serverOperation();
List<ProjectCase> cases = GetServerApi.getCasesbyplanId(taskScheduling.getPlanId());
LogUtil.APP.info("当前计划【{}】中共有【{}】条待测试用例...",task.getTaskName(),cases.size());
LogOperation.updateTaskExecuteStatusIng(taskId, cases.size());
serverOperation.updateTaskExecuteStatusIng(taskId, cases.size());
int i = 0;
for (ProjectCase testcase : cases) {
i++;
@ -168,8 +167,8 @@ public class AppTestControl {
}
LogUtil.APP.info("当前用例:【{}】执行完成......进入下一条",testcase.getCaseSign());
}
tastcount = LogOperation.updateTaskExecuteData(taskId, cases.size(),2);
String testtime = LogOperation.getTestTime(taskId);
tastcount = serverOperation.updateTaskExecuteData(taskId, cases.size(),2);
String testtime = serverOperation.getTestTime(taskId);
LogUtil.APP.info("当前项目【{]】测试计划中的用例已经全部执行完成...",projectname);
MailSendInitialization.sendMailInitialization(HtmlMail.htmlSubjectFormat(jobname),
HtmlMail.htmlContentFormat(tastcount, taskId, buildstatus, restartstatus, testtime, jobname),

View File

@ -1,4 +1,4 @@
package luckyclient.caserun.exappium;
package luckyclient.execution.appium;
import java.io.File;
import java.io.IOException;

View File

@ -1,4 +1,4 @@
package luckyclient.caserun.exappium;
package luckyclient.execution.appium;
import java.io.File;
import java.util.Properties;
@ -6,8 +6,8 @@ import java.util.Properties;
import io.appium.java_client.service.local.AppiumDriverLocalService;
import io.appium.java_client.service.local.AppiumServiceBuilder;
import io.appium.java_client.service.local.flags.GeneralServerFlag;
import luckyclient.publicclass.AppiumConfig;
import luckyclient.publicclass.LogUtil;
import luckyclient.utils.AppiumConfig;
import luckyclient.utils.LogUtil;
/**
*

View File

@ -1,4 +1,4 @@
package luckyclient.caserun.exappium.androidex;
package luckyclient.execution.appium.androidex;
import java.io.File;
import java.io.IOException;
@ -16,7 +16,7 @@ import io.appium.java_client.android.AndroidElement;
import io.appium.java_client.android.AndroidTouchAction;
import io.appium.java_client.touch.WaitOptions;
import io.appium.java_client.touch.offset.PointOption;
import luckyclient.publicclass.LogUtil;
import luckyclient.utils.LogUtil;
/**
* =================================================================

View File

@ -1,4 +1,4 @@
package luckyclient.caserun.exappium.androidex;
package luckyclient.execution.appium.androidex;
import java.io.IOException;
import java.net.MalformedURLException;
@ -7,18 +7,17 @@ import java.util.Properties;
import io.appium.java_client.android.AndroidDriver;
import io.appium.java_client.android.AndroidElement;
import luckyclient.caserun.exappium.AppiumInitialization;
import luckyclient.caserun.exappium.AppiumService;
import luckyclient.caserun.exinterface.TestControl;
import luckyclient.dblog.DbLink;
import luckyclient.dblog.LogOperation;
import luckyclient.publicclass.AppiumConfig;
import luckyclient.publicclass.LogUtil;
import luckyclient.serverapi.api.GetServerApi;
import luckyclient.serverapi.entity.ProjectCase;
import luckyclient.serverapi.entity.ProjectCaseParams;
import luckyclient.serverapi.entity.ProjectCaseSteps;
import luckyclient.serverapi.entity.TaskExecute;
import luckyclient.execution.appium.AppiumInitialization;
import luckyclient.execution.appium.AppiumService;
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.utils.AppiumConfig;
import luckyclient.utils.LogUtil;
/**
* =================================================================
@ -35,7 +34,7 @@ public class AndroidBatchExecute {
public static void batchCaseExecuteForTast(String projectname, String taskid, String batchcase) throws IOException, InterruptedException {
// 记录日志到数据库
DbLink.exetype = 0;
serverOperation.exetype = 0;
TestControl.TASKID = taskid;
AndroidDriver<AndroidElement> ad = null;
AppiumService as=null;
@ -53,7 +52,7 @@ public class AndroidBatchExecute {
// TODO Auto-generated catch block
LogUtil.APP.error("安卓手机根据配置自动启动Appiume服务出现异常",e);
}
LogOperation caselog = new LogOperation();
serverOperation caselog = new serverOperation();
TaskExecute task = GetServerApi.cgetTaskbyid(Integer.valueOf(taskid));
List<ProjectCaseParams> pcplist = GetServerApi
.cgetParamsByProjectid(task.getProjectId().toString());
@ -64,7 +63,7 @@ public class AndroidBatchExecute {
ProjectCase testcase = GetServerApi.cGetCaseByCaseId(caseIdList.get(i));
List<ProjectCaseSteps> steps = GetServerApi.getStepsbycaseid(testcase.getCaseId());
// 删除旧的日志
LogOperation.deleteTaskCaseLog(testcase.getCaseId(), taskid);
serverOperation.deleteTaskCaseLog(testcase.getCaseId(), taskid);
try {
AndroidCaseExecution.caseExcution(testcase, steps, taskid, ad, caselog, pcplist);
} catch (InterruptedException e) {
@ -78,7 +77,7 @@ public class AndroidBatchExecute {
ProjectCase testcase = GetServerApi.cGetCaseByCaseId(Integer.valueOf(temp[i]));
List<ProjectCaseSteps> steps = GetServerApi.getStepsbycaseid(testcase.getCaseId());
// 删除旧的日志
LogOperation.deleteTaskCaseLog(testcase.getCaseId(), taskid);
serverOperation.deleteTaskCaseLog(testcase.getCaseId(), taskid);
try {
AndroidCaseExecution.caseExcution(testcase, steps, taskid, ad, caselog, pcplist);
} catch (InterruptedException e) {
@ -87,7 +86,7 @@ public class AndroidBatchExecute {
}
}
}
LogOperation.updateTaskExecuteData(taskid, 0,2);
serverOperation.updateTaskExecuteData(taskid, 0,2);
ad.closeApp();
//关闭Appium服务的线程
if(as!=null){

View File

@ -1,4 +1,4 @@
package luckyclient.caserun.exappium.androidex;
package luckyclient.execution.appium.androidex;
import java.io.IOException;
import java.util.Date;
@ -10,18 +10,18 @@ import java.util.regex.Pattern;
import io.appium.java_client.android.AndroidDriver;
import io.appium.java_client.android.AndroidElement;
import luckyclient.caserun.exappium.AppDriverAnalyticCase;
import luckyclient.caserun.exinterface.TestCaseExecution;
import luckyclient.caserun.exinterface.analyticsteps.InterfaceAnalyticCase;
import luckyclient.caserun.publicdispose.ActionManageForSteps;
import luckyclient.caserun.publicdispose.ChangString;
import luckyclient.caserun.publicdispose.ParamsManageForSteps;
import luckyclient.dblog.LogOperation;
import luckyclient.publicclass.Constants;
import luckyclient.publicclass.LogUtil;
import luckyclient.serverapi.entity.ProjectCase;
import luckyclient.serverapi.entity.ProjectCaseParams;
import luckyclient.serverapi.entity.ProjectCaseSteps;
import luckyclient.execution.appium.AppDriverAnalyticCase;
import luckyclient.execution.dispose.ActionManageForSteps;
import luckyclient.execution.dispose.ChangString;
import luckyclient.execution.dispose.ParamsManageForSteps;
import luckyclient.execution.httpinterface.TestCaseExecution;
import luckyclient.execution.httpinterface.analyticsteps.InterfaceAnalyticCase;
import luckyclient.remote.api.serverOperation;
import luckyclient.remote.entity.ProjectCase;
import luckyclient.remote.entity.ProjectCaseParams;
import luckyclient.remote.entity.ProjectCaseSteps;
import luckyclient.utils.Constants;
import luckyclient.utils.LogUtil;
/**
* =================================================================
@ -38,7 +38,7 @@ public class AndroidCaseExecution{
private static String casenote = "备注初始化";
private static String imagname = "";
public static void caseExcution(ProjectCase testcase, List<ProjectCaseSteps> steps,String taskid, AndroidDriver<AndroidElement> appium,LogOperation caselog,List<ProjectCaseParams> pcplist)
public static void caseExcution(ProjectCase testcase, List<ProjectCaseSteps> steps,String taskid, AndroidDriver<AndroidElement> appium,serverOperation caselog,List<ProjectCaseParams> pcplist)
throws InterruptedException, IOException {
caselog.updateTaskCaseExecuteStatus(taskid, testcase.getCaseId(), 3);
// 把公共参数加入到MAP中
@ -102,7 +102,7 @@ public class AndroidCaseExecution{
//LogOperation.UpdateTastdetail(taskid, 0);
}
public static String androidRunStep(Map<String, String> params, AndroidDriver<AndroidElement> appium,String taskid,Integer caseId,int stepno,LogOperation caselog) {
public static String androidRunStep(Map<String, String> params, AndroidDriver<AndroidElement> appium,String taskid,Integer caseId,int stepno,serverOperation caselog) {
String result = "";
String property;
String propertyValue;
@ -223,7 +223,7 @@ public class AndroidCaseExecution{
}
public static int judgeResult(ProjectCase testcase, ProjectCaseSteps step, Map<String, String> params, AndroidDriver<AndroidElement> appium, String taskid, String expect, String result, LogOperation caselog) throws InterruptedException {
public static int judgeResult(ProjectCase testcase, ProjectCaseSteps step, Map<String, String> params, AndroidDriver<AndroidElement> appium, String taskid, String expect, String result, serverOperation caselog) throws InterruptedException {
int setresult = 0;
java.text.DateFormat timeformat = new java.text.SimpleDateFormat("MMdd-hhmmss");
imagname = timeformat.format(new Date());

View File

@ -1,17 +1,16 @@
package luckyclient.caserun.exappium.androidex;
package luckyclient.execution.appium.androidex;
import java.io.IOException;
import java.util.List;
import io.appium.java_client.android.AndroidDriver;
import io.appium.java_client.android.AndroidElement;
import luckyclient.dblog.DbLink;
import luckyclient.dblog.LogOperation;
import luckyclient.publicclass.LogUtil;
import luckyclient.serverapi.api.GetServerApi;
import luckyclient.serverapi.entity.ProjectCase;
import luckyclient.serverapi.entity.ProjectCaseParams;
import luckyclient.serverapi.entity.ProjectCaseSteps;
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.utils.LogUtil;
/**
* =================================================================
@ -27,8 +26,8 @@ public class AndroidCaseLocalDebug {
public static void oneCasedebug(AndroidDriver<AndroidElement> androiddriver, String testCaseExternalId) {
// 不记录日志到数据库
DbLink.exetype = 1;
LogOperation caselog = new LogOperation();
serverOperation.exetype = 1;
serverOperation caselog = new serverOperation();
try {
ProjectCase testcase = GetServerApi.cgetCaseBysign(testCaseExternalId);

View File

@ -1,4 +1,4 @@
package luckyclient.caserun.exappium.androidex;
package luckyclient.execution.appium.androidex;
import java.time.Duration;
import java.util.Date;
@ -16,8 +16,8 @@ import io.appium.java_client.touch.LongPressOptions;
import io.appium.java_client.touch.WaitOptions;
import io.appium.java_client.touch.offset.ElementOption;
import io.appium.java_client.touch.offset.PointOption;
import luckyclient.caserun.publicdispose.ChangString;
import luckyclient.publicclass.LogUtil;
import luckyclient.execution.dispose.ChangString;
import luckyclient.utils.LogUtil;
/**
* =================================================================

View File

@ -1,4 +1,4 @@
package luckyclient.caserun.exappium.androidex;
package luckyclient.execution.appium.androidex;
import java.io.IOException;
import java.util.List;
@ -6,17 +6,16 @@ import java.util.Properties;
import io.appium.java_client.android.AndroidDriver;
import io.appium.java_client.android.AndroidElement;
import luckyclient.caserun.exappium.AppiumInitialization;
import luckyclient.caserun.exappium.AppiumService;
import luckyclient.caserun.exinterface.TestControl;
import luckyclient.dblog.DbLink;
import luckyclient.dblog.LogOperation;
import luckyclient.publicclass.AppiumConfig;
import luckyclient.publicclass.LogUtil;
import luckyclient.serverapi.api.GetServerApi;
import luckyclient.serverapi.entity.ProjectCase;
import luckyclient.serverapi.entity.ProjectCaseParams;
import luckyclient.serverapi.entity.ProjectCaseSteps;
import luckyclient.execution.appium.AppiumInitialization;
import luckyclient.execution.appium.AppiumService;
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.utils.AppiumConfig;
import luckyclient.utils.LogUtil;
/**
* =================================================================
@ -34,7 +33,7 @@ public class AndroidOneCaseExecute {
public static void oneCaseExecuteForTast(String projectname, Integer caseId, int version, String taskid)
throws IOException, InterruptedException {
// 记录日志到数据库
DbLink.exetype = 0;
serverOperation.exetype = 0;
TestControl.TASKID = taskid;
AndroidDriver<AndroidElement> ad = null;
AppiumService as=null;
@ -51,10 +50,10 @@ public class AndroidOneCaseExecute {
} catch (IOException e1) {
LogUtil.APP.error("初始化AndroidDriver出错", e1);
}
LogOperation caselog = new LogOperation();
serverOperation caselog = new serverOperation();
// 删除旧的日志
ProjectCase testcase = GetServerApi.cGetCaseByCaseId(caseId);
LogOperation.deleteTaskCaseLog(testcase.getCaseId(), taskid);
serverOperation.deleteTaskCaseLog(testcase.getCaseId(), taskid);
List<ProjectCaseParams> pcplist = GetServerApi.cgetParamsByProjectid(String.valueOf(testcase.getProjectId()));
LogUtil.APP.info("开始执行用例:【{}】......",testcase.getCaseSign());
try {
@ -64,7 +63,7 @@ public class AndroidOneCaseExecute {
} catch (InterruptedException e) {
LogUtil.APP.error("用户执行过程中抛出异常!", e);
}
LogOperation.updateTaskExecuteData(taskid, 0,2);
serverOperation.updateTaskExecuteData(taskid, 0,2);
ad.closeApp();
//关闭Appium服务的线程
if(as!=null){

View File

@ -1,4 +1,4 @@
package luckyclient.caserun.exappium.iosex;
package luckyclient.execution.appium.iosex;
import java.io.File;
import java.io.IOException;
@ -16,7 +16,7 @@ import io.appium.java_client.ios.IOSElement;
import io.appium.java_client.ios.IOSTouchAction;
import io.appium.java_client.touch.WaitOptions;
import io.appium.java_client.touch.offset.PointOption;
import luckyclient.publicclass.LogUtil;
import luckyclient.utils.LogUtil;
/**
* =================================================================

View File

@ -1,4 +1,4 @@
package luckyclient.caserun.exappium.iosex;
package luckyclient.execution.appium.iosex;
import java.io.IOException;
import java.net.MalformedURLException;
@ -7,18 +7,17 @@ import java.util.Properties;
import io.appium.java_client.ios.IOSDriver;
import io.appium.java_client.ios.IOSElement;
import luckyclient.caserun.exappium.AppiumInitialization;
import luckyclient.caserun.exappium.AppiumService;
import luckyclient.caserun.exinterface.TestControl;
import luckyclient.dblog.DbLink;
import luckyclient.dblog.LogOperation;
import luckyclient.publicclass.AppiumConfig;
import luckyclient.publicclass.LogUtil;
import luckyclient.serverapi.api.GetServerApi;
import luckyclient.serverapi.entity.ProjectCase;
import luckyclient.serverapi.entity.ProjectCaseParams;
import luckyclient.serverapi.entity.ProjectCaseSteps;
import luckyclient.serverapi.entity.TaskExecute;
import luckyclient.execution.appium.AppiumInitialization;
import luckyclient.execution.appium.AppiumService;
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.utils.AppiumConfig;
import luckyclient.utils.LogUtil;
/**
* =================================================================
@ -33,7 +32,7 @@ public class IosBatchExecute {
public static void batchCaseExecuteForTast(String projectname, String taskid, String batchcase) throws IOException, InterruptedException {
// 记录日志到数据库
DbLink.exetype = 0;
serverOperation.exetype = 0;
TestControl.TASKID = taskid;
IOSDriver<IOSElement> iosd = null;
AppiumService as=null;
@ -51,7 +50,7 @@ public class IosBatchExecute {
// TODO Auto-generated catch block
LogUtil.APP.error("根据配置自动启动Appiume服务中抛出异常", e);
}
LogOperation caselog = new LogOperation();
serverOperation caselog = new serverOperation();
TaskExecute task = GetServerApi.cgetTaskbyid(Integer.valueOf(taskid));
List<ProjectCaseParams> pcplist = GetServerApi
.cgetParamsByProjectid(task.getProjectId().toString());
@ -62,7 +61,7 @@ public class IosBatchExecute {
ProjectCase testcase = GetServerApi.cGetCaseByCaseId(caseIdList.get(i));
List<ProjectCaseSteps> steps = GetServerApi.getStepsbycaseid(testcase.getCaseId());
// 删除旧的日志
LogOperation.deleteTaskCaseLog(testcase.getCaseId(), taskid);
serverOperation.deleteTaskCaseLog(testcase.getCaseId(), taskid);
try {
IosCaseExecution.caseExcution(testcase, steps, taskid, iosd, caselog, pcplist);
} catch (InterruptedException e) {
@ -76,7 +75,7 @@ public class IosBatchExecute {
ProjectCase testcase = GetServerApi.cGetCaseByCaseId(Integer.valueOf(temp[i]));
List<ProjectCaseSteps> steps = GetServerApi.getStepsbycaseid(testcase.getCaseId());
// 删除旧的日志
LogOperation.deleteTaskCaseLog(testcase.getCaseId(), taskid);
serverOperation.deleteTaskCaseLog(testcase.getCaseId(), taskid);
try {
IosCaseExecution.caseExcution(testcase, steps, taskid, iosd, caselog, pcplist);
} catch (InterruptedException e) {
@ -85,7 +84,7 @@ public class IosBatchExecute {
}
}
}
LogOperation.updateTaskExecuteData(taskid, 0,2);
serverOperation.updateTaskExecuteData(taskid, 0,2);
iosd.closeApp();
//关闭Appium服务的线程
if(as!=null){

View File

@ -1,4 +1,4 @@
package luckyclient.caserun.exappium.iosex;
package luckyclient.execution.appium.iosex;
import java.io.IOException;
import java.util.Date;
@ -10,18 +10,18 @@ import java.util.regex.Pattern;
import io.appium.java_client.ios.IOSDriver;
import io.appium.java_client.ios.IOSElement;
import luckyclient.caserun.exappium.AppDriverAnalyticCase;
import luckyclient.caserun.exinterface.TestCaseExecution;
import luckyclient.caserun.exinterface.analyticsteps.InterfaceAnalyticCase;
import luckyclient.caserun.publicdispose.ActionManageForSteps;
import luckyclient.caserun.publicdispose.ChangString;
import luckyclient.caserun.publicdispose.ParamsManageForSteps;
import luckyclient.dblog.LogOperation;
import luckyclient.publicclass.Constants;
import luckyclient.publicclass.LogUtil;
import luckyclient.serverapi.entity.ProjectCase;
import luckyclient.serverapi.entity.ProjectCaseParams;
import luckyclient.serverapi.entity.ProjectCaseSteps;
import luckyclient.execution.appium.AppDriverAnalyticCase;
import luckyclient.execution.dispose.ActionManageForSteps;
import luckyclient.execution.dispose.ChangString;
import luckyclient.execution.dispose.ParamsManageForSteps;
import luckyclient.execution.httpinterface.TestCaseExecution;
import luckyclient.execution.httpinterface.analyticsteps.InterfaceAnalyticCase;
import luckyclient.remote.api.serverOperation;
import luckyclient.remote.entity.ProjectCase;
import luckyclient.remote.entity.ProjectCaseParams;
import luckyclient.remote.entity.ProjectCaseSteps;
import luckyclient.utils.Constants;
import luckyclient.utils.LogUtil;
/**
* =================================================================
@ -38,7 +38,7 @@ public class IosCaseExecution{
private static String casenote = "备注初始化";
private static String imagname = "";
public static void caseExcution(ProjectCase testcase, List<ProjectCaseSteps> steps,String taskid, IOSDriver<IOSElement> appium,LogOperation caselog,List<ProjectCaseParams> pcplist)
public static void caseExcution(ProjectCase testcase, List<ProjectCaseSteps> steps,String taskid, IOSDriver<IOSElement> appium,serverOperation caselog,List<ProjectCaseParams> pcplist)
throws InterruptedException, IOException {
caselog.updateTaskCaseExecuteStatus(taskid, testcase.getCaseId(), 3);
// 把公共参数加入到MAP中
@ -104,7 +104,7 @@ public class IosCaseExecution{
//LogOperation.UpdateTastdetail(taskid, 0);
}
public static String iosRunStep(Map<String, String> params, Map<String, String> variable, IOSDriver<IOSElement> appium,String taskid,Integer caseId,int stepno,LogOperation caselog) {
public static String iosRunStep(Map<String, String> params, Map<String, String> variable, IOSDriver<IOSElement> appium,String taskid,Integer caseId,int stepno,serverOperation caselog) {
String result = "";
String property;
String propertyValue;
@ -237,7 +237,7 @@ public class IosCaseExecution{
}
public static int judgeResult(ProjectCase testcase, ProjectCaseSteps step, Map<String, String> params, IOSDriver<IOSElement> appium, String taskid, String expect, String result, LogOperation caselog) throws InterruptedException {
public static int judgeResult(ProjectCase testcase, ProjectCaseSteps step, Map<String, String> params, IOSDriver<IOSElement> appium, String taskid, String expect, String result, serverOperation caselog) throws InterruptedException {
int setresult = 0;
java.text.DateFormat timeformat = new java.text.SimpleDateFormat("MMdd-hhmmss");
imagname = timeformat.format(new Date());

View File

@ -1,17 +1,16 @@
package luckyclient.caserun.exappium.iosex;
package luckyclient.execution.appium.iosex;
import java.io.IOException;
import java.util.List;
import io.appium.java_client.ios.IOSDriver;
import io.appium.java_client.ios.IOSElement;
import luckyclient.dblog.DbLink;
import luckyclient.dblog.LogOperation;
import luckyclient.publicclass.LogUtil;
import luckyclient.serverapi.api.GetServerApi;
import luckyclient.serverapi.entity.ProjectCase;
import luckyclient.serverapi.entity.ProjectCaseParams;
import luckyclient.serverapi.entity.ProjectCaseSteps;
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.utils.LogUtil;
/**
* =================================================================
@ -27,8 +26,8 @@ public class IosCaseLocalDebug {
public static void oneCasedebug(IOSDriver<IOSElement> iosdriver, String testCaseExternalId) {
// 不记录日志到数据库
DbLink.exetype = 1;
LogOperation caselog = new LogOperation();
serverOperation.exetype = 1;
serverOperation caselog = new serverOperation();
try {
ProjectCase testcase = GetServerApi.cgetCaseBysign(testCaseExternalId);

View File

@ -1,4 +1,4 @@
package luckyclient.caserun.exappium.iosex;
package luckyclient.execution.appium.iosex;
import java.time.Duration;
import java.util.Date;
@ -16,8 +16,8 @@ import io.appium.java_client.touch.LongPressOptions;
import io.appium.java_client.touch.WaitOptions;
import io.appium.java_client.touch.offset.ElementOption;
import io.appium.java_client.touch.offset.PointOption;
import luckyclient.caserun.publicdispose.ChangString;
import luckyclient.publicclass.LogUtil;
import luckyclient.execution.dispose.ChangString;
import luckyclient.utils.LogUtil;
/**
* =================================================================

View File

@ -1,4 +1,4 @@
package luckyclient.caserun.exappium.iosex;
package luckyclient.execution.appium.iosex;
import java.io.IOException;
import java.util.List;
@ -6,17 +6,16 @@ import java.util.Properties;
import io.appium.java_client.ios.IOSDriver;
import io.appium.java_client.ios.IOSElement;
import luckyclient.caserun.exappium.AppiumInitialization;
import luckyclient.caserun.exappium.AppiumService;
import luckyclient.caserun.exinterface.TestControl;
import luckyclient.dblog.DbLink;
import luckyclient.dblog.LogOperation;
import luckyclient.publicclass.AppiumConfig;
import luckyclient.publicclass.LogUtil;
import luckyclient.serverapi.api.GetServerApi;
import luckyclient.serverapi.entity.ProjectCase;
import luckyclient.serverapi.entity.ProjectCaseParams;
import luckyclient.serverapi.entity.ProjectCaseSteps;
import luckyclient.execution.appium.AppiumInitialization;
import luckyclient.execution.appium.AppiumService;
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.utils.AppiumConfig;
import luckyclient.utils.LogUtil;
/**
* =================================================================
@ -32,7 +31,7 @@ public class IosOneCaseExecute {
public static void oneCaseExecuteForTast(String projectname, Integer caseId, int version, String taskid)
throws IOException, InterruptedException {
// 记录日志到数据库
DbLink.exetype = 0;
serverOperation.exetype = 0;
TestControl.TASKID = taskid;
IOSDriver<IOSElement> iosd = null;
AppiumService as=null;
@ -49,10 +48,10 @@ public class IosOneCaseExecute {
} catch (IOException e1) {
LogUtil.APP.error("初始化IOSDriver出错", e1);
}
LogOperation caselog = new LogOperation();
serverOperation caselog = new serverOperation();
ProjectCase testcase = GetServerApi.cGetCaseByCaseId(caseId);
// 删除旧的日志
LogOperation.deleteTaskCaseLog(testcase.getCaseId(), taskid);
serverOperation.deleteTaskCaseLog(testcase.getCaseId(), taskid);
List<ProjectCaseParams> pcplist = GetServerApi.cgetParamsByProjectid(String.valueOf(testcase.getProjectId()));
LogUtil.APP.info("开始执行用例:【{}】......",testcase.getCaseSign());
@ -63,7 +62,7 @@ public class IosOneCaseExecute {
} catch (InterruptedException e) {
LogUtil.APP.error("用户执行过程中抛出异常!", e);
}
LogOperation.updateTaskExecuteData(taskid, 0,2);
serverOperation.updateTaskExecuteData(taskid, 0,2);
iosd.closeApp();
//关闭Appium服务的线程
if(as!=null){

View File

@ -1,63 +1,63 @@
package luckyclient.caserun.publicdispose;
import java.util.Collections;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import org.reflections.Reflections;
import luckyclient.caserun.publicdispose.actionkeyword.Action;
import luckyclient.caserun.publicdispose.actionkeyword.ActionKeyWordParser;
import luckyclient.publicclass.LogUtil;
/**
* 步骤动作容器根据参数生成不同的动作关键字类型执行相应的解析
* @author: sunshaoyan@
* @date: Created on 2019/4/13
*/
@SuppressWarnings("rawtypes")
public class ActionContext {
private static Map<String, Class> allActions;
static {
Reflections reflections = new Reflections("luckyclient.caserun.publicdispose.actionkeyword");
Set<Class<?>> annotatedClasses =
reflections.getTypesAnnotatedWith(Action.class);
allActions = new ConcurrentHashMap<String, Class>();
for (Class<?> classObject : annotatedClasses) {
Action action = (Action) classObject
.getAnnotation(Action.class);
allActions.put(action.name(), classObject);
}
allActions = Collections.unmodifiableMap(allActions);
}
private ActionKeyWordParser action;
public ActionContext(String name){
if (allActions.containsKey(name)) {
LogUtil.APP.info("Created Action name is {}", name);
try {
action = (ActionKeyWordParser) allActions.get(name).newInstance();
} catch (InstantiationException | IllegalAccessException ex) {
LogUtil.APP.error("Instantiate Action failed", ex);
}
} else {
LogUtil.APP.warn("Specified Action name {} does not exist", name);
}
}
public String parse(String actionParams,String testResult,String actionKeyWord) {
if(null != action){
testResult = action.parse(actionParams, testResult);
}else {
testResult="未检索到对应动作关键字,直接跳过此动作,请检查关键字:"+actionKeyWord;
LogUtil.APP.warn("未检索到对应动作关键字,直接跳过此动作,请检查关键字:{}",actionKeyWord);
}
return testResult;
}
}
package luckyclient.execution.dispose;
import java.util.Collections;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import org.reflections.Reflections;
import luckyclient.execution.dispose.actionkeyword.Action;
import luckyclient.execution.dispose.actionkeyword.ActionKeyWordParser;
import luckyclient.utils.LogUtil;
/**
* 步骤动作容器根据参数生成不同的动作关键字类型执行相应的解析
* @author: sunshaoyan@
* @date: Created on 2019/4/13
*/
@SuppressWarnings("rawtypes")
public class ActionContext {
private static Map<String, Class> allActions;
static {
Reflections reflections = new Reflections("luckyclient.caserun.publicdispose.actionkeyword");
Set<Class<?>> annotatedClasses =
reflections.getTypesAnnotatedWith(Action.class);
allActions = new ConcurrentHashMap<String, Class>();
for (Class<?> classObject : annotatedClasses) {
Action action = (Action) classObject
.getAnnotation(Action.class);
allActions.put(action.name(), classObject);
}
allActions = Collections.unmodifiableMap(allActions);
}
private ActionKeyWordParser action;
public ActionContext(String name){
if (allActions.containsKey(name)) {
LogUtil.APP.info("Created Action name is {}", name);
try {
action = (ActionKeyWordParser) allActions.get(name).newInstance();
} catch (InstantiationException | IllegalAccessException ex) {
LogUtil.APP.error("Instantiate Action failed", ex);
}
} else {
LogUtil.APP.warn("Specified Action name {} does not exist", name);
}
}
public String parse(String actionParams,String testResult,String actionKeyWord) {
if(null != action){
testResult = action.parse(actionParams, testResult);
}else {
testResult="未检索到对应动作关键字,直接跳过此动作,请检查关键字:"+actionKeyWord;
LogUtil.APP.warn("未检索到对应动作关键字,直接跳过此动作,请检查关键字:{}",actionKeyWord);
}
return testResult;
}
}

View File

@ -1,4 +1,4 @@
package luckyclient.caserun.publicdispose;
package luckyclient.execution.dispose;
import java.math.BigDecimal;
import java.sql.Timestamp;
@ -18,7 +18,7 @@ import com.alibaba.fastjson.JSONException;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.TypeReference;
import luckyclient.publicclass.LogUtil;
import luckyclient.utils.LogUtil;
/**
* 对参数替换进行处理

View File

@ -1,4 +1,4 @@
package luckyclient.caserun.publicdispose;
package luckyclient.execution.dispose;
import java.text.SimpleDateFormat;
import java.util.Date;
@ -8,7 +8,7 @@ import java.util.Random;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import luckyclient.publicclass.LogUtil;
import luckyclient.utils.LogUtil;
/**
* 对内置参数进行处理
@ -110,9 +110,4 @@ public class ParamsManageForSteps {
}
}
public static void main(String[] args) {
// TODO Auto-generated method stub
}
}

View File

@ -1,17 +1,17 @@
package luckyclient.caserun.publicdispose.actionkeyword;
/**
* 动作关键字注解定义
* @author: sunshaoyan
* @date: Created on 2019/4/13
*/
import java.lang.annotation.*;
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Inherited
public @interface Action {
String name() default "";
}
package luckyclient.execution.dispose.actionkeyword;
/**
* 动作关键字注解定义
* @author: sunshaoyan
* @date: Created on 2019/4/13
*/
import java.lang.annotation.*;
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Inherited
public @interface Action {
String name() default "";
}

View File

@ -1,4 +1,4 @@
package luckyclient.caserun.publicdispose.actionkeyword;
package luckyclient.execution.dispose.actionkeyword;
/**
* 动作关键字的处理接口

View File

@ -1,7 +1,7 @@
package luckyclient.caserun.publicdispose.actionkeyword;
package luckyclient.execution.dispose.actionkeyword;
import luckyclient.driven.SubString;
import luckyclient.publicclass.LogUtil;
import luckyclient.utils.LogUtil;
/**
* 动作关键字的处理接口的实现类获取JSON字符串指定Key的值的

View File

@ -1,29 +1,29 @@
package luckyclient.caserun.publicdispose.actionkeyword;
import com.alibaba.fastjson.JSONObject;
import luckyclient.publicclass.LogUtil;
/**
* 动作关键字的处理接口的实现类从响应header中取出某个header值
* @author: sunshaoyan
* @date: Created on 2019/4/13
*/
@Action(name="header")
public class HeaderParser implements ActionKeyWordParser {
/**
* @param actionorder 动作关键字
*/
@Override
public String parse(String actionParams, String testResult) {
String pre = "RESPONSE_HEAD:【";
String headerStr = testResult.substring(testResult.indexOf(pre) + pre.length(), testResult.indexOf("】 RESPONSE_CODE"));
String getHeader = JSONObject.parseObject(headerStr).getJSONArray(actionParams).getString(0);
LogUtil.APP.info("Action(header):从响应header中取出指定header值是:{}",getHeader);
return getHeader;
}
}
package luckyclient.execution.dispose.actionkeyword;
import com.alibaba.fastjson.JSONObject;
import luckyclient.utils.LogUtil;
/**
* 动作关键字的处理接口的实现类从响应header中取出某个header值
* @author: sunshaoyan
* @date: Created on 2019/4/13
*/
@Action(name="header")
public class HeaderParser implements ActionKeyWordParser {
/**
* @param actionorder 动作关键字
*/
@Override
public String parse(String actionParams, String testResult) {
String pre = "RESPONSE_HEAD:【";
String headerStr = testResult.substring(testResult.indexOf(pre) + pre.length(), testResult.indexOf("】 RESPONSE_CODE"));
String getHeader = JSONObject.parseObject(headerStr).getJSONArray(actionParams).getString(0);
LogUtil.APP.info("Action(header):从响应header中取出指定header值是:{}",getHeader);
return getHeader;
}
}

View File

@ -1,7 +1,7 @@
package luckyclient.caserun.publicdispose.actionkeyword;
package luckyclient.execution.dispose.actionkeyword;
import luckyclient.driven.SubString;
import luckyclient.publicclass.LogUtil;
import luckyclient.utils.LogUtil;
/**
* 动作关键字的处理接口的实现类使用jsonpath处理json字符串

View File

@ -1,34 +1,34 @@
package luckyclient.caserun.publicdispose.actionkeyword;
import luckyclient.driven.SubString;
import luckyclient.publicclass.LogUtil;
/**
* 动作关键字的处理接口的实现类截取测试结果指定开始及结束位置字符串
* @author: sunshaoyan
* @date: Created on 2019/4/13
*/
@Action(name="subcentrenum")
public class SubCentreNumActionParser implements ActionKeyWordParser {
/**
* 截取测试结果指定开始及结束位置字符串
* @param actionKeyWord 动作关键字
* @param testResult 测试结果
*/
@Override
public String parse(String actionParams, String testResult) {
if(actionParams.startsWith("[")&&actionParams.endsWith("]")){
String startnum=actionParams.substring(actionParams.indexOf("[")+1, actionParams.indexOf("]"));
String endnum=actionParams.substring(actionParams.lastIndexOf("[")+1, actionParams.lastIndexOf("]"));
testResult= SubString.subCentreNum(testResult, startnum, endnum);
LogUtil.APP.info("Action(subCentreNum):截取测试结果指定开始及结束位置字符串:{}",testResult);
}else{
testResult="步骤动作subCentreNum 必须是[\"开始字符\"][\"结束字符\"]#subCentreNum 格式,请检查您的步骤动作参数:"+actionParams;
LogUtil.APP.warn("步骤动作subCentreNum 必须是[\"开始位置(整数)\"][\"结束位置(整数)\"]#subCentreNum 格式,请检查您的步骤动作参数:{}",actionParams);
}
return testResult;
}
}
package luckyclient.execution.dispose.actionkeyword;
import luckyclient.driven.SubString;
import luckyclient.utils.LogUtil;
/**
* 动作关键字的处理接口的实现类截取测试结果指定开始及结束位置字符串
* @author: sunshaoyan
* @date: Created on 2019/4/13
*/
@Action(name="subcentrenum")
public class SubCentreNumActionParser implements ActionKeyWordParser {
/**
* 截取测试结果指定开始及结束位置字符串
* @param actionKeyWord 动作关键字
* @param testResult 测试结果
*/
@Override
public String parse(String actionParams, String testResult) {
if(actionParams.startsWith("[")&&actionParams.endsWith("]")){
String startnum=actionParams.substring(actionParams.indexOf("[")+1, actionParams.indexOf("]"));
String endnum=actionParams.substring(actionParams.lastIndexOf("[")+1, actionParams.lastIndexOf("]"));
testResult= SubString.subCentreNum(testResult, startnum, endnum);
LogUtil.APP.info("Action(subCentreNum):截取测试结果指定开始及结束位置字符串:{}",testResult);
}else{
testResult="步骤动作subCentreNum 必须是[\"开始字符\"][\"结束字符\"]#subCentreNum 格式,请检查您的步骤动作参数:"+actionParams;
LogUtil.APP.warn("步骤动作subCentreNum 必须是[\"开始位置(整数)\"][\"结束位置(整数)\"]#subCentreNum 格式,请检查您的步骤动作参数:{}",actionParams);
}
return testResult;
}
}

View File

@ -1,7 +1,7 @@
package luckyclient.caserun.publicdispose.actionkeyword;
package luckyclient.execution.dispose.actionkeyword;
import luckyclient.driven.SubString;
import luckyclient.publicclass.LogUtil;
import luckyclient.utils.LogUtil;
/**
* 动作关键字的处理接口的实现类截取测试结果指定开始及结束位置字符串

View File

@ -1,35 +1,35 @@
package luckyclient.caserun.publicdispose.actionkeyword;
import luckyclient.driven.SubString;
import luckyclient.publicclass.LogUtil;
/**
* 动作关键字的处理接口的实现类获取JSON字符串指定Key的值采用正则匹配
* @author: sunshaoyan
* @date: Created on 2019/4/13
*/
@Action(name="substrrgex")
public class SubStrRegxActionParser implements ActionKeyWordParser {
/**
* 获取JSON字符串指定Key的值采用正则匹配
* @param actionKeyWord 动作关键字
* @param testResult 测试结果
*/
@Override
public String parse(String actionParams, String testResult) {
String key="";
String index="1";
if(actionParams.endsWith("]")&&actionParams.contains("[")){
key=actionParams.substring(0,actionParams.lastIndexOf("["));
index=actionParams.substring(actionParams.lastIndexOf("[")+1, actionParams.lastIndexOf("]"));
testResult= SubString.subStrRgex(testResult, key, index);
}else{
key=actionParams;
testResult= SubString.subStrRgex(testResult, key, index);
}
LogUtil.APP.info("Action(subStrRgex):获取JSON字符串指定Key的值是:{}",testResult);
return testResult;
}
}
package luckyclient.execution.dispose.actionkeyword;
import luckyclient.driven.SubString;
import luckyclient.utils.LogUtil;
/**
* 动作关键字的处理接口的实现类获取JSON字符串指定Key的值采用正则匹配
* @author: sunshaoyan
* @date: Created on 2019/4/13
*/
@Action(name="substrrgex")
public class SubStrRegxActionParser implements ActionKeyWordParser {
/**
* 获取JSON字符串指定Key的值采用正则匹配
* @param actionKeyWord 动作关键字
* @param testResult 测试结果
*/
@Override
public String parse(String actionParams, String testResult) {
String key="";
String index="1";
if(actionParams.endsWith("]")&&actionParams.contains("[")){
key=actionParams.substring(0,actionParams.lastIndexOf("["));
index=actionParams.substring(actionParams.lastIndexOf("[")+1, actionParams.lastIndexOf("]"));
testResult= SubString.subStrRgex(testResult, key, index);
}else{
key=actionParams;
testResult= SubString.subStrRgex(testResult, key, index);
}
LogUtil.APP.info("Action(subStrRgex):获取JSON字符串指定Key的值是:{}",testResult);
return testResult;
}
}

View File

@ -1,38 +1,38 @@
package luckyclient.caserun.publicdispose.actionkeyword;
import luckyclient.caserun.publicdispose.ChangString;
import luckyclient.publicclass.LogUtil;
/**
* 动作关键字的处理接口的实现类线程等待时间
* @author: sunshaoyan
* @date: Created on 2019/4/13
*/
@Action(name="wait")
public class ThreadWaitAction implements ActionKeyWordParser {
/**
* @param actionorder 动作关键字
*/
@Override
public String parse(String actionParams, String testResult) {
if(ChangString.isInteger(actionParams)){
try {
// 获取步骤间等待时间
int time=Integer.parseInt(actionParams);
if (time > 0) {
LogUtil.APP.info("Action(Wait):线程等待【{}】秒...",time);
Thread.sleep(time * 1000);
}
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}else{
LogUtil.APP.error("使用等待关键字的参数不是整数,直接跳过此动作,请检查!");
}
return testResult;
}
}
package luckyclient.execution.dispose.actionkeyword;
import luckyclient.execution.dispose.ChangString;
import luckyclient.utils.LogUtil;
/**
* 动作关键字的处理接口的实现类线程等待时间
* @author: sunshaoyan
* @date: Created on 2019/4/13
*/
@Action(name="wait")
public class ThreadWaitAction implements ActionKeyWordParser {
/**
* @param actionorder 动作关键字
*/
@Override
public String parse(String actionParams, String testResult) {
if(ChangString.isInteger(actionParams)){
try {
// 获取步骤间等待时间
int time=Integer.parseInt(actionParams);
if (time > 0) {
LogUtil.APP.info("Action(Wait):线程等待【{}】秒...",time);
Thread.sleep(time * 1000);
}
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}else{
LogUtil.APP.error("使用等待关键字的参数不是整数,直接跳过此动作,请检查!");
}
return testResult;
}
}

View File

@ -1,4 +1,4 @@
package luckyclient.caserun.exinterface;
package luckyclient.execution.httpinterface;
import java.util.HashMap;
import java.util.List;
@ -6,15 +6,15 @@ import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import luckyclient.caserun.exinterface.analyticsteps.InterfaceAnalyticCase;
import luckyclient.caserun.publicdispose.ActionManageForSteps;
import luckyclient.publicclass.InvokeMethod;
import luckyclient.publicclass.LogUtil;
import luckyclient.publicclass.remoterinterface.HttpRequest;
import luckyclient.serverapi.api.GetServerApi;
import luckyclient.serverapi.entity.ProjectCase;
import luckyclient.serverapi.entity.ProjectCaseParams;
import luckyclient.serverapi.entity.ProjectCaseSteps;
import luckyclient.execution.dispose.ActionManageForSteps;
import luckyclient.execution.httpinterface.analyticsteps.InterfaceAnalyticCase;
import luckyclient.remote.api.GetServerApi;
import luckyclient.remote.entity.ProjectCase;
import luckyclient.remote.entity.ProjectCaseParams;
import luckyclient.remote.entity.ProjectCaseSteps;
import luckyclient.utils.InvokeMethod;
import luckyclient.utils.LogUtil;
import luckyclient.utils.httputils.HttpRequest;
/**
* =================================================================

View File

@ -1,14 +1,14 @@
package luckyclient.caserun.exinterface;
package luckyclient.execution.httpinterface;
import java.util.List;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import luckyclient.dblog.LogOperation;
import luckyclient.publicclass.LogUtil;
import luckyclient.serverapi.api.GetServerApi;
import luckyclient.serverapi.entity.ProjectCase;
import luckyclient.remote.api.GetServerApi;
import luckyclient.remote.api.serverOperation;
import luckyclient.remote.entity.ProjectCase;
import luckyclient.utils.LogUtil;
/**
* =================================================================
@ -37,7 +37,7 @@ public class BatchTestCaseExecution {
//执行全部非成功状态用例
if(batchcase.indexOf("ALLFAIL")>-1){
//初始化写用例结果以及日志模块
LogOperation caselog = new LogOperation();
serverOperation caselog = new serverOperation();
List<Integer> caseIdList = caselog.getCaseListForUnSucByTaskId(taskid);
for(int i=0;i<caseIdList.size();i++){
ProjectCase testcase = GetServerApi.cGetCaseByCaseId(caseIdList.get(i));

View File

@ -1,4 +1,4 @@
package luckyclient.caserun.exinterface;
package luckyclient.execution.httpinterface;
import java.util.HashMap;
import java.util.List;
@ -12,24 +12,23 @@ import io.appium.java_client.android.AndroidDriver;
import io.appium.java_client.android.AndroidElement;
import io.appium.java_client.ios.IOSDriver;
import io.appium.java_client.ios.IOSElement;
import luckyclient.caserun.exappium.AppDriverAnalyticCase;
import luckyclient.caserun.exappium.androidex.AndroidCaseExecution;
import luckyclient.caserun.exappium.iosex.IosCaseExecution;
import luckyclient.caserun.exinterface.analyticsteps.InterfaceAnalyticCase;
import luckyclient.caserun.exwebdriver.ex.WebCaseExecution;
import luckyclient.caserun.exwebdriver.ex.WebDriverAnalyticCase;
import luckyclient.caserun.publicdispose.ActionManageForSteps;
import luckyclient.caserun.publicdispose.ParamsManageForSteps;
import luckyclient.dblog.DbLink;
import luckyclient.dblog.LogOperation;
import luckyclient.driven.SubString;
import luckyclient.publicclass.Constants;
import luckyclient.publicclass.InvokeMethod;
import luckyclient.publicclass.LogUtil;
import luckyclient.serverapi.api.GetServerApi;
import luckyclient.serverapi.entity.ProjectCase;
import luckyclient.serverapi.entity.ProjectCaseParams;
import luckyclient.serverapi.entity.ProjectCaseSteps;
import luckyclient.execution.appium.AppDriverAnalyticCase;
import luckyclient.execution.appium.androidex.AndroidCaseExecution;
import luckyclient.execution.appium.iosex.IosCaseExecution;
import luckyclient.execution.dispose.ActionManageForSteps;
import luckyclient.execution.dispose.ParamsManageForSteps;
import luckyclient.execution.httpinterface.analyticsteps.InterfaceAnalyticCase;
import luckyclient.execution.webdriver.ex.WebCaseExecution;
import luckyclient.execution.webdriver.ex.WebDriverAnalyticCase;
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.utils.Constants;
import luckyclient.utils.InvokeMethod;
import luckyclient.utils.LogUtil;
/**
* =================================================================
@ -52,9 +51,9 @@ public class TestCaseExecution {
*/
public void oneCaseExecuteForTask(String projectname, Integer caseId, String taskid) {
TestControl.TASKID = taskid;
DbLink.exetype = 0;
serverOperation.exetype = 0;
// 初始化写用例结果以及日志模块
LogOperation caselog = new LogOperation();
serverOperation caselog = new serverOperation();
String packagename = null;
String functionname = null;
String expectedresults = null;
@ -66,7 +65,7 @@ public class TestCaseExecution {
//更新用例状态
caselog.updateTaskCaseExecuteStatus(taskid, testcase.getCaseId(), 3);
// 删除旧的日志
LogOperation.deleteTaskCaseLog(testcase.getCaseId(), taskid);
serverOperation.deleteTaskCaseLog(testcase.getCaseId(), taskid);
List<ProjectCaseParams> pcplist = GetServerApi.cgetParamsByProjectid(String.valueOf(testcase.getProjectId()));
// 把公共参数加入到MAP中
@ -172,7 +171,7 @@ public class TestCaseExecution {
LogUtil.APP.warn("用例{}在执行过程中失败,请检查日志!",testcase.getCaseSign());
caselog.insertTaskCaseLog(taskid, testcase.getCaseId(), "在执行过程中失败,请检查日志!", "error", "EXECUTECASESUC...", "");
}
LogOperation.updateTaskExecuteData(taskid, 0, 2);
serverOperation.updateTaskExecuteData(taskid, 0, 2);
}
/**
@ -186,7 +185,7 @@ public class TestCaseExecution {
* 提供给Web用例中runcase的时候使用
*/
@SuppressWarnings("unchecked")
public String oneCaseExecuteForUICase(String testCaseExternalId, String taskid, LogOperation caselog, Object driver) throws InterruptedException {
public String oneCaseExecuteForUICase(String testCaseExternalId, String taskid, serverOperation caselog, Object driver) throws InterruptedException {
String expectedresults = null;
Integer setresult = 1;
String testnote = "初始化测试结果";
@ -277,7 +276,7 @@ public class TestCaseExecution {
* @param caselog
* @return
*/
public String runStep(Map<String, String> params, String taskid, String casenum, ProjectCaseSteps step, LogOperation caselog) {
public String runStep(Map<String, String> params, String taskid, String casenum, ProjectCaseSteps step, serverOperation caselog) {
String result = "";
String packagename = "";
String functionname = "";
@ -327,7 +326,7 @@ public class TestCaseExecution {
return result;
}
private int interfaceJudgeResult(ProjectCase testcase, ProjectCaseSteps step, String taskid, String expectedresults, String testnote, LogOperation caselog){
private int interfaceJudgeResult(ProjectCase testcase, ProjectCaseSteps step, String taskid, String expectedresults, String testnote, serverOperation caselog){
int setresult = 0;
try{
if (null != expectedresults && !expectedresults.isEmpty()) {

View File

@ -1,4 +1,4 @@
package luckyclient.caserun.exinterface;
package luckyclient.execution.httpinterface;
import java.util.ArrayList;
import java.util.List;
@ -6,19 +6,18 @@ import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import luckyclient.dblog.DbLink;
import luckyclient.dblog.LogOperation;
import luckyclient.jenkinsapi.BuildingInitialization;
import luckyclient.jenkinsapi.RestartServerInitialization;
import luckyclient.mail.HtmlMail;
import luckyclient.mail.MailSendInitialization;
import luckyclient.publicclass.LogUtil;
import luckyclient.serverapi.api.GetServerApi;
import luckyclient.serverapi.entity.ProjectCase;
import luckyclient.serverapi.entity.ProjectCaseParams;
import luckyclient.serverapi.entity.ProjectCaseSteps;
import luckyclient.serverapi.entity.TaskExecute;
import luckyclient.serverapi.entity.TaskScheduling;
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.tool.jenkins.BuildingInitialization;
import luckyclient.tool.mail.HtmlMail;
import luckyclient.tool.mail.MailSendInitialization;
import luckyclient.tool.shell.RestartServerInitialization;
import luckyclient.utils.LogUtil;
/**
* =================================================================
@ -42,7 +41,7 @@ public class TestControl {
*/
public static void manualExecutionPlan(String planname) throws Exception {
DbLink.exetype = 1;
serverOperation.exetype = 1;
int threadcount = 10;
// 创建线程池多线程执行用例
ThreadPoolExecutor threadExecute = new ThreadPoolExecutor(threadcount, 20, 3, TimeUnit.SECONDS,
@ -56,7 +55,7 @@ public class TestControl {
String taskid = "888888";
// 初始化写用例结果以及日志模块
LogOperation caselog = new LogOperation();
serverOperation caselog = new serverOperation();
for (ProjectCase testcase : testCases) {
List<ProjectCaseSteps> steps = GetServerApi.getStepsbycaseid(testcase.getCaseId());
if (steps.size() == 0) {
@ -87,7 +86,7 @@ public class TestControl {
*/
public static void taskExecutionPlan(TaskExecute task) throws Exception {
DbLink.exetype = 0;
serverOperation.exetype = 0;
String taskid = task.getTaskId().toString();
TestControl.TASKID = taskid;
String restartstatus = RestartServerInitialization.restartServerRun(taskid);
@ -98,7 +97,7 @@ public class TestControl {
int[] tastcount = null;
List<ProjectCaseParams> pcplist = GetServerApi.cgetParamsByProjectid(taskScheduling.getProjectId().toString());
// 初始化写用例结果以及日志模块
LogOperation caselog = new LogOperation();
serverOperation caselog = new serverOperation();
// 判断是否要自动重启TOMCAT
if (restartstatus.indexOf("Status:true") > -1) {
// 判断是否构建是否成功
@ -110,7 +109,7 @@ public class TestControl {
List<ProjectCase> cases = GetServerApi.getCasesbyplanId(taskScheduling.getPlanId());
LogUtil.APP.info("当前测试任务 {} 中共有【{}】条待测试用例...",task.getTaskName(),cases.size());
LogOperation.updateTaskExecuteStatusIng(taskid, cases.size());
serverOperation.updateTaskExecuteStatusIng(taskid, cases.size());
int casepriority = 0;
for (int j = 0; j < cases.size(); j++) {
ProjectCase projectcase = cases.get(j);
@ -151,9 +150,9 @@ public class TestControl {
}
Thread.sleep(6000);
}
tastcount = LogOperation.updateTaskExecuteData(taskid, cases.size(),taskStatus);
tastcount = serverOperation.updateTaskExecuteData(taskid, cases.size(),taskStatus);
String testtime = LogOperation.getTestTime(taskid);
String testtime = serverOperation.getTestTime(taskid);
MailSendInitialization.sendMailInitialization(HtmlMail.htmlSubjectFormat(jobname),
HtmlMail.htmlContentFormat(tastcount, taskid, buildstatus, restartstatus, testtime, jobname),
taskid, taskScheduling, tastcount);

View File

@ -1,4 +1,4 @@
package luckyclient.caserun.exinterface;
package luckyclient.execution.httpinterface;
/**
* =================================================================

View File

@ -1,4 +1,4 @@
package luckyclient.caserun.exinterface;
package luckyclient.execution.httpinterface;
import java.util.HashMap;
import java.util.List;
@ -6,17 +6,17 @@ import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import luckyclient.caserun.exinterface.analyticsteps.InterfaceAnalyticCase;
import luckyclient.caserun.publicdispose.ActionManageForSteps;
import luckyclient.caserun.publicdispose.ParamsManageForSteps;
import luckyclient.dblog.LogOperation;
import luckyclient.driven.SubString;
import luckyclient.publicclass.Constants;
import luckyclient.publicclass.InvokeMethod;
import luckyclient.publicclass.LogUtil;
import luckyclient.serverapi.entity.ProjectCase;
import luckyclient.serverapi.entity.ProjectCaseParams;
import luckyclient.serverapi.entity.ProjectCaseSteps;
import luckyclient.execution.dispose.ActionManageForSteps;
import luckyclient.execution.dispose.ParamsManageForSteps;
import luckyclient.execution.httpinterface.analyticsteps.InterfaceAnalyticCase;
import luckyclient.remote.api.serverOperation;
import luckyclient.remote.entity.ProjectCase;
import luckyclient.remote.entity.ProjectCaseParams;
import luckyclient.remote.entity.ProjectCaseSteps;
import luckyclient.utils.Constants;
import luckyclient.utils.InvokeMethod;
import luckyclient.utils.LogUtil;
/**
* =================================================================
@ -38,9 +38,9 @@ public class ThreadForExecuteCase extends Thread {
private Integer projectId;
private List<ProjectCaseSteps> steps;
private List<ProjectCaseParams> pcplist;
private LogOperation caselog;
private serverOperation caselog;
public ThreadForExecuteCase(ProjectCase projectcase, List<ProjectCaseSteps> steps, String taskid, List<ProjectCaseParams> pcplist, LogOperation caselog) {
public ThreadForExecuteCase(ProjectCase projectcase, List<ProjectCaseSteps> steps, String taskid, List<ProjectCaseParams> pcplist, serverOperation caselog) {
this.caseId = projectcase.getCaseId();
this.testcase = projectcase;
this.projectId = projectcase.getProjectId();

View File

@ -1,4 +1,4 @@
package luckyclient.caserun.exinterface;
package luckyclient.execution.httpinterface;
import java.util.HashMap;
import java.util.List;
@ -6,16 +6,16 @@ import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import luckyclient.caserun.exinterface.analyticsteps.InterfaceAnalyticCase;
import luckyclient.caserun.publicdispose.ActionManageForSteps;
import luckyclient.driven.SubString;
import luckyclient.publicclass.InvokeMethod;
import luckyclient.publicclass.LogUtil;
import luckyclient.serverapi.api.GetServerApi;
import luckyclient.serverapi.api.PostServerApi;
import luckyclient.serverapi.entity.ProjectCase;
import luckyclient.serverapi.entity.ProjectCaseParams;
import luckyclient.serverapi.entity.ProjectCaseSteps;
import luckyclient.execution.dispose.ActionManageForSteps;
import luckyclient.execution.httpinterface.analyticsteps.InterfaceAnalyticCase;
import luckyclient.remote.api.GetServerApi;
import luckyclient.remote.api.PostServerApi;
import luckyclient.remote.entity.ProjectCase;
import luckyclient.remote.entity.ProjectCaseParams;
import luckyclient.remote.entity.ProjectCaseSteps;
import luckyclient.utils.InvokeMethod;
import luckyclient.utils.LogUtil;
/**
* =================================================================

View File

@ -1,15 +1,15 @@
package luckyclient.caserun.exinterface.analyticsteps;
package luckyclient.execution.httpinterface.analyticsteps;
import java.util.HashMap;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import luckyclient.caserun.publicdispose.ChangString;
import luckyclient.dblog.LogOperation;
import luckyclient.publicclass.LogUtil;
import luckyclient.serverapi.entity.ProjectCase;
import luckyclient.serverapi.entity.ProjectCaseSteps;
import luckyclient.execution.dispose.ChangString;
import luckyclient.remote.api.serverOperation;
import luckyclient.remote.entity.ProjectCase;
import luckyclient.remote.entity.ProjectCaseSteps;
import luckyclient.utils.LogUtil;
/**
* =================================================================
* 这是一个受限制的自由软件您不能在任何未经允许的前提下对程序代码进行修改和用于商业用途也不允许对程序代码修改后以任何形式任何目的的再发布
@ -31,7 +31,7 @@ public class InterfaceAnalyticCase{
* @param caselog
* @return
*/
public static Map<String,String> analyticCaseStep(ProjectCase projectcase,ProjectCaseSteps step,String taskid,LogOperation caselog, Map<String, String> variable){
public static Map<String,String> analyticCaseStep(ProjectCase projectcase,ProjectCaseSteps step,String taskid,serverOperation caselog, Map<String, String> variable){
Map<String,String> params = new HashMap<String,String>(0);
try {

View File

@ -1,4 +1,4 @@
package luckyclient.caserun.exwebdriver;
package luckyclient.execution.webdriver;
import java.io.File;
import java.io.IOException;
@ -11,7 +11,7 @@ import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.remote.Augmenter;
import luckyclient.publicclass.LogUtil;
import luckyclient.utils.LogUtil;
/**
* =================================================================

View File

@ -1,17 +1,16 @@
package luckyclient.caserun.exwebdriver;
package luckyclient.execution.webdriver;
import java.util.List;
import org.openqa.selenium.WebDriver;
import luckyclient.caserun.exwebdriver.ex.WebCaseExecution;
import luckyclient.dblog.DbLink;
import luckyclient.dblog.LogOperation;
import luckyclient.publicclass.LogUtil;
import luckyclient.serverapi.api.GetServerApi;
import luckyclient.serverapi.entity.ProjectCase;
import luckyclient.serverapi.entity.ProjectCaseParams;
import luckyclient.serverapi.entity.ProjectCaseSteps;
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.utils.LogUtil;
/**
* =================================================================
@ -29,8 +28,8 @@ public class CaseLocalDebug{
public static void oneCasedebug(WebDriver wd,String testCaseExternalId){
//不记录日志到数据库
DbLink.exetype = 1;
LogOperation caselog = new LogOperation();
serverOperation.exetype = 1;
serverOperation caselog = new serverOperation();
try {
ProjectCase testcase = GetServerApi.cgetCaseBysign(testCaseExternalId);
List<ProjectCaseParams> pcplist=GetServerApi.cgetParamsByProjectid(String.valueOf(testcase.getProjectId()));

View File

@ -1,4 +1,4 @@
package luckyclient.caserun.exwebdriver;
package luckyclient.execution.webdriver;
import static java.util.concurrent.TimeUnit.MILLISECONDS;
@ -26,9 +26,9 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import luckyclient.caserun.exwebdriver.ocr.Ocr;
import luckyclient.caserun.publicdispose.ChangString;
import luckyclient.publicclass.LogUtil;
import luckyclient.execution.dispose.ChangString;
import luckyclient.execution.webdriver.ocr.Ocr;
import luckyclient.utils.LogUtil;
/**
* =================================================================

View File

@ -1,4 +1,4 @@
package luckyclient.caserun.exwebdriver;
package luckyclient.execution.webdriver;
import java.io.IOException;

View File

@ -1,4 +1,4 @@
package luckyclient.caserun.exwebdriver;
package luckyclient.execution.webdriver;
import java.io.File;
import java.io.IOException;
@ -13,7 +13,7 @@ import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.firefox.FirefoxOptions;
import org.openqa.selenium.ie.InternetExplorerDriver;
import luckyclient.publicclass.LogUtil;
import luckyclient.utils.LogUtil;
/**
* =================================================================

View File

@ -1,4 +1,4 @@
package luckyclient.caserun.exwebdriver;
package luckyclient.execution.webdriver;
import java.io.IOException;
import java.util.ArrayList;
@ -7,21 +7,20 @@ import java.util.List;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebDriverException;
import luckyclient.caserun.exinterface.TestControl;
import luckyclient.caserun.exwebdriver.ex.WebCaseExecution;
import luckyclient.dblog.DbLink;
import luckyclient.dblog.LogOperation;
import luckyclient.jenkinsapi.BuildingInitialization;
import luckyclient.jenkinsapi.RestartServerInitialization;
import luckyclient.mail.HtmlMail;
import luckyclient.mail.MailSendInitialization;
import luckyclient.publicclass.LogUtil;
import luckyclient.serverapi.api.GetServerApi;
import luckyclient.serverapi.entity.ProjectCase;
import luckyclient.serverapi.entity.ProjectCaseParams;
import luckyclient.serverapi.entity.ProjectCaseSteps;
import luckyclient.serverapi.entity.TaskExecute;
import luckyclient.serverapi.entity.TaskScheduling;
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.tool.jenkins.BuildingInitialization;
import luckyclient.tool.mail.HtmlMail;
import luckyclient.tool.mail.MailSendInitialization;
import luckyclient.tool.shell.RestartServerInitialization;
import luckyclient.utils.LogUtil;
/**
* =================================================================
@ -44,7 +43,7 @@ public class WebTestControl {
public static void manualExecutionPlan(String planname) {
// 不记日志到数据库
DbLink.exetype = 1;
serverOperation.exetype = 1;
String taskid = "888888";
WebDriver wd = null;
try {
@ -53,7 +52,7 @@ public class WebTestControl {
// TODO Auto-generated catch block
LogUtil.APP.error("初始化WebDriver出现异常",e);
}
LogOperation caselog = new LogOperation();
serverOperation caselog = new serverOperation();
List<ProjectCase> testCases = GetServerApi.getCasesbyplanname(planname);
List<ProjectCaseParams> pcplist = new ArrayList<ProjectCaseParams>();
if (testCases.size() != 0) {
@ -83,7 +82,7 @@ public class WebTestControl {
public static void taskExecutionPlan(TaskExecute task) throws InterruptedException {
// 记录日志到数据库
DbLink.exetype = 0;
serverOperation.exetype = 0;
String taskid = task.getTaskId().toString();
TestControl.TASKID = taskid;
String restartstatus = RestartServerInitialization.restartServerRun(taskid);
@ -93,7 +92,7 @@ public class WebTestControl {
String projectname = taskScheduling.getProject().getProjectName();
task = GetServerApi.cgetTaskbyid(Integer.valueOf(taskid));
String jobname = taskScheduling.getSchedulingName();
int drivertype = LogOperation.querydrivertype(taskid);
int drivertype = serverOperation.querydrivertype(taskid);
int[] tastcount = null;
// 判断是否要自动重启TOMCAT
if (restartstatus.indexOf("Status:true") > -1) {
@ -107,11 +106,11 @@ public class WebTestControl {
} catch (IOException e2) {
LogUtil.APP.error("初始化WebDriver出错 IOException", e2);
}
LogOperation caselog = new LogOperation();
serverOperation caselog = new serverOperation();
List<ProjectCase> cases = GetServerApi.getCasesbyplanId(taskScheduling.getPlanId());
LogUtil.APP.info("当前测试任务 {} 中共有【{}】条待测试用例...",task.getTaskName(),cases.size());
LogOperation.updateTaskExecuteStatusIng(taskid, cases.size());
serverOperation.updateTaskExecuteStatusIng(taskid, cases.size());
int i = 0;
for (ProjectCase testcase : cases) {
i++;
@ -130,9 +129,9 @@ public class WebTestControl {
}
LogUtil.APP.info("当前用例:【{}】执行完成......进入下一条",testcase.getCaseSign());
}
tastcount = LogOperation.updateTaskExecuteData(taskid, cases.size(),2);
tastcount = serverOperation.updateTaskExecuteData(taskid, cases.size(),2);
String testtime = LogOperation.getTestTime(taskid);
String testtime = serverOperation.getTestTime(taskid);
LogUtil.APP.info("当前项目【{}】测试计划中的用例已经全部执行完成...",projectname);
MailSendInitialization.sendMailInitialization(HtmlMail.htmlSubjectFormat(jobname),
HtmlMail.htmlContentFormat(tastcount, taskid, buildstatus, restartstatus, testtime, jobname),

View File

@ -1,4 +1,4 @@
package luckyclient.caserun.exwebdriver.ex;
package luckyclient.execution.webdriver.ex;
import java.io.IOException;
import java.net.MalformedURLException;
@ -6,16 +6,15 @@ import java.util.List;
import org.openqa.selenium.WebDriver;
import luckyclient.caserun.exinterface.TestControl;
import luckyclient.caserun.exwebdriver.WebDriverInitialization;
import luckyclient.dblog.DbLink;
import luckyclient.dblog.LogOperation;
import luckyclient.publicclass.LogUtil;
import luckyclient.serverapi.api.GetServerApi;
import luckyclient.serverapi.entity.ProjectCase;
import luckyclient.serverapi.entity.ProjectCaseParams;
import luckyclient.serverapi.entity.ProjectCaseSteps;
import luckyclient.serverapi.entity.TaskExecute;
import luckyclient.execution.httpinterface.TestControl;
import luckyclient.execution.webdriver.WebDriverInitialization;
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.utils.LogUtil;
/**
* =================================================================
@ -32,9 +31,9 @@ public class WebBatchExecute{
public static void batchCaseExecuteForTast(String projectname,String taskid,String batchcase) throws IOException{
//记录日志到数据库
DbLink.exetype = 0;
serverOperation.exetype = 0;
TestControl.TASKID = taskid;
int drivertype = LogOperation.querydrivertype(taskid);
int drivertype = serverOperation.querydrivertype(taskid);
WebDriver wd = null;
try {
wd = WebDriverInitialization.setWebDriverForTask(drivertype);
@ -42,7 +41,7 @@ public class WebBatchExecute{
// TODO Auto-generated catch block
LogUtil.APP.error("初始化WebDriver出现异常", e1);
}
LogOperation caselog = new LogOperation();
serverOperation caselog = new serverOperation();
TaskExecute task=GetServerApi.cgetTaskbyid(Integer.valueOf(taskid));
List<ProjectCaseParams> pcplist=GetServerApi.cgetParamsByProjectid(task.getProjectId().toString());
//执行全部非成功状态用例
@ -52,7 +51,7 @@ public class WebBatchExecute{
ProjectCase testcase = GetServerApi.cGetCaseByCaseId(caseIdList.get(i));
List<ProjectCaseSteps> steps=GetServerApi.getStepsbycaseid(testcase.getCaseId());
//删除旧的日志
LogOperation.deleteTaskCaseLog(testcase.getCaseId(), taskid);
serverOperation.deleteTaskCaseLog(testcase.getCaseId(), taskid);
try {
WebCaseExecution.caseExcution(testcase, steps, taskid,wd,caselog,pcplist);
} catch (InterruptedException e) {
@ -66,7 +65,7 @@ public class WebBatchExecute{
ProjectCase testcase = GetServerApi.cGetCaseByCaseId(Integer.valueOf(temp[i]));
List<ProjectCaseSteps> steps=GetServerApi.getStepsbycaseid(testcase.getCaseId());
//删除旧的日志
LogOperation.deleteTaskCaseLog(testcase.getCaseId(), taskid);
serverOperation.deleteTaskCaseLog(testcase.getCaseId(), taskid);
try {
WebCaseExecution.caseExcution(testcase, steps,taskid,wd,caselog,pcplist);
} catch (InterruptedException e) {
@ -75,7 +74,7 @@ public class WebBatchExecute{
}
}
}
LogOperation.updateTaskExecuteData(taskid, 0,2);
serverOperation.updateTaskExecuteData(taskid, 0,2);
//关闭浏览器
wd.quit();
}

View File

@ -1,4 +1,4 @@
package luckyclient.caserun.exwebdriver.ex;
package luckyclient.execution.webdriver.ex;
import java.util.Date;
import java.util.HashMap;
@ -11,18 +11,18 @@ import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import luckyclient.caserun.exinterface.TestCaseExecution;
import luckyclient.caserun.exinterface.analyticsteps.InterfaceAnalyticCase;
import luckyclient.caserun.exwebdriver.BaseWebDrive;
import luckyclient.caserun.exwebdriver.EncapsulateOperation;
import luckyclient.caserun.publicdispose.ActionManageForSteps;
import luckyclient.caserun.publicdispose.ParamsManageForSteps;
import luckyclient.dblog.LogOperation;
import luckyclient.publicclass.Constants;
import luckyclient.publicclass.LogUtil;
import luckyclient.serverapi.entity.ProjectCase;
import luckyclient.serverapi.entity.ProjectCaseParams;
import luckyclient.serverapi.entity.ProjectCaseSteps;
import luckyclient.execution.dispose.ActionManageForSteps;
import luckyclient.execution.dispose.ParamsManageForSteps;
import luckyclient.execution.httpinterface.TestCaseExecution;
import luckyclient.execution.httpinterface.analyticsteps.InterfaceAnalyticCase;
import luckyclient.execution.webdriver.BaseWebDrive;
import luckyclient.execution.webdriver.EncapsulateOperation;
import luckyclient.remote.api.serverOperation;
import luckyclient.remote.entity.ProjectCase;
import luckyclient.remote.entity.ProjectCaseParams;
import luckyclient.remote.entity.ProjectCaseSteps;
import luckyclient.utils.Constants;
import luckyclient.utils.LogUtil;
/**
* =================================================================
@ -39,7 +39,7 @@ public class WebCaseExecution{
private static String casenote = "备注初始化";
private static String imagname = "";
public static void caseExcution(ProjectCase testcase, List<ProjectCaseSteps> steps, String taskid, WebDriver wd, LogOperation caselog, List<ProjectCaseParams> pcplist) throws InterruptedException {
public static void caseExcution(ProjectCase testcase, List<ProjectCaseSteps> steps, String taskid, WebDriver wd, serverOperation caselog, List<ProjectCaseParams> pcplist) throws InterruptedException {
caselog.updateTaskCaseExecuteStatus(taskid, testcase.getCaseId(), 3);
// 把公共参数加入到MAP中
for (ProjectCaseParams pcp : pcplist) {
@ -101,7 +101,7 @@ public class WebCaseExecution{
}
}
public static String runWebStep(Map<String, String> params, WebDriver wd, String taskid, Integer caseId, int stepno, LogOperation caselog) {
public static String runWebStep(Map<String, String> params, WebDriver wd, String taskid, Integer caseId, int stepno, serverOperation caselog) {
String result = "";
String property;
String propertyValue;
@ -237,7 +237,7 @@ public class WebCaseExecution{
}
public static int judgeResult(ProjectCase testcase, ProjectCaseSteps step, Map<String, String> params, WebDriver driver, String taskid, String expect, String result, LogOperation caselog) throws InterruptedException {
public static int judgeResult(ProjectCase testcase, ProjectCaseSteps step, Map<String, String> params, WebDriver driver, String taskid, String expect, String result, serverOperation caselog) throws InterruptedException {
int setresult = 0;
java.text.DateFormat timeformat = new java.text.SimpleDateFormat("MMdd-hhmmss");
imagname = timeformat.format(new Date());

View File

@ -1,4 +1,4 @@
package luckyclient.caserun.exwebdriver.ex;
package luckyclient.execution.webdriver.ex;
import java.util.HashMap;
import java.util.Map;
@ -7,11 +7,11 @@ import java.util.regex.Pattern;
import org.apache.commons.lang3.StringUtils;
import luckyclient.caserun.publicdispose.ChangString;
import luckyclient.dblog.LogOperation;
import luckyclient.publicclass.LogUtil;
import luckyclient.serverapi.entity.ProjectCase;
import luckyclient.serverapi.entity.ProjectCaseSteps;
import luckyclient.execution.dispose.ChangString;
import luckyclient.remote.api.serverOperation;
import luckyclient.remote.entity.ProjectCase;
import luckyclient.remote.entity.ProjectCaseSteps;
import luckyclient.utils.LogUtil;
/**
* =================================================================
@ -39,7 +39,7 @@ public class WebDriverAnalyticCase {
* @date 2019Äê1ÔÂ17ÈÕ
*/
public static Map<String, String> analyticCaseStep(ProjectCase projectcase, ProjectCaseSteps step, String taskid,
LogOperation caselog, Map<String, String> variable) {
serverOperation caselog, Map<String, String> variable) {
Map<String, String> params = new HashMap<String, String>(0);
String resultstr = null;

View File

@ -1,19 +1,18 @@
package luckyclient.caserun.exwebdriver.ex;
package luckyclient.execution.webdriver.ex;
import java.io.IOException;
import java.util.List;
import org.openqa.selenium.WebDriver;
import luckyclient.caserun.exinterface.TestControl;
import luckyclient.caserun.exwebdriver.WebDriverInitialization;
import luckyclient.dblog.DbLink;
import luckyclient.dblog.LogOperation;
import luckyclient.publicclass.LogUtil;
import luckyclient.serverapi.api.GetServerApi;
import luckyclient.serverapi.entity.ProjectCase;
import luckyclient.serverapi.entity.ProjectCaseParams;
import luckyclient.serverapi.entity.ProjectCaseSteps;
import luckyclient.execution.httpinterface.TestControl;
import luckyclient.execution.webdriver.WebDriverInitialization;
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.utils.LogUtil;
/**
* =================================================================
@ -30,19 +29,19 @@ public class WebOneCaseExecute{
public static void oneCaseExecuteForTast(String projectname,Integer caseId,int version,String taskid){
//记录日志到数据库
DbLink.exetype = 0;
serverOperation.exetype = 0;
TestControl.TASKID = taskid;
int drivertype = LogOperation.querydrivertype(taskid);
int drivertype = serverOperation.querydrivertype(taskid);
WebDriver wd = null;
try {
wd = WebDriverInitialization.setWebDriverForTask(drivertype);
} catch (IOException e1) {
LogUtil.APP.error("初始化WebDriver出错", e1);
}
LogOperation caselog = new LogOperation();
serverOperation caselog = new serverOperation();
ProjectCase testcase = GetServerApi.cGetCaseByCaseId(caseId);
//删除旧的日志
LogOperation.deleteTaskCaseLog(testcase.getCaseId(), taskid);
serverOperation.deleteTaskCaseLog(testcase.getCaseId(), taskid);
List<ProjectCaseParams> pcplist=GetServerApi.cgetParamsByProjectid(String.valueOf(testcase.getProjectId()));
LogUtil.APP.info("开始执行用例:【{}】......",testcase.getCaseSign());
@ -53,7 +52,7 @@ public class WebOneCaseExecute{
} catch (InterruptedException e) {
LogUtil.APP.error("用户执行过程中抛出异常!", e);
}
LogOperation.updateTaskExecuteData(taskid, 0,2);
serverOperation.updateTaskExecuteData(taskid, 0,2);
//关闭浏览器
wd.quit();
}

View File

@ -1,4 +1,4 @@
package luckyclient.caserun.exwebdriver.ocr;
package luckyclient.execution.webdriver.ocr;
import java.awt.Rectangle;
import java.awt.image.BufferedImage;

View File

@ -1,19 +1,19 @@
package luckyclient.serverapi.api;
package luckyclient.remote.api;
import java.io.UnsupportedEncodingException;
import java.util.List;
import com.alibaba.fastjson.JSONObject;
import luckyclient.caserun.publicdispose.ParamsManageForSteps;
import luckyclient.publicclass.remoterinterface.HttpRequest;
import luckyclient.serverapi.entity.ProjectCase;
import luckyclient.serverapi.entity.ProjectCaseParams;
import luckyclient.serverapi.entity.ProjectCaseSteps;
import luckyclient.serverapi.entity.ProjectProtocolTemplate;
import luckyclient.serverapi.entity.ProjectTemplateParams;
import luckyclient.serverapi.entity.TaskExecute;
import luckyclient.serverapi.entity.TaskScheduling;
import luckyclient.execution.dispose.ParamsManageForSteps;
import luckyclient.remote.entity.ProjectCase;
import luckyclient.remote.entity.ProjectCaseParams;
import luckyclient.remote.entity.ProjectCaseSteps;
import luckyclient.remote.entity.ProjectProtocolTemplate;
import luckyclient.remote.entity.ProjectTemplateParams;
import luckyclient.remote.entity.TaskExecute;
import luckyclient.remote.entity.TaskScheduling;
import luckyclient.utils.httputils.HttpRequest;
/**

View File

@ -1,12 +1,12 @@
package luckyclient.serverapi.api;
package luckyclient.remote.api;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import luckyclient.publicclass.remoterinterface.HttpRequest;
import luckyclient.serverapi.entity.ProjectCaseDebug;
import luckyclient.serverapi.entity.TaskCaseExecute;
import luckyclient.serverapi.entity.TaskCaseLog;
import luckyclient.remote.entity.ProjectCaseDebug;
import luckyclient.remote.entity.TaskCaseExecute;
import luckyclient.remote.entity.TaskCaseLog;
import luckyclient.utils.httputils.HttpRequest;
/**

View File

@ -1,15 +1,13 @@
package luckyclient.dblog;
package luckyclient.remote.api;
import java.util.Date;
import java.util.List;
import com.alibaba.fastjson.JSONObject;
import luckyclient.publicclass.LogUtil;
import luckyclient.serverapi.api.GetServerApi;
import luckyclient.serverapi.api.PostServerApi;
import luckyclient.serverapi.entity.TaskExecute;
import luckyclient.serverapi.entity.TaskScheduling;
import luckyclient.remote.entity.TaskExecute;
import luckyclient.remote.entity.TaskScheduling;
import luckyclient.utils.LogUtil;
/**
*
@ -20,8 +18,11 @@ import luckyclient.serverapi.entity.TaskScheduling;
* @author Seagull
* @date 2019年4月23日
*/
public class LogOperation {
static int exetype = DbLink.exetype;
public class serverOperation {
/**
* 任务执行类型 0 任务调度模式 1 控制台模式
*/
public static int exetype;
/**
* 插入用例执行状态 0通过 1失败 2锁定 3执行中 4未执行

View File

@ -1,4 +1,4 @@
package luckyclient.serverapi.entity;
package luckyclient.remote.entity;
import java.io.Serializable;
import java.util.Date;

View File

@ -1,4 +1,4 @@
package luckyclient.serverapi.entity;
package luckyclient.remote.entity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

View File

@ -1,4 +1,4 @@
package luckyclient.serverapi.entity;
package luckyclient.remote.entity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

View File

@ -1,4 +1,4 @@
package luckyclient.serverapi.entity;
package luckyclient.remote.entity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

View File

@ -1,4 +1,4 @@
package luckyclient.serverapi.entity;
package luckyclient.remote.entity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

View File

@ -1,4 +1,4 @@
package luckyclient.serverapi.entity;
package luckyclient.remote.entity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

View File

@ -1,4 +1,4 @@
package luckyclient.serverapi.entity;
package luckyclient.remote.entity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

View File

@ -1,4 +1,4 @@
package luckyclient.serverapi.entity;
package luckyclient.remote.entity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

View File

@ -1,4 +1,4 @@
package luckyclient.serverapi.entity;
package luckyclient.remote.entity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

View File

@ -1,4 +1,4 @@
package luckyclient.serverapi.entity;
package luckyclient.remote.entity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

View File

@ -1,4 +1,4 @@
package luckyclient.serverapi.entity;
package luckyclient.remote.entity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

View File

@ -1,4 +1,4 @@
package luckyclient.serverapi.entity;
package luckyclient.remote.entity;
import java.util.Date;

View File

@ -1,4 +1,4 @@
package luckyclient.serverapi.entity;
package luckyclient.remote.entity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

View File

@ -1,4 +1,4 @@
package luckyclient.serverapi.entity;
package luckyclient.remote.entity;
import java.util.Date;

View File

@ -1,4 +1,4 @@
package luckyclient.serverapi.entity;
package luckyclient.remote.entity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

View File

@ -1,4 +1,4 @@
package luckyclient.serverapi.entity.monitor;
package luckyclient.remote.entity.monitor;
import java.math.BigDecimal;

View File

@ -1,4 +1,4 @@
package luckyclient.serverapi.entity.monitor;
package luckyclient.remote.entity.monitor;
/**
* CPU相关信息

View File

@ -1,4 +1,4 @@
package luckyclient.serverapi.entity.monitor;
package luckyclient.remote.entity.monitor;
import java.net.InetAddress;
import java.net.UnknownHostException;

View File

@ -1,8 +1,8 @@
package luckyclient.serverapi.entity.monitor;
package luckyclient.remote.entity.monitor;
import java.lang.management.ManagementFactory;
import luckyclient.publicclass.DateUtils;
import luckyclient.utils.DateUtils;
/**
* JVM相关信息

View File

@ -1,4 +1,4 @@
package luckyclient.serverapi.entity.monitor;
package luckyclient.remote.entity.monitor;
/**
* 內存相关信息

View File

@ -1,4 +1,4 @@
package luckyclient.serverapi.entity.monitor;
package luckyclient.remote.entity.monitor;
import java.net.UnknownHostException;
import java.util.LinkedList;

View File

@ -1,4 +1,4 @@
package luckyclient.serverapi.entity.monitor;
package luckyclient.remote.entity.monitor;
/**
* 系统相关信息

View File

@ -1,4 +1,4 @@
package luckyclient.serverapi.entity.monitor;
package luckyclient.remote.entity.monitor;
/**
* 系统文件相关信息

View File

@ -1,7 +1,7 @@
package luckyclient.jenkinsapi;
package luckyclient.tool.jenkins;
import luckyclient.dblog.LogOperation;
import luckyclient.publicclass.LogUtil;
import luckyclient.remote.api.serverOperation;
import luckyclient.utils.LogUtil;
/**
* =================================================================
@ -46,7 +46,7 @@ public class BuildingInitialization {
public static String buildingRun(String tastid) throws InterruptedException{
String result = "Status:true"+" 当前任务没有找到需要构建的项目!";
try{
String[] buildurl = LogOperation.getBuildName(tastid);
String[] buildurl = serverOperation.getBuildName(tastid);
if(buildurl!=null){
LogUtil.APP.info("准备将配置的测试项目进行构建!请稍等。。。。");

View File

@ -0,0 +1,164 @@
package luckyclient.tool.jenkins;
import java.io.IOException;
import java.util.List;
import java.util.Map;
import com.offbytwo.jenkins.JenkinsServer;
import com.offbytwo.jenkins.model.Computer;
import com.offbytwo.jenkins.model.Plugin;
import com.offbytwo.jenkins.model.PluginManager;
import luckyclient.utils.LogUtil;
/**
* 获取 Jenkins 基础信息以及基本操作
* =================================================================
* 这是一个受限制的自由软件您不能在任何未经允许的前提下对程序代码进行修改和用于商业用途也不允许对程序代码修改后以任何形式任何目的的再发布
* 为了尊重作者的劳动成果LuckyFrame关键版权信息严禁篡改 有任何疑问欢迎联系作者讨论 QQ:1573584944 Seagull
* =================================================================
* @author Seagull
* @date 2019年10月29日
*/
public class JenkinsBaseApi {
// Jenkins 对象
private JenkinsServer jenkinsServer;
/**
* 构造方法中调用连接 Jenkins 方法
* @param jenkinsConnect
* 2019年10月29日
*/
JenkinsBaseApi(JenkinsConnect jenkinsConnect){
this.jenkinsServer = jenkinsConnect.connection();
}
/**
* 获取主机信息
* @author Seagull
* @date 2019年10月29日
*/
public void getComputerInfo() {
try {
Map<String, Computer> map = jenkinsServer.getComputers();
for (Computer computer : map.values()) {
// 获取当前节点-节点名称
LogUtil.APP.info("当前节点-节点名称:{}",computer.details().getDisplayName());
// 获取当前节点-执行者数量
LogUtil.APP.info("当前节点-执行者数量:{}",computer.details().getNumExecutors().toString());
// 获取当前节点-执行者详细信息
//List<Executor> executorList = computer.details().getExecutors();
// 查看当前节点-是否脱机
LogUtil.APP.info("当前节点-是否脱机:{}",computer.details().getOffline().toString());
// 获得节点的全部统计信息
//LoadStatistics loadStatistics = computer.details().getLoadStatistics();
// 获取节点的-监控数据
//Map<String, Map> monitorData = computer.details().getMonitorData();
//......
}
} catch (IOException e) {
e.printStackTrace();
}
}
/**
* 重启 Jenkins
* @author Seagull
* @date 2019年10月29日
*/
public void restart() {
try {
LogUtil.APP.info("准备重启Jenkins...");
jenkinsServer.restart(true);
LogUtil.APP.info("重启Jenkins成功");
} catch (IOException e) {
LogUtil.APP.error("重启Jenkins出现异常",e);
}
}
/**
* 安全重启 Jenkins
* @author Seagull
* @date 2019年10月29日
*/
public void safeRestart() {
try {
LogUtil.APP.info("准备安全重启 Jenkins...");
jenkinsServer.safeRestart(true);
LogUtil.APP.info("安全重启Jenkins成功");
} catch (IOException e) {
LogUtil.APP.error("安全重启Jenkins出现异常",e);
}
}
/**
* 安全结束 Jenkins
*
* @author Seagull
* @date 2019年10月29日
*/
public void safeExit() {
try {
LogUtil.APP.info("准备安全结束 Jenkins...");
jenkinsServer.safeExit(true);
LogUtil.APP.info("安全结束 Jenkins成功");
} catch (IOException e) {
LogUtil.APP.error("安全结束Jenkins出现异常",e);
}
}
/**
* 关闭 Jenkins 连接
*
* @author Seagull
* @date 2019年10月29日
*/
public void close() {
LogUtil.APP.info("准备关闭Jenkins连接");
jenkinsServer.close();
LogUtil.APP.info("关闭Jenkins连接成功");
}
/**
* 判断 Jenkins 是否运行
*
* @author Seagull
* @date 2019年10月29日
*/
public void isRunning() {
boolean isRunning = jenkinsServer.isRunning();
LogUtil.APP.info("Jenkins运行状态:{}",isRunning);
}
/**
* 获取 Jenkins 插件信息
*
* @author Seagull
* @date 2019年10月29日
*/
public void getPluginInfo(){
try {
PluginManager pluginManager =jenkinsServer.getPluginManager();
// 获取插件列表
List<Plugin> plugins = pluginManager.getPlugins();
for (Plugin plugin:plugins){
// 插件 wiki URL 地址
LogUtil.APP.info(plugin.getUrl());
// 版本号
LogUtil.APP.info(plugin.getVersion());
// 简称
LogUtil.APP.info(plugin.getShortName());
// 完整名称
LogUtil.APP.info(plugin.getLongName());
// 是否支持动态加载
LogUtil.APP.info(plugin.getSupportsDynamicLoad());
// 插件依赖的组件
//LogUtil.APP.info(plugin.getDependencies());
}
} catch (IOException e) {
e.printStackTrace();
}
}
}

View File

@ -1,4 +1,4 @@
package luckyclient.jenkinsapi;
package luckyclient.tool.jenkins;
import java.io.BufferedReader;
import java.io.InputStreamReader;
@ -7,7 +7,7 @@ import java.net.URLConnection;
import java.util.List;
import java.util.Map;
import luckyclient.publicclass.LogUtil;
import luckyclient.utils.LogUtil;
/**
* =================================================================

View File

@ -0,0 +1,69 @@
package luckyclient.tool.jenkins;
import com.offbytwo.jenkins.JenkinsServer;
import com.offbytwo.jenkins.client.JenkinsHttpClient;
import luckyclient.utils.LogUtil;
import luckyclient.utils.SysConfig;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.Properties;
/**
* Jenkins链接
* =================================================================
* 这是一个受限制的自由软件您不能在任何未经允许的前提下对程序代码进行修改和用于商业用途也不允许对程序代码修改后以任何形式任何目的的再发布
* 为了尊重作者的劳动成果LuckyFrame关键版权信息严禁篡改 有任何疑问欢迎联系作者讨论 QQ:1573584944 Seagull
* =================================================================
* @author Seagull
* @date 2019年10月29日
*/
public class JenkinsConnect {
private String JENKINS_URL;
private String JENKINS_USERNAME;
private String JENKINS_PASSWORD;
JenkinsConnect() {
Properties properties = SysConfig.getConfiguration();
this.JENKINS_URL=properties.getProperty("jenkins.url");
this.JENKINS_USERNAME=properties.getProperty("jenkins.username");
this.JENKINS_PASSWORD=properties.getProperty("jenkins.password");
}
/**
* 如果有些 API 该Jar工具包未提供可以用此Http客户端操作远程接口执行命令
* @return
* @author Seagull
* @date 2019年10月29日
*/
public JenkinsHttpClient getClient() {
JenkinsHttpClient jenkinsHttpClient = null;
try {
jenkinsHttpClient = new JenkinsHttpClient(new URI(JENKINS_URL), JENKINS_USERNAME, JENKINS_PASSWORD);
} catch (URISyntaxException e) {
e.printStackTrace();
}
return jenkinsHttpClient;
}
/**
* Jenkins API链接
* @return
* @author Seagull
* @date 2019年10月29日
*/
public JenkinsServer connection() {
JenkinsServer jenkinsServer = null;
try {
LogUtil.APP.info("准备连接Jenkins...URL:{} 用户名:{} 密码:{}",JENKINS_URL,JENKINS_USERNAME,JENKINS_PASSWORD);
jenkinsServer = new JenkinsServer(new URI(JENKINS_URL), JENKINS_USERNAME, JENKINS_PASSWORD);
LogUtil.APP.info("连接Jenkins成功");
LogUtil.APP.info("Jenkins版本:{}",jenkinsServer.getVersion());
} catch (URISyntaxException e) {
LogUtil.APP.error("连接Jenkins出现异常",e);
}
return jenkinsServer;
}
}

View File

@ -0,0 +1,144 @@
package luckyclient.tool.jenkins;
import java.io.IOException;
import java.util.List;
import com.offbytwo.jenkins.JenkinsServer;
import com.offbytwo.jenkins.helper.Range;
import com.offbytwo.jenkins.model.Build;
import com.offbytwo.jenkins.model.BuildCause;
import com.offbytwo.jenkins.model.BuildWithDetails;
import com.offbytwo.jenkins.model.ConsoleLog;
import com.offbytwo.jenkins.model.JobWithDetails;
/**
* * Job Build(任务构建) 相关操作
* 例如对任务 Build 相关的信息进行获取操作例如获取构建日志
* =================================================================
* 这是一个受限制的自由软件您不能在任何未经允许的前提下对程序代码进行修改和用于商业用途也不允许对程序代码修改后以任何形式任何目的的再发布
* 为了尊重作者的劳动成果LuckyFrame关键版权信息严禁篡改 有任何疑问欢迎联系作者讨论 QQ:1573584944 Seagull
* =================================================================
* @author Seagull
* @date 2019年10月30日
*/
public class JobBuildApi {
// Jenkins 对象
private JenkinsServer jenkinsServer;
// http 客户端对象
//private JenkinsHttpClient jenkinsHttpClient;
/**
* 构造方法中调用连接 Jenkins 方法
*
* 2019年10月30日
*/
JobBuildApi() {
JenkinsConnect jenkinsConnect = new JenkinsConnect();
// 连接 Jenkins
jenkinsServer = jenkinsConnect.connection();
// 设置客户端连接 Jenkins
//jenkinsHttpClient = jenkinsConnect.getClient();
}
/**
* 获取 最后一次Build的详细信息
* @param jobName
* @author Seagull
* @date 2019年10月30日
*/
public void getJobLastBuildDetail(String jobName){
try {
// 获取 Job 信息
JobWithDetails job = jenkinsServer.getJob(jobName);
// 这里用最后一次编译来示例
BuildWithDetails build = job.getLastBuild().details();
// 获取构建的显示名称
System.out.println(build.getDisplayName());
// 获取构建的参数信息
System.out.println(build.getParameters());
// 获取构建编号
System.out.println(build.getNumber());
// 获取构建结果如果构建未完成则会显示为null
System.out.println(build.getResult());
// 获取执行构建的活动信息
System.out.println(build.getActions());
// 获取构建持续多少时间(ms)
System.out.println(build.getDuration());
// 获取构建开始时间戳
System.out.println(build.getTimestamp());
// 获取构建头信息里面包含构建的用户上游信息时间戳等
List<BuildCause> buildCauses = build.getCauses();
for (BuildCause bc:buildCauses){
System.out.println(bc.getUserId());
System.out.println(bc.getShortDescription());
System.out.println(bc.getUpstreamBuild());
System.out.println(bc.getUpstreamProject());
System.out.println(bc.getUpstreamUrl());
System.out.println(bc.getUserName());
}
} catch (IOException e) {
e.printStackTrace();
}
}
/**
* 获取 Build Log 日志信息
*/
public void getJobBuildLog(){
try {
// 获取 Job 信息
JobWithDetails job = jenkinsServer.getJob("test-job");
// 这里用最后一次编译来示例
BuildWithDetails build = job.getLastBuild().details();
// 获取构建的日志如果正在执行构建则会只获取已经执行的过程日志
// Text格式日志
System.out.println(build.getConsoleOutputText());
// Html格式日志
System.out.println(build.getConsoleOutputHtml());
// 获取部分日志,一般用于正在执行构建的任务
ConsoleLog consoleLog = build.getConsoleOutputText(0);
// 获取当前日志大小
System.out.println(consoleLog.getCurrentBufferSize());
// 是否已经构建完成还有更多日志信息
System.out.println(consoleLog.getHasMoreData());
// 获取当前截取的日志信息
System.out.println(consoleLog.getConsoleLog());
}catch (IOException e) {
e.printStackTrace();
}
}
/**
* 获取正在执行构建任务的日志信息
*/
public void getBuildActiveLog(){
try {
// 这里用最后一次编译来示例
BuildWithDetails build = jenkinsServer.getJob("test-job").getLastBuild().details();
// 当前日志
ConsoleLog currentLog = build.getConsoleOutputText(0);
// 输出当前获取日志信息
System.out.println(currentLog.getConsoleLog());
// 检测是否还有更多日志,如果是则继续循环获取
while (currentLog.getHasMoreData()){
// 获取最新日志信息
ConsoleLog newLog = build.getConsoleOutputText(currentLog.getCurrentBufferSize());
// 输出最新日志
System.out.println(newLog.getConsoleLog());
currentLog = newLog;
// 睡眠1s
Thread.sleep(1000);
}
}catch (IOException | InterruptedException e) {
e.printStackTrace();
}
}
public static void main(String[] args) {
JobBuildApi jobBuildApi = new JobBuildApi();
jobBuildApi.getJobLastBuildDetail("");
}
}

View File

@ -1,4 +1,4 @@
package luckyclient.mail;
package luckyclient.tool.mail;
import java.io.StringWriter;
import java.util.HashMap;
@ -8,8 +8,8 @@ import java.util.Properties;
import freemarker.cache.ClassTemplateLoader;
import freemarker.template.Configuration;
import freemarker.template.Template;
import luckyclient.publicclass.LogUtil;
import luckyclient.publicclass.SysConfig;
import luckyclient.utils.LogUtil;
import luckyclient.utils.SysConfig;
/**
* 基于Freemarker模板技术的邮件模板服务

View File

@ -1,13 +1,13 @@
package luckyclient.mail;
package luckyclient.tool.mail;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
import luckyclient.publicclass.LogUtil;
import luckyclient.publicclass.SysConfig;
import luckyclient.publicclass.remoterinterface.HttpClientHelper;
import luckyclient.serverapi.entity.ProjectProtocolTemplate;
import luckyclient.remote.entity.ProjectProtocolTemplate;
import luckyclient.utils.LogUtil;
import luckyclient.utils.SysConfig;
import luckyclient.utils.httputils.HttpClientHelper;
/**
* =================================================================

View File

@ -1,11 +1,11 @@
package luckyclient.mail;
package luckyclient.tool.mail;
import java.util.Properties;
import luckyclient.dblog.LogOperation;
import luckyclient.publicclass.LogUtil;
import luckyclient.publicclass.SysConfig;
import luckyclient.serverapi.entity.TaskScheduling;
import luckyclient.remote.api.serverOperation;
import luckyclient.remote.entity.TaskScheduling;
import luckyclient.utils.LogUtil;
import luckyclient.utils.SysConfig;
/**
* =================================================================
@ -48,7 +48,7 @@ public class MailSendInitialization {
LogUtil.APP.info("当前任务不需要发送邮件通知!");
return;
}
String[] addresses = LogOperation.getEmailAddress(taskid);
String[] addresses = serverOperation.getEmailAddress(taskid);
Properties properties = SysConfig.getConfiguration();
if (addresses != null) {
LogUtil.APP.info("准备将测试结果发送邮件通知!请稍等...");

Some files were not shown because too many files have changed in this diff Show More