Commit 4ffd0141 authored by 赵然's avatar 赵然

zr

parent cd0348a4
......@@ -25,7 +25,7 @@ import java.util.Map;
/**
* Created by zhaoran on 2018/07/10
*/
public class 中奖发奖限制_DuibaTest extends DuibaTestBase {
public class 中奖发奖限制 extends DuibaTestBase {
@Autowired
NewActivityService newActivityService;
......@@ -57,10 +57,10 @@ public class 中奖发奖限制_DuibaTest extends DuibaTestBase {
public void after() throws Exception{
//数据库删除
try {
jdbc.update("delete from hdtool_conf.duiba_hdtool where title=?", "【自动化】多奖项中奖限制"+data);
jdbc.update("delete from credits_dev.operating_activity where title=?","【自动化】多奖项中奖限制"+data);
jdbc.update("delete from hdtool_conf.duiba_hdtool where title=?", "【自动化】奖品发放限制"+data2);
jdbc.update("delete from credits_dev.operating_activity where title=?","【自动化】奖品发放限制"+data2);
jdbc.update("delete from hdtool_conf.duiba_hdtool where title=?", "【自动化】多奖项中奖限制_DuibaTest"+data);
jdbc.update("delete from credits_dev.operating_activity where title=?","【自动化】多奖项中奖限制_DuibaTest"+data);
jdbc.update("delete from hdtool_conf.duiba_hdtool where title=?", "【自动化】奖品发放限制_DuibaTest"+data2);
jdbc.update("delete from credits_dev.operating_activity where title=?","【自动化】奖品发放限制_DuibaTest"+data2);
} catch (Exception e) {
System.out.println(e);
}
......@@ -147,7 +147,7 @@ public class 中奖发奖限制_DuibaTest extends DuibaTestBase {
@Test
public void 多奖项中奖限制测试() throws Exception {
data = PublicMethod.data();
String title = "【自动化】多奖项中奖限制"+data;
String title = "【自动化】多奖项中奖限制_DuibaTest"+data;
this.创建并上架活动(title);
......@@ -182,7 +182,7 @@ public class 中奖发奖限制_DuibaTest extends DuibaTestBase {
@Test
public void 奖品发放限制测试() throws Exception {
data2 = PublicMethod.data();
String title = "【自动化】奖品发放限制"+data2;
String title = "【自动化】奖品发放限制_DuibaTest"+data2;
this.创建并上架活动2(title);
//获取管理员后台活动信息
......
......@@ -16,7 +16,7 @@ import org.testng.annotations.Test;
/**
* Created by zhaoran on 2018/07/10
*/
public class 多奖项中奖限制 extends DuibaTestBase {
public class 多奖项中奖限制_DuibaTest extends DuibaTestBase {
@Autowired
NewActivityService newActivityService;
......@@ -33,6 +33,7 @@ public class 多奖项中奖限制 extends DuibaTestBase {
public void after() throws Exception{
//数据库删除
try {
//case:[多奖项中奖限制测试_永久]数据处理:删除永久中奖记录
jdbc.update("UPDATE ckvtable.tb_kvtable_0687 SET int_value = '0' WHERE vkey = 'activity-centerwinOptionNum_100025007_35869_hdtool25885'");
} catch (Exception e) {
System.out.println(e);
......@@ -41,7 +42,7 @@ public class 多奖项中奖限制 extends DuibaTestBase {
@Test
public void 多奖项中奖限制测试() throws Exception {
public void 多奖项中奖限制测试_永久() throws Exception {
//第一次抽奖
Response response = this.新活动工具接口传参("35869","adsdas","iOS");
......
......@@ -12,11 +12,17 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.testng.Assert;
import org.testng.annotations.AfterClass;
import org.testng.annotations.Test;
import utils.HbaseService;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.Locale;
/**
* Created by zhaoran on 2018/07/10
*/
public class 奖品发放限制 extends DuibaTestBase {
public class 奖品发放限制_DuibaTest extends DuibaTestBase {
@Autowired
NewActivityService newActivityService;
......@@ -28,14 +34,20 @@ public class 奖品发放限制 extends DuibaTestBase {
CustomHdToolCtrlService customHdToolCtrlService;
@Autowired
ActivityService activityService;
@Autowired
HbaseService hbaseService;
private static DuibaLog logger = DuibaLog.getLogger();
@AfterClass
public void after() throws Exception{
//数据库删除
try {
//case:[奖品发放限制测试_永久]数据处理:删除永久中奖记录
jdbc.update("UPDATE ckvtable.tb_kvtable_0687 SET int_value = '0' WHERE vkey = 'activity-centerwinOptionNum_100025007_35868_hdtool25884'");
//case:[奖品发放限制测试_每日]数据处理:删除每日中奖记录
String y_m_d = getTime2(0);
String key = "k05_PRIZE_K001_"+y_m_d+"_hdtool25933_100025007";
hbaseService.deleteHBASEKey2(key);
} catch (Exception e) {
System.out.println(e);
}
......@@ -44,7 +56,7 @@ public class 奖品发放限制 extends DuibaTestBase {
@Test
public void 奖品发放限制测试() throws Exception {
public void 奖品发放限制测试_永久() throws Exception {
//第一次抽奖
Response response = this.新活动工具接口传参("35868","adsdas","iOS");
......@@ -59,6 +71,21 @@ public class 奖品发放限制 extends DuibaTestBase {
}
@Test
public void 奖品发放限制测试_每日() throws Exception {
//第一次抽奖
Response response = this.新活动工具接口传参("35920","adsdas","iOS");
Assert.assertEquals( String.valueOf(response.jsonPath().getString("lottery.type")),"phonebill","第一次抽奖出奖类型失败");
Assert.assertEquals( String.valueOf(response.jsonPath().getString("lottery.title")),"话费","第一次抽奖出奖title失败");
//第二次抽奖
response = this.新活动工具接口传参("35920","adsdas","iOS");
Assert.assertEquals( String.valueOf(response.jsonPath().getString("lottery.type")),"lucky","第一次抽奖出奖类型失败");
Assert.assertEquals( String.valueOf(response.jsonPath().getString("lottery.useBtnText")),"马上使用","第一次抽奖出奖文案失败");
}
public Response 新活动工具接口传参(String activityId,String token,String device) throws Exception {
Response response = newActivityService.doJoin2(activityId,token);
......@@ -79,4 +106,16 @@ public class 奖品发放限制 extends DuibaTestBase {
return response;
}
public String getTime2(int amount){
SimpleDateFormat dateFormat = new SimpleDateFormat("YYYY-MM-dd", Locale.ENGLISH);
Date date = new Date();
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
calendar.add(Calendar.DAY_OF_MONTH, amount);
date = calendar.getTime();
// System.out.println(dateFormat.format(date));
String time = dateFormat.format(date);
// System.out.println(time);
return time;
}
}
\ No newline at end of file
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