Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
test-platform
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
马博
test-platform
Commits
f4c745a9
Commit
f4c745a9
authored
Nov 29, 2018
by
吕雯燕
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lv
parent
4f379341
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
143 additions
and
2 deletions
+143
-2
新建活动测试_DuibaTest.java
src/test/java/http/cases/DeveloperTest/新建活动测试_DuibaTest.java
+81
-2
DeveloperService.java
src/test/java/http/service/hd/DeveloperService.java
+62
-0
No files found.
src/test/java/http/cases/DeveloperTest/新建活动测试_DuibaTest.java
View file @
f4c745a9
...
@@ -61,11 +61,21 @@ public class 新建活动测试_DuibaTest extends DuibaTestBase{
...
@@ -61,11 +61,21 @@ public class 新建活动测试_DuibaTest extends DuibaTestBase{
}
else
}
else
if
(
method
.
getName
().
equals
(
"新建自有手动开奖活动"
)){
if
(
method
.
getName
().
equals
(
"新建自有手动开奖活动"
)){
result
=
new
Object
[][]{
result
=
new
Object
[][]{
new
Object
[]{
1
,
"10"
,
"everyday"
,
"5"
,
"everyday"
,
"//yun.duiba.com.cn/upload/mhty76ri9b.png"
,
"新建自有手动开奖--每日次数"
},
new
Object
[]{
1
,
"10"
,
"everyday"
,
"5"
,
"everyday"
,
"//yun.duiba.com.cn/upload/mhty76ri9b.png"
,
"新建自有手动开奖--每日次数"
},
//case1
new
Object
[]{
2
,
"20"
,
"forever"
,
"10"
,
"forever"
,
"//yun.dui88.com/images/201811/j90o37xiof.jpg"
,
"新建自有手动开奖--永久次数"
},
//case2
};
};
}
else
if
(
method
.
getName
().
equals
(
"新建自有答题活动"
)){
result
=
new
Object
[][]{
new
Object
[]{
1
,
"[{\"type\":\"coupon\",\"title\":\"优惠券\",\"img\":\"//yun.duiba.com.cn/upload/bust51462438317113.png\",\"valid\":true,\"probability\":\"1\",\"show\":true,\"arealimit\":false,\"pronumber\":\"1\",\"alipay\":\"\",\"description\":\"\",\"appItemId\":172178,\"name\":\"【勿动】自有优惠券审核通过测试\",\"remaind\":\"100\"},{\"type\":\"object\",\"title\":\"实物\",\"img\":\"//yun.duiba.com.cn/upload/1uF0l1462438316968.png\",\"valid\":true,\"probability\":\"2\",\"show\":true,\"arealimit\":false,\"pronumber\":\"2\",\"alipay\":\"\",\"description\":\"\",\"appItemId\":175491,\"name\":\"【自动化】自有实物19:51:09\",\"remaind\":\"90\"},{\"type\":\"virtual\",\"title\":\"虚拟商品\",\"img\":\"//yun.duiba.com.cn/developer/img/activityTool/slotMachine/virtual.png\",\"valid\":true,\"probability\":\"3\",\"show\":true,\"arealimit\":false,\"pronumber\":\"3\",\"alipay\":\"\",\"description\":\"\",\"appItemId\":178060,\"value\":\"test\",\"remaind\":\"80\"},{\"type\":\"phonebill\",\"title\":\"话费\",\"img\":\"//yun.duiba.com.cn/upload/AROxS1462438316966.png\",\"valid\":true,\"probability\":\"4\",\"show\":true,\"arealimit\":false,\"pronumber\":\"4\",\"alipay\":\"\",\"description\":\"\",\"value\":\"10\",\"remaind\":\"70\"},{\"type\":\"alipay\",\"title\":\"支付宝\",\"img\":\"//yun.duiba.com.cn/upload/KkZMp1462438317113.png\",\"valid\":true,\"probability\":\"5\",\"show\":true,\"arealimit\":false,\"pronumber\":\"5\",\"alipay\":\"\",\"description\":\"\",\"value\":\"1\",\"remaind\":\"60\"},{\"type\":\"qb\",\"title\":\"Q币\",\"img\":\"//yun.duiba.com.cn/upload/mF3wO1462438317114.png\",\"valid\":true,\"probability\":\"6\",\"show\":true,\"arealimit\":false,\"pronumber\":\"6\",\"alipay\":\"\",\"description\":\"\",\"value\":\"10\",\"remaind\":\"50\"},{\"type\":\"lucky\",\"title\":\"福袋\",\"img\":\"//yun.duiba.com.cn/webapp/img/luckynewn.png\",\"valid\":true,\"probability\":\"0\",\"show\":false,\"arealimit\":false,\"pronumber\":\"0\",\"alipay\":\"\",\"description\":\"\"}]"
,
"[{\"index\":null,\"type\":\"text\",\"rightAnswer\":1,\"name\":\"文字题一\",\"option1\":\"文字题一A\",\"option2\":\"文字题一B\",\"option3\":\"文字题一C\",\"option4\":\"文字题一D\"},{\"index\":null,\"type\":\"text\",\"rightAnswer\":\"2\",\"name\":\"文字题二\",\"option1\":\"文字题二A\",\"option2\":\"文字题二B\",\"option3\":\"文字题二C\",\"option4\":\"文字题二D\"},{\"index\":null,\"type\":\"text\",\"rightAnswer\":\"3\",\"name\":\"文字题三\",\"option1\":\"文字题三A\",\"option2\":\"文字题三B\",\"option3\":\"文字题三C\",\"option4\":\"文字题三D\"},{\"index\":null,\"type\":\"text\",\"rightAnswer\":\"4\",\"name\":\"文字题四\",\"option1\":\"文字题四A\",\"option2\":\"文字题四B\",\"option3\":\"文字题四C\",\"option4\":\"文字题四D\"},{\"index\":null,\"type\":\"text\",\"rightAnswer\":1,\"name\":\"文字题五\",\"option1\":\"文字题五A\",\"option2\":\"文字题五B\",\"option3\":\"文字题五C\",\"option4\":\"文字题五D\"},{\"index\":null,\"type\":\"text\",\"rightAnswer\":\"2\",\"name\":\"文字题六\",\"option1\":\"文字题六A\",\"option2\":\"文字题六B\",\"option3\":\"文字题六C\",\"option4\":\"文字题六D\"}]"
,
"10"
,
"everyday"
,
"5"
,
"everyday"
,
"6"
,
"新建自有答题活动-文字题"
},
//case 1
new
Object
[]{
2
,
"[{\"type\":\"coupon\",\"title\":\"优惠券1\",\"img\":\"//yun.duiba.com.cn/upload/bust51462438317113.png\",\"valid\":true,\"probability\":\"1\",\"show\":true,\"arealimit\":false,\"pronumber\":\"1\",\"alipay\":\"\",\"description\":\"\",\"appItemId\":159857,\"name\":\"【自动化勿动】自有优惠券\",\"remaind\":\"100\"},{\"type\":\"coupon\",\"title\":\"优惠券2\",\"img\":\"//yun.duiba.com.cn/upload/bust51462438317113.png\",\"valid\":true,\"probability\":\"2\",\"show\":true,\"arealimit\":false,\"pronumber\":\"2\",\"alipay\":\"\",\"description\":\"\",\"appItemId\":172163,\"name\":\"【勿动】兑吧优惠券定向库存不足\",\"remaind\":\"60\"},{\"type\":\"coupon\",\"title\":\"优惠券3\",\"img\":\"//yun.duiba.com.cn/upload/bust51462438317113.png\",\"valid\":true,\"probability\":\"3\",\"show\":true,\"arealimit\":false,\"pronumber\":\"3\",\"alipay\":\"\",\"description\":\"\",\"appItemId\":185571,\"name\":\"【自动化】自有优惠券成功页跳转链接 兑换成功后页面没有跳转按钮 以及点击入口\",\"remaind\":\"30\"}]"
,
"[{\"index\":null,\"type\":\"image\",\"rightAnswer\":1,\"name\":\"图片题1\",\"option1\":\"//yun.dui88.com/images/201811/0tg3occ8ft.png\",\"option2\":\"//yun.dui88.com/images/201811/7avinswhbx.png\",\"option3\":\"//yun.dui88.com/images/201811/wpivlzrt5x.png\",\"option4\":\"//yun.dui88.com/images/201811/omk617xseb.png\"},{\"index\":null,\"type\":\"image\",\"rightAnswer\":1,\"name\":\"图片题2\",\"option1\":\"//yun.dui88.com/images/201811/x7ukissn3k.png\",\"option2\":\"//yun.dui88.com/images/201811/3g81rrei8x.png\",\"option3\":\"//yun.dui88.com/images/201811/m16yaakc6u.png\",\"option4\":\"//yun.dui88.com/images/201811/kodb08cqi3.png\"},{\"index\":null,\"type\":\"image\",\"rightAnswer\":1,\"name\":\"图片题3\",\"option1\":\"//yun.dui88.com/images/201811/au84gljudk.png\",\"option2\":\"//yun.dui88.com/images/201811/vt9wfrnefk.png\",\"option3\":\"//yun.dui88.com/images/201811/tzplflmd8e.png\",\"option4\":\"//yun.dui88.com/images/201811/n5odjivu2j.png\"}]"
,
"5"
,
"forever"
,
"20"
,
"forever"
,
"3"
,
"新建自有答题活动-图片题"
},
//case 2
};
}
}
return
result
;
return
result
;
}
}
...
@@ -267,6 +277,12 @@ public class 新建活动测试_DuibaTest extends DuibaTestBase{
...
@@ -267,6 +277,12 @@ public class 新建活动测试_DuibaTest extends DuibaTestBase{
logger
.
info
(
"校验新建自有手动开奖-1内容成功"
);
logger
.
info
(
"校验新建自有手动开奖-1内容成功"
);
break
;
break
;
case
2
:
case
2
:
Assert
.
assertEquals
(
editResponse
.
jsonPath
().
getString
(
"data.freeLimit"
),
"10"
,
"校验活动免费抽奖次数失败"
);
Assert
.
assertEquals
(
editResponse
.
jsonPath
().
getString
(
"data.freeLimitScope"
),
"forever"
,
"校验活动免费抽奖次数类型失败"
);
Assert
.
assertEquals
(
editResponse
.
jsonPath
().
getString
(
"data.consumerDrawLimit"
),
"20"
,
"校验用户抽奖限制次数失败"
);
Assert
.
assertEquals
(
editResponse
.
jsonPath
().
getString
(
"data.consumerDrawLimitScope"
),
"forever"
,
"校验用户抽奖限制类型失败"
);
Assert
.
assertEquals
(
editResponse
.
jsonPath
().
getString
(
"data.bannerImgNew"
),
"//yun.dui88.com/images/201811/j90o37xiof.jpg"
,
"校验活动新版banner图失败"
);
logger
.
info
(
"校验新建自有手动开奖-2内容成功"
);
break
;
break
;
}
}
...
@@ -277,6 +293,69 @@ public class 新建活动测试_DuibaTest extends DuibaTestBase{
...
@@ -277,6 +293,69 @@ public class 新建活动测试_DuibaTest extends DuibaTestBase{
}
}
/**
* @param caseNum 用例编号
* @param awards 奖品
* @param questionRecord 题目
* @param freeLimit 免费次数
* @param freeScope 免费次数类型
* @param limitCount 限制次数
* @param limitScope 限制次数类型
* @param optionNum 题目数
* @param caseName 用例名称
* @throws Exception
*/
@Test
(
dataProvider
=
"providerMethod"
)
public
void
新建自有答题活动
(
int
caseNum
,
String
awards
,
String
questionRecord
,
String
freeLimit
,
String
freeScope
,
String
limitCount
,
String
limitScope
,
String
optionNum
,
String
caseName
)
throws
Exception
{
logger
.
info
(
"-----------------------------"
+
caseName
+
"-----------------------------"
);
String
data
=
PublicMethod
.
data
();
String
title
=
"【自动化】自有答题活动"
+
data
;
//新建自有手动开奖
developerService
.
saveQuestion
(
title
,
awards
,
questionRecord
,
freeLimit
,
freeScope
,
limitCount
,
limitScope
,
optionNum
);
//获取活动id
Response
listResponse
=
developerService
.
list2
(
title
);
String
id
=
String
.
valueOf
(
listResponse
.
jsonPath
().
getString
(
"data.list[0].id"
));
//编辑活动,校验活动内容
Response
editResponse
=
developerService
.
editQuestion
(
id
);
switch
(
caseNum
){
case
1
:
Assert
.
assertEquals
(
editResponse
.
jsonPath
().
getString
(
"data.credits"
),
"22"
,
"校验活动积分失败"
);
Assert
.
assertEquals
(
editResponse
.
jsonPath
().
getString
(
"data.freeLimit"
),
"10"
,
"校验活动免费次数失败"
);
Assert
.
assertEquals
(
editResponse
.
jsonPath
().
getString
(
"data.freeScope"
),
"everyday"
,
"校验活动免费抽奖次数类型失败"
);
Assert
.
assertEquals
(
editResponse
.
jsonPath
().
getString
(
"data.limitCount"
),
"5"
,
"校验活动限制次数失败"
);
Assert
.
assertEquals
(
editResponse
.
jsonPath
().
getString
(
"data.limitScope"
),
"everyday"
,
"校验活动限制类型失败"
);
Assert
.
assertEquals
(
editResponse
.
jsonPath
().
getString
(
"data.questionRecord[0].name"
),
"文字题一"
,
"校验活动题目名称失败"
);
Assert
.
assertEquals
(
editResponse
.
jsonPath
().
getString
(
"data.questionRecord[0].type"
),
"text"
,
"校验活动题目类型失败"
);
Assert
.
assertEquals
(
editResponse
.
jsonPath
().
getString
(
"data.awards[0].name"
),
"【勿动】自有优惠券审核通过测试"
,
"校验活动奖品名称失败"
);
Assert
.
assertEquals
(
editResponse
.
jsonPath
().
getString
(
"data.awards[0].probability"
),
"1"
,
"校验活动奖品获奖资格失败"
);
logger
.
info
(
"校验新建自有答题活动-1内容成功"
);
break
;
case
2
:
Assert
.
assertEquals
(
editResponse
.
jsonPath
().
getString
(
"data.freeLimit"
),
"5"
,
"校验活动免费次数失败"
);
Assert
.
assertEquals
(
editResponse
.
jsonPath
().
getString
(
"data.freeScope"
),
"forever"
,
"校验活动免费抽奖次数类型失败"
);
Assert
.
assertEquals
(
editResponse
.
jsonPath
().
getString
(
"data.limitCount"
),
"20"
,
"校验活动限制次数失败"
);
Assert
.
assertEquals
(
editResponse
.
jsonPath
().
getString
(
"data.limitScope"
),
"forever"
,
"校验活动限制类型失败"
);
Assert
.
assertEquals
(
editResponse
.
jsonPath
().
getString
(
"data.questionRecord[0].name"
),
"图片题1"
,
"校验活动题目名称失败"
);
Assert
.
assertEquals
(
editResponse
.
jsonPath
().
getString
(
"data.questionRecord[0].type"
),
"image"
,
"校验活动题目类型失败"
);
Assert
.
assertEquals
(
editResponse
.
jsonPath
().
getString
(
"data.awards[1].name"
),
"【勿动】兑吧优惠券定向库存不足"
,
"校验活动奖品名称失败"
);
Assert
.
assertEquals
(
editResponse
.
jsonPath
().
getString
(
"data.awards[1].probability"
),
"2"
,
"校验活动奖品获奖资格失败"
);
logger
.
info
(
"校验新建自有答题活动-2内容成功"
);
break
;
}
//删除测试数据
this
.
删除自有活动
(
title
);
}
//删除自有活动
//删除自有活动
public
void
删除自有活动
(
String
title
)
throws
Exception
{
public
void
删除自有活动
(
String
title
)
throws
Exception
{
//开发者删除自有活动
//开发者删除自有活动
...
...
src/test/java/http/service/hd/DeveloperService.java
View file @
f4c745a9
...
@@ -1110,4 +1110,66 @@ public class DeveloperService {
...
@@ -1110,4 +1110,66 @@ public class DeveloperService {
return
response
;
return
response
;
}
}
//保存自有答题活动--所有字段
public
Response
saveQuestion
(
String
title
,
String
awards
,
String
questionRecord
,
String
freeLimit
,
String
freeScope
,
String
limitCount
,
String
limitScope
,
String
optionNum
)
throws
Exception
{
String
url
=
hdHost
+
"/question/save"
;
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"subType"
,
"question"
);
map
.
put
(
"title"
,
title
);
map
.
put
(
"anticheatExchangeLimit"
,
"true"
);
map
.
put
(
"awards"
,
awards
);
map
.
put
(
"questionRecord"
,
questionRecord
);
map
.
put
(
"credits"
,
"22"
);
map
.
put
(
"creditsType"
,
"1"
);
map
.
put
(
"banner"
,
"//yun.duiba.com.cn/upload/S2T4p1474356849960.png"
);
map
.
put
(
"thumbnail"
,
"//yun.duiba.com.cn/upload/ljoka1474356876322.png"
);
map
.
put
(
"bannerImgNew"
,
"//yun.duiba.com.cn/upload/qzfsmsyo9s.png"
);
map
.
put
(
"appId"
,
"2239"
);
map
.
put
(
"freeLimit"
,
freeLimit
);
map
.
put
(
"freeScope"
,
freeScope
);
map
.
put
(
"limitCount"
,
limitCount
);
map
.
put
(
"limitScope"
,
limitScope
);
map
.
put
(
"optionNum"
,
optionNum
);
map
.
put
(
"autoOffDate"
,
"2020-12-08 00:00"
);
map
.
put
(
"id"
,
""
);
logger
.
info
(
"创建自有答题活动:"
+
url
);
Response
response
=
given
().
contentType
(
"application/x-www-form-urlencoded;charset=UTF-8"
).
cookies
(
authorization
.
hdLogin
()).
params
(
map
).
post
(
"http://"
+
url
);
response
.
prettyPrint
();
try
{
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"desc"
),
"成功"
);
}
catch
(
Exception
e
){
throw
new
Exception
(
"创建自有答题活动接口失败,返回信息:"
+
response
.
asString
());
}
catch
(
Error
er
){
throw
new
Exception
(
"创建自有答题活动接口失败,返回信息:"
+
response
.
asString
());
}
return
response
;
}
//编辑自有答题活动
public
Response
editQuestion
(
String
actId
)
throws
Exception
{
String
url
=
hdHost
+
"/question/editData"
;
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"appId"
,
"2239"
);
map
.
put
(
"actId"
,
actId
);
map
.
put
(
"type"
,
"question"
);
logger
.
info
(
"请求编辑自有答题活动url:"
+
url
);
Response
response
=
given
().
contentType
(
"application/x-www-form-urlencoded;charset=UTF-8"
).
cookies
(
authorization
.
hdLogin
()).
params
(
map
).
post
(
"http://"
+
url
);
response
.
prettyPrint
();
try
{
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"desc"
),
"成功"
);
}
catch
(
Exception
e
){
throw
new
Exception
(
"编辑自有答题活动接口失败,返回信息:"
+
response
.
asString
());
}
catch
(
Error
er
){
throw
new
Exception
(
"编辑自有答题活动接口失败,返回信息:"
+
response
.
asString
());
}
return
response
;
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment