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
7d46fa52
Commit
7d46fa52
authored
Nov 23, 2018
by
吕雯燕
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'duiba_wenyan' into develop
parents
467b1c62
3d7ff2bb
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
131 additions
and
1 deletion
+131
-1
创建自有活动_DuibaTest.java
src/test/java/http/cases/DeveloperTest/创建自有活动_DuibaTest.java
+0
-1
新建活动测试_DuibaTest.java
src/test/java/http/cases/DeveloperTest/新建活动测试_DuibaTest.java
+68
-0
DeveloperService.java
src/test/java/http/service/hd/DeveloperService.java
+63
-0
No files found.
src/test/java/http/cases/DeveloperTest/创建自有活动_DuibaTest.java
View file @
7d46fa52
...
...
@@ -267,7 +267,6 @@ public class 创建自有活动_DuibaTest extends DuibaTestBase {
}
//删除自有活动
public
void
删除自有活动
(
String
title
)
throws
Exception
{
//开发者删除自有活动
...
...
src/test/java/http/cases/DeveloperTest/新建活动测试_DuibaTest.java
0 → 100644
View file @
7d46fa52
package
http
.
cases
.
DeveloperTest
;
import
base.DuibaTestBase
;
import
utils.PublicMethod
;
import
http.service.Activity.ManagerService
;
import
http.service.Activity.NewActivityService
;
import
http.service.Activity.SingleLotteryService
;
import
http.service.hd.DeveloperService
;
import
http.service.hd.SigninService
;
import
utils.MatcherString
;
import
base.DuibaLog
;
import
io.restassured.response.Response
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.testng.Assert
;
import
org.testng.annotations.Test
;
/**
* Created by lvwenyan on 2018/11/23.
*/
public
class
新建活动测试
_DuibaTest
extends
DuibaTestBase
{
@Autowired
DeveloperService
developerService
;
private
static
DuibaLog
logger
=
DuibaLog
.
getLogger
();
@Test
(
description
=
"开发者创建自有活动工具-积分商城活动完整版"
)
public
void
添加自有活动工具完整版
()
throws
Exception
{
String
data
=
PublicMethod
.
data
();
String
title
=
"【自动化】自有活动工具"
+
data
;
String
awards
=
"[{\"index\":1,\"type\":\"thanks\",\"img\":\"//yun.duiba.com.cn/upload/uP99F1462438316972.png\",\"title\":\"谢谢参与\",\"valid\":true,\"show\":true},{\"type\":\"coupon\",\"title\":\"优惠券\",\"img\":\"//yun.duiba.com.cn/upload/bust51462438317113.png\",\"valid\":true,\"probability\":\"10\",\"show\":true,\"arealimit\":false,\"pronumber\":\"\",\"alipay\":\"\",\"description\":\"\",\"appItemId\":159857,\"name\":\"【自动化勿动】自有优惠券\",\"limit\":\"1\",\"low\":\"2\",\"remaind\":\"100\"},{\"type\":\"object\",\"title\":\"实物\",\"img\":\"//yun.duiba.com.cn/upload/1uF0l1462438316968.png\",\"valid\":true,\"probability\":\"10\",\"show\":true,\"arealimit\":false,\"pronumber\":\"\",\"alipay\":\"\",\"description\":\"\",\"appItemId\":177222,\"name\":\"【自动化】自有实物\",\"limit\":\"2\",\"low\":\"3\",\"remaind\":\"90\"},{\"type\":\"virtual\",\"title\":\"虚拟商品\",\"img\":\"//yun.duiba.com.cn/developer/img/activityTool/slotMachine/virtual.png\",\"valid\":true,\"probability\":\"10\",\"show\":true,\"arealimit\":false,\"pronumber\":\"\",\"alipay\":\"\",\"description\":\"\",\"appItemId\":178060,\"value\":\"test\",\"limit\":\"3\",\"low\":\"4\",\"remaind\":\"80\"},{\"type\":\"alipay\",\"title\":\"支付宝\",\"img\":\"//yun.duiba.com.cn/upload/KkZMp1462438317113.png\",\"valid\":true,\"probability\":\"10\",\"show\":true,\"arealimit\":false,\"pronumber\":\"\",\"alipay\":\"\",\"description\":\"\",\"value\":\"1\",\"limit\":\"4\",\"low\":\"5\",\"remaind\":\"70\"},{\"type\":\"qb\",\"title\":\"Q币\",\"img\":\"//yun.duiba.com.cn/upload/mF3wO1462438317114.png\",\"valid\":true,\"probability\":\"10\",\"show\":true,\"arealimit\":false,\"pronumber\":\"\",\"alipay\":\"\",\"description\":\"\",\"value\":\"10\",\"limit\":\"5\",\"low\":\"6\",\"remaind\":\"60\"},{\"type\":\"lucky\",\"title\":\"福袋\",\"img\":\"//yun.duiba.com.cn/webapp/img/luckynewn.png\",\"valid\":true,\"probability\":\"10\",\"show\":false,\"arealimit\":false,\"pronumber\":\"\",\"alipay\":\"\",\"description\":\"\"},{\"type\":\"again\",\"title\":\"再抽一次\",\"img\":\"//yun.duiba.com.cn/upload/aJwb11462438317113.png\",\"valid\":true,\"probability\":\"10\",\"show\":true,\"arealimit\":false,\"pronumber\":\"\",\"alipay\":\"\",\"description\":\"\"}]"
;
String
bannerImgNew
=
"//yun.duiba.com.cn/upload/newHdTool/turntable_cricle/banner_750x220.png"
;
//新建自有活动工具
developerService
.
saveHdAll
(
""
,
title
,
"5"
,
"everyday"
,
"3"
,
"everyday"
,
awards
,
bannerImgNew
);
//获取活动id
Response
listResponse
=
developerService
.
list2
(
title
);
String
id
=
String
.
valueOf
(
listResponse
.
jsonPath
().
getString
(
"data.list[0].id"
));
//编辑活动,校验活动内容
Response
editResponse
=
developerService
.
editData
(
id
,
"turntable_circle"
,
"2239"
);
Assert
.
assertEquals
(
editResponse
.
jsonPath
().
getString
(
"data.credits"
),
"10"
,
"校验活动积分失败"
);
Assert
.
assertEquals
(
editResponse
.
jsonPath
().
getString
(
"data.freeLimit"
),
"3"
,
"校验活动免费抽奖次数失败"
);
Assert
.
assertEquals
(
editResponse
.
jsonPath
().
getString
(
"data.freeScope"
),
"everyday"
,
"校验活动免费抽奖次数类型失败"
);
Assert
.
assertEquals
(
editResponse
.
jsonPath
().
getString
(
"data.awards[1].name"
),
"【自动化勿动】自有优惠券"
,
"校验活动奖品名称失败"
);
Assert
.
assertEquals
(
editResponse
.
jsonPath
().
getString
(
"data.awards[1].limit"
),
"1"
,
"校验活动奖品中奖限制失败"
);
Assert
.
assertEquals
(
editResponse
.
jsonPath
().
getString
(
"data.awards[1].oldRemaind"
),
"100"
,
"校验活动奖品数量失败"
);
logger
.
info
(
"校验新建自有活动工具内容成功"
);
//删除测试数据
this
.
删除自有活动
(
title
);
}
//删除自有活动
public
void
删除自有活动
(
String
title
)
throws
Exception
{
//开发者删除自有活动
Response
HdResponse
=
developerService
.
list2
(
title
);
String
actId
=
HdResponse
.
jsonPath
().
getString
(
"data.list[0].id"
);
developerService
.
delActivity
(
actId
);
}
}
src/test/java/http/service/hd/DeveloperService.java
View file @
7d46fa52
...
...
@@ -912,4 +912,67 @@ public class DeveloperService {
return
response
;
}
//创建自有活动工具-所有字段
public
Response
saveHdAll
(
String
id
,
String
title
,
String
limitCount
,
String
limitScope
,
String
freeLimit
,
String
freeScope
,
String
awards
,
String
bannerImgNew
)
throws
Exception
{
String
url
=
hdHost
+
"/launch/save"
;
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"id"
,
id
);
map
.
put
(
"subType"
,
"turntable_circle"
);
map
.
put
(
"creditsType"
,
"1"
);
map
.
put
(
"title"
,
title
);
map
.
put
(
"credits"
,
"10"
);
map
.
put
(
"limitCount"
,
limitCount
);
map
.
put
(
"limitScope"
,
limitScope
);
map
.
put
(
"freeLimit"
,
freeLimit
);
map
.
put
(
"freeScope"
,
freeScope
);
map
.
put
(
"optionNum"
,
""
);
map
.
put
(
"anticheatExchangeLimit"
,
"true"
);
map
.
put
(
"autoOffDate"
,
"2030-12-01 00:00"
);
map
.
put
(
"banner"
,
"//yun.duiba.com.cn/upload/r1u3O1460639179556.png"
);
map
.
put
(
"thumbnail"
,
"//yun.duiba.com.cn/upload/R8Hac1467009242903.png"
);
map
.
put
(
"questionRecord"
,
"[]"
);
map
.
put
(
"awards"
,
awards
);
map
.
put
(
"appId"
,
"2239"
);
map
.
put
(
"bannerImgNew"
,
bannerImgNew
);
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
;
}
//开发者后台编辑自有活动
public
Response
editData
(
String
actId
,
String
type
,
String
appId
)
throws
Exception
{
String
url
=
hdHost
+
"/launch/editData"
;
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"actId"
,
actId
);
map
.
put
(
"type"
,
type
);
map
.
put
(
"appId"
,
appId
);
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