Commit 6a4df1ca authored by 钱雯君's avatar 钱雯君

Merge branch 'develop' into qwj_181029

parents fe55dddf efb8a4b4
......@@ -21,9 +21,11 @@ import static io.restassured.RestAssured.given;
* Created by hanzhanli on 2017/11/9.
*/
public class Postman {
static String dingdingUrl="https://shark.dui88.com/test/integration";
static String testPlatformUrl = "http://101.37.27.82:8080/insert";
static String miriaUrl = "http://miria-aliyun.duibatest.com.cn/autoTest/finish";
final static String dingdingUrl="https://shark.dui88.com/test/integration";
final static String testPlatformUrl = "http://101.37.27.82:8080/insert";
final static String miriaUrl = "http://miria-aliyun.duibatest.com.cn/autoTest/finish";
final static String miriaUrlTesting = "http://miria-aliyun.duibatest.com.cn/autoTest/testing";
//dingdingUrl="http://www.json.cn/";
private static Logger logger = LogManager.getLogger(Postman.class);
public static void send2Dingding(Map result){
......@@ -58,6 +60,13 @@ public class Postman {
System.out.println("miriaUrl:"+miriaUrl);
System.out.println("miria响应结果:"+response.asString());
}
public static void sendTesting(Map result){
Response response=given().params(result).get(miriaUrlTesting);
System.out.println("jobName:"+result.get("jobName"));
System.out.println("miriaUrl:"+miriaUrlTesting);
System.out.println("miria响应结果:"+response.asString());
}
public static Boolean getName(){
Calendar c = Calendar.getInstance();
Date date = new Date();
......
package base;
import java.io.UnsupportedEncodingException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.core.env.Environment;
import org.testng.*;
/**
......@@ -12,6 +18,12 @@ import org.testng.*;
public class TestListener implements ITestListener {
public DuibaLog logger = DuibaLog.getLogger();
String run = System.getProperty("run");
ApplicationContext context = new AnnotationConfigApplicationContext(Config.class);
Environment env=context.getBean(Environment.class);
public TestListener() throws UnsupportedEncodingException {
}
public void onFinish(ITestContext context) {
Iterator<ITestResult> listOfFailedTests = context.getFailedTests().getAllResults().iterator();
while (listOfFailedTests.hasNext()) {
......@@ -65,16 +77,26 @@ public class TestListener implements ITestListener {
// TODO Auto-generated method stub
logger.info("onStart~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
//服务检查
boolean ServiceDoctor=Boolean.parseBoolean(System.getProperty("ServiceDoctor"));
if(ServiceDoctor){
try{
serviceDoctor();
}catch (SkipException e){
SFExpress.skip = context.getAllTestMethods().length;
// throw e;
}
}
//运行开始,触发互斥功能,用于定时任务
Map<String,String> mapJob = new HashMap<>();
try {
mapJob.put("jobName",getJob());
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
Postman.sendTesting(mapJob);
}
public void serviceDoctor(){
logger.info("duiba-server开始检测");
......@@ -107,4 +129,13 @@ public class TestListener implements ITestListener {
res = simpleDateFormat.format(date);
return res;
}
public String getJob() throws UnsupportedEncodingException {
return getByRun(run,"job");
}
public String getByRun(String run,String type) throws UnsupportedEncodingException {
run = run.substring(run.indexOf("_")+1, run.indexOf("."));
run =this.env.getProperty(run+"."+type);
return new String(run.getBytes("ISO-8859-1"), "UTF-8");//ISO-8859-1
}
}
\ No newline at end of file
......@@ -184,6 +184,10 @@ public class 抽奖异常测试_DuibaTest extends DuibaTestBase {
Assert.assertTrue(response.jsonPath().getString("lottery.link").contains("/activity/takePrizeNew?recordId="));
Assert.assertEquals(response.jsonPath().getString("lottery.id"), "11628", "校验id失败");
logger.info("未登录状态下有免费次数抽奖校验:title,link,id成功");
response = newActivityService.login(map,"2239.3.3.0");
Assert.assertEquals(response.jsonPath().getString("success"),"true","登录跳转接口访问失败!");
}
}
......
......@@ -100,6 +100,24 @@ public class NewActivityService {
return response;
}
public Response login(Map cookies, String dpm) throws Exception {
Map<String,String> map = new HashMap<>();
map.put("dpm",dpm);
logger.info("请求/hdtool/login接口");
logger.info("url:"+url+"/hdtool/login");
Response response = given().cookies(cookies).params(map).post(url+"/hdtool/login");
try{
Assert.assertEquals(String.valueOf(response.getStatusCode()),"200");
logger.info("/hdtool/login接口成功,返回信息:"+response.asString());
}catch(Exception e){
throw new Exception("/hdtool/login接口失败,返回信息:"+response.asString());
}catch(Error er){
throw new Exception("/hdtool/login接口失败,返回信息:"+response.asString());
}
return response;
}
public Response doJoin2( String activityId,String token) throws Exception{
Map<String,String> map = new HashMap<>();
map.put("activityId",activityId);
......
......@@ -32,46 +32,46 @@ db.maxtotal = 6
pluginTest.project=插件
pluginTest.names=zhaoran,qianwenjun
pluginTest.group=插件-接口自动化
pluginTest.resultUrl=http://tst.deploy.dui88.com/view/duibaTest/job/duibaPlugin_interface/HTML_Report/suite1_test1_results.html
pluginTest.resultUrl=http://tst-idc.deploy.dui88.com/view/duibaTest/job/duibaPlugin_interface/HTML_20Report/suite1_test1_results.html
pluginTest.job=duibaPlugin_interface
signTest.project=签到
signTest.names=zhousongbo
signTest.group=签到-接口自动化
signTest.resultUrl=http://tst.deploy.dui88.com/view/duibaTest/job/duibaSign_interface/HTML_Report/suite1_test1_results.html
signTest.resultUrl=http://tst-idc.deploy.dui88.com/view/duibaTest/job/duibaSign_interface/HTML_20Report/suite1_test1_results.html
signTest.job=duibaSign_interface
FloorTest.project=楼层
FloorTest.names=zhaoran,qianwenjun
FloorTest.group=楼层-接口自动化
FloorTest.resultUrl=http://tst.deploy.dui88.com/view/duibaTest/job/duibaFloor_interface/HTML_Report/suite1_test1_results.html
FloorTest.resultUrl=http://tst-idc.deploy.dui88.com/view/duibaTest/job/duibaFloor_interface/HTML_20Report/suite1_test1_results.html
FloorTest.job=duibaFloor_interface
DuibaTest.project=活动工具
DuibaTest.names=zhaoran,qianwenjun
DuibaTest.group=活动工具-接口自动化
DuibaTest.resultUrl=http://tst.deploy.dui88.com/view/duibaTest/job/duiba_interface/HTML_Report/suite1_test1_results.html
DuibaTest.resultUrl=http://tst-idc.deploy.dui88.com/view/duibaTest/job/duiba_interface/HTML_20Report/suite1_test1_results.html
DuibaTest.job=duiba_interface
AccessTest.project=综合业务(单品抽奖/秒杀/游戏)
AccessTest.names=zhaoran,qianwenjun
AccessTest.group=综合业务-接口自动化
AccessTest.resultUrl=http://tst.deploy.dui88.com/view/duibaTest/job/duibaAccess_interface/HTML_Report/suite1_test1_results.html
AccessTest.resultUrl=http://tst-idc.deploy.dui88.com/view/duibaTest/job/duibaAccess_interface/HTML_20Report/suite1_test1_results.html
AccessTest.job=duibaAccess_interface
JenkinsTest.project=综合业务(单品抽奖/秒杀/游戏)
JenkinsTest.names=zhaoran,qianwenjun
JenkinsTest.group=综合业务-接口自动化
JenkinsTest.resultUrl=http://tst.deploy.dui88.com/view/duibaTest/job/duibaAccess_interface/HTML_Report/suite1_test1_results.html
JenkinsTest.resultUrl=http://tst-idc.deploy.dui88.com/view/duibaTest/job/duibaAccess_interface/HTML_20Report/suite1_test1_results.html
ExchangeTest.project=普兑业务
ExchangeTest.names=panyuli
ExchangeTest.group=普兑业务-接口自动化
ExchangeTest.resultUrl=http://tst.deploy.dui88.com/view/duibaTest/job/duibaExchange_interface/HTML_Report/suite1_test1_results.html
ExchangeTest.resultUrl=http://tst-idc.deploy.dui88.com/view/duibaTest/job/duibaExchange_interface/HTML_20Report/suite1_test1_results.html
ExchangeTest.job=duibaExchange_interface
SeckillTest.project=秒杀业务
SeckillTest.names=qianwenjun
SeckillTest.group=秒杀业务-接口自动化
SeckillTest.resultUrl=http://tst.deploy.dui88.com/view/duibaTest/job/Seckill_interface/HTML_Report/suite1_test1_results.html
SeckillTest.resultUrl=http://tst-idc.deploy.dui88.com/view/duibaTest/job/Seckill_interface/HTML_20Report/suite1_test1_results.html
SeckillTest.job=Seckill_interface
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment