合并代码
This commit is contained in:
parent
b6836b8426
commit
089b9d775e
|
@ -1,4 +1,5 @@
|
|||
eclipse.preferences.version=1
|
||||
encoding//src/main/Resources/appium_config.properties=GBK
|
||||
encoding//src/main/Resources/sys_config.properties=GBK
|
||||
encoding//src/main/java=GBK
|
||||
encoding//src/test/java=GBK
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
#===============================系统配置=====================================
|
||||
#server.web.ip=localhost
|
||||
server.web.ip=192.168.12.112
|
||||
server.web.ip=localhost
|
||||
server.web.port=8080
|
||||
#===============================TestLink=====================================
|
||||
#TestLink URL地址
|
||||
|
@ -9,27 +8,24 @@ testlink.api.ip=localhost
|
|||
testlink.api.devkey=40ad3f1eb4cac155a5e0704e9c5280d2
|
||||
#================================数据库=============================================
|
||||
#数据库地址
|
||||
#mysql.db.ip=localhost
|
||||
mysql.db.ip=192.168.12.94
|
||||
mysql.db.ip=localhost
|
||||
#数据库端口
|
||||
mysql.db.port=3306
|
||||
#数据库名
|
||||
mysql.db.dbname=luckyframedb
|
||||
#数据库链接用户名
|
||||
#mysql.db.username=luckyframe
|
||||
mysql.db.username=root
|
||||
mysql.db.username=luckyframe
|
||||
#数据库链接密码
|
||||
#mysql.db.userpwd=luckyframe
|
||||
mysql.db.userpwd=Devops123
|
||||
mysql.db.userpwd=luckyframe
|
||||
#==================================邮件============================================
|
||||
#smtp邮件IP
|
||||
mail.smtp.ip=smtp.qq.com
|
||||
#smtp邮件端口
|
||||
#smtp邮件IP 例:smtp.qq.com
|
||||
mail.smtp.ip=XX.XX.XX.XX
|
||||
#smtp邮件端口 例:25
|
||||
mail.smtp.port=465
|
||||
#smtp邮件ssl连接开启
|
||||
#smtp邮件ssl连接开启 例:true false
|
||||
mail.smtp.ssl.enable=true
|
||||
#smtp邮件用户名
|
||||
mail.smtp.username=XX@qq.com
|
||||
mail.smtp.username=XX@XX.com
|
||||
#smtp邮件用户密码
|
||||
mail.smtp.password=xxxxxx
|
||||
#邮件模板路径
|
||||
|
|
|
@ -24,7 +24,6 @@ public class AppDriverAnalyticCase {
|
|||
//private static String splitFlag = "\\|";
|
||||
|
||||
/**
|
||||
* @param args
|
||||
*/
|
||||
public static Map<String,String> analyticCaseStep(ProjectCase projectcase,ProjectCasesteps step,String taskid,LogOperation caselog){
|
||||
String time = "0";
|
||||
|
@ -58,7 +57,7 @@ public class AppDriverAnalyticCase {
|
|||
String expectedResults = subComment(resultstr);
|
||||
|
||||
//´¦Àícheck×Ö¶Î
|
||||
if(expectedResults.indexOf("check(")>-1){
|
||||
if(expectedResults.startsWith("check(")){
|
||||
params.put("checkproperty", expectedResults.substring(expectedResults.indexOf("check(")+6, expectedResults.indexOf("=")));
|
||||
params.put("checkproperty_value", expectedResults.substring(expectedResults.indexOf("=")+1, expectedResults.lastIndexOf(")")));
|
||||
}
|
||||
|
|
|
@ -12,7 +12,6 @@ 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.exwebdriver.EncapsulateOperation;
|
||||
import luckyclient.dblog.LogOperation;
|
||||
import luckyclient.planapi.entity.ProjectCase;
|
||||
import luckyclient.planapi.entity.ProjectCasesteps;
|
||||
|
@ -244,7 +243,7 @@ public class AndroidCaseExecution extends TestCaseExecution{
|
|||
caselog.caseLogDetail(taskid, casenum, result,"info", String.valueOf(stepno),"");
|
||||
|
||||
if(result.indexOf("获取到的值是【")>-1&&result.indexOf("】")>-1){
|
||||
result = result.substring(7, result.length()-1);
|
||||
result = result.substring(result.indexOf("获取到的值是【")+7, result.length()-1);
|
||||
}
|
||||
return result;
|
||||
|
||||
|
|
|
@ -243,7 +243,7 @@ public class IosCaseExecution extends TestCaseExecution{
|
|||
caselog.caseLogDetail(taskid, casenum, result,"info", String.valueOf(stepno),"");
|
||||
|
||||
if(result.indexOf("获取到的值是【")>-1&&result.indexOf("】")>-1){
|
||||
result = result.substring(7, result.length()-1);
|
||||
result = result.substring(result.indexOf("获取到的值是【")+7, result.length()-1);
|
||||
}
|
||||
return result;
|
||||
|
||||
|
|
|
@ -4,36 +4,45 @@ import java.util.HashMap;
|
|||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import br.eti.kinoshita.testlinkjavaapi.util.TestLinkAPIException;
|
||||
import luckyclient.caserun.exinterface.analyticsteps.InterfaceAnalyticCase;
|
||||
import luckyclient.dblog.LogOperation;
|
||||
import luckyclient.planapi.api.GetServerAPI;
|
||||
import luckyclient.planapi.entity.ProjectCase;
|
||||
import luckyclient.planapi.entity.ProjectCasesteps;
|
||||
import luckyclient.planapi.entity.PublicCaseParams;
|
||||
import luckyclient.publicclass.ChangString;
|
||||
import luckyclient.publicclass.InvokeMethod;
|
||||
import luckyclient.publicclass.remoterinterface.HttpRequest;
|
||||
|
||||
/**
|
||||
* =================================================================
|
||||
* 这是一个受限制的自由软件!您不能在任何未经允许的前提下对程序代码进行修改和用于商业用途;也不允许对程序代码修改后以任何形式任何目的的再发布。
|
||||
* 为了尊重作者的劳动成果,LuckyFrame关键版权信息严禁篡改
|
||||
* 有任何疑问欢迎联系作者讨论。 QQ:1573584944 seagull1985
|
||||
* 为了尊重作者的劳动成果,LuckyFrame关键版权信息严禁篡改 有任何疑问欢迎联系作者讨论。 QQ:1573584944 seagull1985
|
||||
* =================================================================
|
||||
* @ClassName: TestCaseDebug
|
||||
* @Description: 针对自动化用例在编写过程中,对用例脚本进行调试
|
||||
* @author: seagull
|
||||
* @date 2014年8月24日 上午9:29:40
|
||||
*
|
||||
* @ClassName: TestCaseDebug
|
||||
* @Description: 针对自动化用例在编写过程中,对用例脚本进行调试 @author: seagull
|
||||
* @date 2018年3月1日
|
||||
*
|
||||
*/
|
||||
public class ApiTestCaseDebug{
|
||||
public class ApiTestCaseDebug {
|
||||
private static final String ASSIGNMENT_SIGN = "$=";
|
||||
private static final String FUZZY_MATCHING_SIGN = "%=";
|
||||
private static final String REGULAR_MATCHING_SIGN = "~=";
|
||||
|
||||
/**
|
||||
* 用于在本地做单条用例调试
|
||||
*
|
||||
* @param projectname
|
||||
* @param testCaseExternalId
|
||||
*/
|
||||
public static void oneCaseDebug(String projectname,String testCaseExternalId){
|
||||
Map<String,String> variable = new HashMap<String,String>(0);
|
||||
String packagename =null;
|
||||
public static void oneCaseDebug(String projectname, String testCaseExternalId) {
|
||||
Map<String, String> variable = new HashMap<String, String>(0);
|
||||
String packagename = null;
|
||||
String functionname = null;
|
||||
String expectedresults = null;
|
||||
Integer setresult = 1;
|
||||
|
@ -41,142 +50,215 @@ public class ApiTestCaseDebug{
|
|||
String testnote = "初始化测试结果";
|
||||
int k = 0;
|
||||
ProjectCase testcaseob = GetServerAPI.cgetCaseBysign(testCaseExternalId);
|
||||
List<PublicCaseParams> pcplist=GetServerAPI.cgetParamsByProjectid(String.valueOf(testcaseob.getProjectid()));
|
||||
List<PublicCaseParams> pcplist = GetServerAPI.cgetParamsByProjectid(String.valueOf(testcaseob.getProjectid()));
|
||||
// 把公共参数加入到MAP中
|
||||
for (PublicCaseParams pcp : pcplist) {
|
||||
variable.put(pcp.getParamsname(), pcp.getParamsvalue());
|
||||
}
|
||||
List<ProjectCasesteps> steps=GetServerAPI.getStepsbycaseid(testcaseob.getId());
|
||||
if(steps.size()==0){
|
||||
setresult=2;
|
||||
List<ProjectCasesteps> steps = GetServerAPI.getStepsbycaseid(testcaseob.getId());
|
||||
if (steps.size() == 0) {
|
||||
setresult = 2;
|
||||
luckyclient.publicclass.LogUtil.APP.error("用例中未找到步骤,请检查!");
|
||||
testnote="用例中未找到步骤,请检查!";
|
||||
testnote = "用例中未找到步骤,请检查!";
|
||||
}
|
||||
//进入循环,解析用例所有步骤
|
||||
for(int i=0;i<steps.size();i++){
|
||||
Map<String,String> casescript = InterfaceAnalyticCase.analyticCaseStep(testcaseob, steps.get(i),"888888",null);
|
||||
try {
|
||||
packagename = casescript.get("PackageName").toString();
|
||||
packagename = ChangString.changparams(packagename, variable,"包路径");
|
||||
functionname = casescript.get("FunctionName").toString();
|
||||
functionname = ChangString.changparams(functionname, variable,"方法名");
|
||||
} catch (Exception e) {
|
||||
k = 0;
|
||||
luckyclient.publicclass.LogUtil.APP.error("用例:" + testcaseob.getSign() + "解析包名或是方法名失败,请检查!");
|
||||
e.printStackTrace();
|
||||
break; // 某一步骤失败后,此条用例置为失败退出
|
||||
// 进入循环,解析用例所有步骤
|
||||
for (int i = 0; i < steps.size(); i++) {
|
||||
Map<String, String> casescript = InterfaceAnalyticCase.analyticCaseStep(testcaseob, steps.get(i), "888888",
|
||||
null);
|
||||
try {
|
||||
packagename = casescript.get("PackageName").toString();
|
||||
packagename = ChangString.changparams(packagename, variable, "包路径");
|
||||
functionname = casescript.get("FunctionName").toString();
|
||||
functionname = ChangString.changparams(functionname, variable, "方法名");
|
||||
} catch (Exception e) {
|
||||
k = 0;
|
||||
luckyclient.publicclass.LogUtil.APP.error("用例:" + testcaseob.getSign() + "解析包名或是方法名失败,请检查!");
|
||||
e.printStackTrace();
|
||||
break; // 某一步骤失败后,此条用例置为失败退出
|
||||
}
|
||||
// 用例名称解析出现异常或是单个步骤参数解析异常
|
||||
if (functionname.indexOf("解析异常") > -1 || k == 1) {
|
||||
k = 0;
|
||||
testnote = "用例第" + (i + 1) + "步解析出错啦!";
|
||||
break;
|
||||
}
|
||||
expectedresults = casescript.get("ExpectedResults").toString();
|
||||
expectedresults = ChangString.changparams(expectedresults, variable, "预期结果");
|
||||
// 判断方法是否带参数
|
||||
if (casescript.size() > 4) {
|
||||
// 获取传入参数,放入对象中,初始化参数对象个数
|
||||
getParameterValues = new Object[casescript.size() - 4];
|
||||
for (int j = 0; j < casescript.size() - 4; j++) {
|
||||
if (casescript.get("FunctionParams" + (j + 1)) == null) {
|
||||
k = 1;
|
||||
break;
|
||||
}
|
||||
String parameterValues = casescript.get("FunctionParams" + (j + 1));
|
||||
parameterValues = ChangString.changparams(parameterValues, variable, "用例参数");
|
||||
luckyclient.publicclass.LogUtil.APP.info("用例:" + testcaseob.getSign() + "解析包名:" + packagename
|
||||
+ " 方法名:" + functionname + " 第" + (j + 1) + "个参数:" + parameterValues);
|
||||
getParameterValues[j] = parameterValues;
|
||||
}
|
||||
//用例名称解析出现异常或是单个步骤参数解析异常
|
||||
if(functionname.indexOf("解析异常")>-1||k==1){
|
||||
k=0;
|
||||
testnote = "用例第"+(i+1)+"步解析出错啦!";
|
||||
break;
|
||||
}
|
||||
expectedresults = casescript.get("ExpectedResults").toString();
|
||||
expectedresults = ChangString.changparams(expectedresults, variable,"预期结果");
|
||||
//判断方法是否带参数
|
||||
if(casescript.size()>4){
|
||||
//获取传入参数,放入对象中,初始化参数对象个数
|
||||
getParameterValues = new Object[casescript.size()-4];
|
||||
for(int j=0;j<casescript.size()-4;j++){
|
||||
if(casescript.get("FunctionParams"+(j+1))==null){
|
||||
k = 1;
|
||||
break;
|
||||
}
|
||||
String parameterValues = casescript.get("FunctionParams" + (j + 1));
|
||||
parameterValues = ChangString.changparams(parameterValues, variable,"用例参数");
|
||||
luckyclient.publicclass.LogUtil.APP.info("用例:" + testcaseob.getSign() + "解析包名:" + packagename
|
||||
+ " 方法名:" + functionname + " 第" + (j + 1) + "个参数:" + parameterValues);
|
||||
getParameterValues[j] = parameterValues;
|
||||
}
|
||||
}else{
|
||||
getParameterValues = null;
|
||||
}
|
||||
//调用动态方法,执行测试用例
|
||||
try{
|
||||
luckyclient.publicclass.LogUtil.APP.info("开始调用方法:"+functionname+" .....");
|
||||
//把预期结果前两个字符判断是否是要把结果存入变量
|
||||
if(expectedresults.length()>2 && expectedresults.substring(0, 2).indexOf("$=")>-1){
|
||||
String expectedResultVariable = casescript.get("ExpectedResults").toString().substring(2);
|
||||
String temptestnote = InvokeMethod.callCase(packagename,functionname,getParameterValues,steps.get(i).getSteptype(),steps.get(i).getAction());
|
||||
variable.put(expectedResultVariable, temptestnote);
|
||||
//把预期结果与测试结果做模糊匹配
|
||||
}else if(expectedresults.length()>2 && expectedresults.substring(0, 2).indexOf("%=")>-1){
|
||||
testnote = InvokeMethod.callCase(packagename,functionname,getParameterValues,steps.get(i).getSteptype(),steps.get(i).getAction());
|
||||
if(testnote.indexOf(expectedresults.substring(2))>-1){
|
||||
setresult = 0;
|
||||
luckyclient.publicclass.LogUtil.APP.info("用例执行结果是:"+testnote+",与预期结果匹配成功!");
|
||||
}else{
|
||||
setresult = 1;
|
||||
luckyclient.publicclass.LogUtil.APP.error("用例第"+(i+1)+"步执行结果与预期结果匹配失败!");
|
||||
luckyclient.publicclass.LogUtil.APP.error("预期结果:"+expectedresults+" 测试结果:"+testnote);
|
||||
testnote = "用例第"+(i+1)+"步执行结果与预期结果匹配失败!";
|
||||
break; //某一步骤失败后,此条用例置为失败退出
|
||||
}
|
||||
}else{ //把预期结果与测试结果做精确匹配
|
||||
testnote = InvokeMethod.callCase(packagename,functionname,getParameterValues,steps.get(i).getSteptype(),steps.get(i).getAction());
|
||||
if(expectedresults.equals(testnote)){
|
||||
setresult = 0;
|
||||
luckyclient.publicclass.LogUtil.APP.info("用例执行结果是:"+testnote+",与预期结果匹配成功!");
|
||||
}else{
|
||||
setresult = 1;
|
||||
luckyclient.publicclass.LogUtil.APP.error("用例第"+(i+1)+"步执行结果与预期结果匹配失败!");
|
||||
luckyclient.publicclass.LogUtil.APP.error("预期结果:"+expectedresults+" 测试结果:"+testnote);
|
||||
testnote = "用例第"+(i+1)+"步执行结果与预期结果匹配失败!";
|
||||
break; //某一步骤失败后,此条用例置为失败退出
|
||||
}
|
||||
}
|
||||
//获取步骤间等待时间
|
||||
int waitsec = Integer.parseInt(casescript.get("StepWait").toString());
|
||||
if(waitsec!=0){
|
||||
Thread.sleep(waitsec*1000);
|
||||
}
|
||||
}catch(Exception e){
|
||||
setresult = 1;
|
||||
luckyclient.publicclass.LogUtil.APP.error("调用方法过程出错,方法名:"+functionname+" 请重新检查脚本方法名称以及参数!");
|
||||
luckyclient.publicclass.LogUtil.APP.error(e.getMessage(),e);
|
||||
testnote = "CallCase调用出错!";
|
||||
e.printStackTrace();
|
||||
break;
|
||||
}
|
||||
}
|
||||
variable.clear(); //清空传参MAP
|
||||
//如果调用方法过程中未出错,进入设置测试结果流程
|
||||
if(testnote.indexOf("CallCase调用出错!")<=-1&&testnote.indexOf("解析出错啦!")<=-1){
|
||||
luckyclient.publicclass.LogUtil.APP.info("用例 "+testCaseExternalId+"解析成功,并成功调用用例中方法,请继续查看执行结果!");
|
||||
}else{
|
||||
luckyclient.publicclass.LogUtil.APP.error("用例 "+testCaseExternalId+"解析或是调用步骤中的方法出错!");
|
||||
}
|
||||
if(0==setresult){
|
||||
luckyclient.publicclass.LogUtil.APP.info("用例 "+testCaseExternalId+"步骤全部执行成功!");
|
||||
}else{
|
||||
luckyclient.publicclass.LogUtil.APP.error("用例 "+testCaseExternalId+"在执行过程中失败,请检查日志!");
|
||||
}
|
||||
} else {
|
||||
getParameterValues = null;
|
||||
}
|
||||
// 调用动态方法,执行测试用例
|
||||
try {
|
||||
luckyclient.publicclass.LogUtil.APP.info("开始调用方法:" + functionname + " .....");
|
||||
testnote = InvokeMethod.callCase(packagename, functionname, getParameterValues,
|
||||
steps.get(i).getSteptype(), steps.get(i).getAction());
|
||||
|
||||
if (null != expectedresults && !expectedresults.isEmpty()) {
|
||||
luckyclient.publicclass.LogUtil.APP.info("expectedResults=【" + expectedresults + "】");
|
||||
// 赋值传参
|
||||
if (expectedresults.length() > ASSIGNMENT_SIGN.length()
|
||||
&& expectedresults.startsWith(ASSIGNMENT_SIGN)) {
|
||||
variable.put(expectedresults.substring(ASSIGNMENT_SIGN.length()), testnote);
|
||||
luckyclient.publicclass.LogUtil.APP
|
||||
.info("用例:" + testcaseob.getSign() + " 第" + (i + 1) + "步,将测试结果【" + testnote + "】赋值给变量【"
|
||||
+ expectedresults.substring(ASSIGNMENT_SIGN.length()) + "】");
|
||||
}
|
||||
// 模糊匹配
|
||||
else if (expectedresults.length() > FUZZY_MATCHING_SIGN.length()
|
||||
&& expectedresults.startsWith(FUZZY_MATCHING_SIGN)) {
|
||||
if (testnote.contains(expectedresults.substring(FUZZY_MATCHING_SIGN.length()))) {
|
||||
setresult = 0;
|
||||
luckyclient.publicclass.LogUtil.APP.info(
|
||||
"用例:" + testcaseob.getSign() + " 第" + (i + 1) + "步,模糊匹配预期结果成功!执行结果:" + testnote);
|
||||
} else {
|
||||
setresult = 1;
|
||||
luckyclient.publicclass.LogUtil.APP.error("用例:" + testcaseob.getSign() + " 第" + (i + 1)
|
||||
+ "步,模糊匹配预期结果失败!预期结果:" + expectedresults.substring(FUZZY_MATCHING_SIGN.length())
|
||||
+ ",测试结果:" + testnote);
|
||||
testnote = "用例第" + (i + 1) + "步,模糊匹配预期结果失败!";
|
||||
break; // 某一步骤失败后,此条用例置为失败退出
|
||||
}
|
||||
}
|
||||
// 正则匹配
|
||||
else if (expectedresults.length() > REGULAR_MATCHING_SIGN.length()
|
||||
&& expectedresults.startsWith(REGULAR_MATCHING_SIGN)) {
|
||||
Pattern pattern = Pattern.compile(expectedresults.substring(REGULAR_MATCHING_SIGN.length()));
|
||||
Matcher matcher = pattern.matcher(testnote);
|
||||
if (matcher.find()) {
|
||||
setresult = 0;
|
||||
luckyclient.publicclass.LogUtil.APP.info(
|
||||
"用例:" + testcaseob.getSign() + " 第" + (i + 1) + "步,正则匹配预期结果成功!执行结果:" + testnote);
|
||||
} else {
|
||||
setresult = 1;
|
||||
luckyclient.publicclass.LogUtil.APP.error("用例:" + testcaseob.getSign() + " 第" + (i + 1)
|
||||
+ "步,正则匹配预期结果失败!预期结果:" + expectedresults.substring(REGULAR_MATCHING_SIGN.length())
|
||||
+ ",测试结果:" + testnote);
|
||||
testnote = "用例第" + (i + 1) + "步,正则匹配预期结果失败!";
|
||||
break; // 某一步骤失败后,此条用例置为失败退出
|
||||
}
|
||||
}
|
||||
// 完全相等
|
||||
else {
|
||||
if (expectedresults.equals(testnote)) {
|
||||
setresult = 0;
|
||||
luckyclient.publicclass.LogUtil.APP.info(
|
||||
"用例:" + testcaseob.getSign() + " 第" + (i + 1) + "步,精确匹配预期结果成功!执行结果:" + testnote);
|
||||
} else {
|
||||
setresult = 1;
|
||||
luckyclient.publicclass.LogUtil.APP.error("用例:" + testcaseob.getSign() + " 第" + (i + 1)
|
||||
+ "步,精确匹配预期结果失败!预期结果:" + expectedresults + ",测试结果:" + testnote);
|
||||
testnote = "用例第" + (i + 1) + "步,精确匹配预期结果失败!";
|
||||
break; // 某一步骤失败后,此条用例置为失败退出
|
||||
}
|
||||
}
|
||||
}
|
||||
// 获取步骤间等待时间
|
||||
int waitsec = Integer.parseInt(casescript.get("StepWait").toString());
|
||||
if (waitsec != 0) {
|
||||
Thread.sleep(waitsec * 1000);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
setresult = 1;
|
||||
luckyclient.publicclass.LogUtil.APP.error("调用方法过程出错,方法名:" + functionname + " 请重新检查脚本方法名称以及参数!");
|
||||
luckyclient.publicclass.LogUtil.APP.error(e.getMessage(), e);
|
||||
testnote = "CallCase调用出错!";
|
||||
e.printStackTrace();
|
||||
break;
|
||||
}
|
||||
}
|
||||
variable.clear(); // 清空传参MAP
|
||||
// 如果调用方法过程中未出错,进入设置测试结果流程
|
||||
if (testnote.indexOf("CallCase调用出错!") <= -1 && testnote.indexOf("解析出错啦!") <= -1) {
|
||||
luckyclient.publicclass.LogUtil.APP.info("用例 " + testCaseExternalId + "解析成功,并成功调用用例中方法,请继续查看执行结果!");
|
||||
} else {
|
||||
luckyclient.publicclass.LogUtil.APP.error("用例 " + testCaseExternalId + "解析或是调用步骤中的方法出错!");
|
||||
}
|
||||
if (0 == setresult) {
|
||||
luckyclient.publicclass.LogUtil.APP.info("用例 " + testCaseExternalId + "步骤全部执行成功!");
|
||||
} else {
|
||||
luckyclient.publicclass.LogUtil.APP.error("用例 " + testCaseExternalId + "在执行过程中失败,请检查日志!");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 用于在本地做多条用例串行调试
|
||||
*
|
||||
* @param projectname
|
||||
* @param addtestcase
|
||||
*/
|
||||
public static void moreCaseDebug(String projectname,Map<String,Integer> addtestcase){
|
||||
public static void moreCaseDebug(String projectname, Map<String, Integer> addtestcase) {
|
||||
System.out.println(addtestcase.size());
|
||||
@SuppressWarnings("rawtypes")
|
||||
Iterator it=addtestcase.entrySet().iterator();
|
||||
while(it.hasNext()){
|
||||
@SuppressWarnings("rawtypes")
|
||||
Map.Entry entry=(Map.Entry)it.next();
|
||||
String testCaseExternalId = (String)entry.getKey();
|
||||
Integer version = (Integer)entry.getValue();
|
||||
try{
|
||||
luckyclient.publicclass.LogUtil.APP.info("开始调用方法,项目名:"+projectname+",用例编号:"+testCaseExternalId+",用例版本:"+version);
|
||||
oneCaseDebug(projectname,testCaseExternalId);
|
||||
}catch(Exception e){
|
||||
continue;
|
||||
}
|
||||
Iterator it = addtestcase.entrySet().iterator();
|
||||
while (it.hasNext()) {
|
||||
@SuppressWarnings("rawtypes")
|
||||
Map.Entry entry = (Map.Entry) it.next();
|
||||
String testCaseExternalId = (String) entry.getKey();
|
||||
Integer version = (Integer) entry.getValue();
|
||||
try {
|
||||
luckyclient.publicclass.LogUtil.APP
|
||||
.info("开始调用方法,项目名:" + projectname + ",用例编号:" + testCaseExternalId + ",用例版本:" + version);
|
||||
oneCaseDebug(projectname, testCaseExternalId);
|
||||
} catch (Exception e) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取指定任务名称以及用例号报错日志中的执行预期结果 casestatus说明 pass:0 fail:1 lock:2 unexcute:4
|
||||
*/
|
||||
public static String getLogDetailExpectresult(String taskname, String caseno, int casestatus) {
|
||||
int taskid = LogOperation.getTaskExcuteTaskid(taskname);
|
||||
return LogOperation.getLogDetailExpectResult(taskid, caseno, casestatus);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取指定任务名称以及用例号报错日志中的执行测试结果 casestatus说明 pass:0 fail:1 lock:2 unexcute:4
|
||||
*/
|
||||
public static String getLogDetailRunresult(String taskname, String caseno, int casestatus) {
|
||||
int taskid = LogOperation.getTaskExcuteTaskid(taskname);
|
||||
return LogOperation.getLogDetailTestResult(taskid, caseno, casestatus);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新系统中用例指定步骤的预期结果
|
||||
*/
|
||||
public static String setExpectedResults(String testCaseSign, int steps, String expectedResults) {
|
||||
String results = "设置结果失败";
|
||||
String params = "";
|
||||
try {
|
||||
expectedResults = expectedResults.replace("%", "BBFFHH");
|
||||
expectedResults = expectedResults.replace("=", "DHDHDH");
|
||||
expectedResults = expectedResults.replace("&", "ANDAND");
|
||||
params = "caseno=" + testCaseSign;
|
||||
params += "&stepnum=" + steps;
|
||||
params += "&expectedresults=" + expectedResults;
|
||||
results = HttpRequest.sendPost("/projectCasesteps/cUpdateStepExpectedResults.do", params);
|
||||
} catch (TestLinkAPIException te) {
|
||||
te.printStackTrace(System.err);
|
||||
results = te.getMessage().toString();
|
||||
return results;
|
||||
}
|
||||
return results;
|
||||
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ import luckyclient.publicclass.InvokeMethod;
|
|||
* @ClassName: ThreadForExecuteCase
|
||||
* @Description: 线程池方式执行用例
|
||||
* @author: seagull
|
||||
* @date 2017年7月13日 上午9:29:40
|
||||
* @date 2018年3月1日
|
||||
*/
|
||||
public class ThreadForExecuteCase extends Thread {
|
||||
private static final String ASSIGNMENT_SIGN = "$=";
|
||||
|
|
|
@ -24,13 +24,13 @@ import luckyclient.publicclass.InvokeMethod;
|
|||
* @ClassName: WebTestCaseDebug
|
||||
* @Description: 提供Web端调试接口
|
||||
* @author: seagull
|
||||
* @date 2017年9月2日 上午9:29:40
|
||||
* @date 2018年3月1日
|
||||
*/
|
||||
public class WebTestCaseDebug {
|
||||
private static final String ASSIGNMENT_SIGN = "$=";
|
||||
private static final String FUZZY_MATCHING_SIGN = "%=";
|
||||
private static final String REGULAR_MATCHING_SIGN = "~=";
|
||||
|
||||
private static final String ASSIGNMENT_SIGN = "$=";
|
||||
private static final String FUZZY_MATCHING_SIGN = "%=";
|
||||
private static final String REGULAR_MATCHING_SIGN = "~=";
|
||||
|
||||
/**
|
||||
* @param executor
|
||||
* @param sign 用于在WEB页面上调试用例时提供的接口
|
||||
|
|
|
@ -305,7 +305,7 @@ public class WebCaseExecution extends TestCaseExecution {
|
|||
else caselog.caseLogDetail(taskid, casenum, result, "info", String.valueOf(stepno), "");
|
||||
|
||||
if (result.contains("获取到的值是【") && result.contains("】")) {
|
||||
result = result.substring(7, result.length() - 1);
|
||||
result = result.substring(result.indexOf("获取到的值是【") + "获取到的值是【".length(), result.length() - 1);
|
||||
}
|
||||
return result;
|
||||
|
||||
|
|
|
@ -24,7 +24,6 @@ public class WebDriverAnalyticCase {
|
|||
//private static String splitFlag = "\\|";
|
||||
|
||||
/**
|
||||
* @param args
|
||||
*/
|
||||
public static Map<String,String> analyticCaseStep(ProjectCase projectcase,ProjectCasesteps step,String taskid,LogOperation caselog){
|
||||
String time = "0";
|
||||
|
@ -58,7 +57,7 @@ public class WebDriverAnalyticCase {
|
|||
String expectedResults = subComment(resultstr);
|
||||
|
||||
//´¦Àícheck×Ö¶Î
|
||||
if(expectedResults.indexOf("check(")>-1){
|
||||
if(expectedResults.startsWith("check(")){
|
||||
params.put("checkproperty", expectedResults.substring(expectedResults.indexOf("check(")+6, expectedResults.indexOf("=")));
|
||||
params.put("checkproperty_value", expectedResults.substring(expectedResults.indexOf("=")+1, expectedResults.lastIndexOf(")")));
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ import luckyclient.dblog.LogOperation;
|
|||
* =================================================================
|
||||
*
|
||||
* @author£º seagull
|
||||
* @date 2017年12月1日 上午9:29:40
|
||||
* @date 2018年3月1日
|
||||
*/
|
||||
public class MailSendInitialization {
|
||||
|
||||
|
@ -38,6 +38,7 @@ public class MailSendInitialization {
|
|||
//ÄÚÈÝ
|
||||
mailInfo.setContent(content);
|
||||
mailInfo.setToAddresses(addresses);
|
||||
//sms.sendHtmlMail(mailInfo);
|
||||
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
for (String address : addresses) {
|
||||
|
|
|
@ -88,11 +88,13 @@ public class InvokeMethod {
|
|||
//´¦ÀíÍ·Óò
|
||||
Map<String, String> headmsg = new HashMap<>(0);
|
||||
if (null != ppt.getHeadmsg() && !ppt.getHeadmsg().equals("") && ppt.getHeadmsg().indexOf("=") > 0) {
|
||||
String[] temp = ppt.getHeadmsg().split(";", -1);
|
||||
String headmsgtemp = ppt.getHeadmsg().replaceAll("\\\\;", "!!!fhzh");
|
||||
String[] temp = headmsgtemp.split(";", -1);
|
||||
for (int i = 0; i < temp.length; i++) {
|
||||
if (null != temp[i] && !temp[i].equals("") && temp[i].indexOf("=") > 0) {
|
||||
String key = temp[i].substring(0, temp[i].indexOf("="));
|
||||
String value = temp[i].substring(temp[i].indexOf("=") + 1);
|
||||
value = value.replaceAll("!!!fhzh",";");
|
||||
headmsg.put(key, value);
|
||||
}
|
||||
}
|
||||
|
@ -218,11 +220,13 @@ public class InvokeMethod {
|
|||
//´¦ÀíÍ·Óò
|
||||
Map<String, String> headmsg = new HashMap<String, String>(0);
|
||||
if (null != ppt.getHeadmsg() && !ppt.getHeadmsg().equals("") && ppt.getHeadmsg().indexOf("=") > 0) {
|
||||
String[] temp = ppt.getHeadmsg().split(";", -1);
|
||||
String headmsgtemp = ppt.getHeadmsg().replaceAll("\\\\;", "!!!fhzh");
|
||||
String[] temp = headmsgtemp.split(";", -1);
|
||||
for (int i = 0; i < temp.length; i++) {
|
||||
if (null != temp[i] && !temp[i].equals("") && temp[i].indexOf("=") > 0) {
|
||||
String key = temp[i].substring(0, temp[i].indexOf("="));
|
||||
String value = temp[i].substring(temp[i].indexOf("=") + 1);
|
||||
value = value.replaceAll("!!!fhzh",";");
|
||||
headmsg.put(key, value);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,7 +36,6 @@ public class TestCaseApi extends TestLinkBaseApi {
|
|||
/**
|
||||
* 设置用例执行结果
|
||||
* @param testCaseExternalId
|
||||
* @param testSuiteName
|
||||
* @param note
|
||||
*/
|
||||
|
||||
|
@ -140,7 +139,7 @@ public class TestCaseApi extends TestLinkBaseApi {
|
|||
|
||||
/**
|
||||
* 获取单个用例的步骤
|
||||
* @param testCaseExternalID
|
||||
* @param testCaseExternalId
|
||||
* @param version
|
||||
*/
|
||||
public static List<TestCaseStep> getTestCaseSteps(String testCaseExternalId,Integer version){
|
||||
|
@ -229,37 +228,6 @@ public class TestCaseApi extends TestLinkBaseApi {
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新系统中用例指定步骤的预期结果
|
||||
*/
|
||||
public static String setExpectedResults(String testCaseSign, int steps, String expectedResults) {
|
||||
String results = "设置结果失败";
|
||||
String params="";
|
||||
try {
|
||||
expectedResults = expectedResults.replace("%", "BBFFHH");
|
||||
expectedResults = expectedResults.replace("=", "DHDHDH");
|
||||
expectedResults = expectedResults.replace("&", "ANDAND");
|
||||
params="caseno="+testCaseSign;
|
||||
params+="&stepnum="+steps;
|
||||
params+="&expectedresults="+expectedResults;
|
||||
results=HttpRequest.sendPost("/projectCasesteps/cUpdateStepExpectedResults.do", params);
|
||||
} catch (TestLinkAPIException te) {
|
||||
te.printStackTrace(System.err);
|
||||
results = te.getMessage().toString();
|
||||
return results;
|
||||
}
|
||||
return results;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取指定任务名称以及用例号报错日志中的执行测试结果
|
||||
* casestatus说明 pass:0 fail:1 lock:2 unexcute:4
|
||||
*/
|
||||
public static String getLogDetailRunresult(String taskname,String caseno,int casestatus){
|
||||
int taskid = LogOperation.getTaskExcuteTaskid(taskname);
|
||||
return LogOperation.getLogDetailTestResult(taskid, caseno,casestatus);
|
||||
}
|
||||
|
||||
/**
|
||||
* 拷贝测试用例到系统自带用例库中 接口自动化用例
|
||||
|
@ -428,14 +396,6 @@ public class TestCaseApi extends TestLinkBaseApi {
|
|||
System.out.println(testplan+"中的用例已经全部生成完毕!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取指定任务名称以及用例号报错日志中的执行预期结果
|
||||
* casestatus说明 pass:0 fail:1 lock:2 unexcute:4
|
||||
*/
|
||||
public static String getLogDetailExpectresult(String taskname,String caseno,int casestatus){
|
||||
int taskid = LogOperation.getTaskExcuteTaskid(taskname);
|
||||
return LogOperation.getLogDetailExpectResult(taskid, caseno,casestatus);
|
||||
}
|
||||
|
||||
public static void main(String[] args){
|
||||
|
||||
|
|
Loading…
Reference in New Issue