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
3ab9ce8e
Commit
3ab9ce8e
authored
Nov 14, 2018
by
chenjianfang
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'hmx' into develop
parents
32d3fafb
d10c0d3c
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
325 additions
and
0 deletions
+325
-0
签到管理_DuibaTest.java
...est/java/http/cases/SaasDeveloperTest/签到管理_DuibaTest.java
+90
-0
SignService.java
src/test/java/http/service/Saas/SignService.java
+235
-0
No files found.
src/test/java/http/cases/SaasDeveloperTest/签到管理_DuibaTest.java
0 → 100644
View file @
3ab9ce8e
package
http
.
cases
.
SaasDeveloperTest
;
import
base.Config
;
import
http.service.Saas.SignService
;
import
utils.PublicMethod
;
import
base.DuibaLog
;
import
io.restassured.response.Response
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.test.context.ContextConfiguration
;
import
org.springframework.test.context.testng.AbstractTestNGSpringContextTests
;
import
org.testng.Assert
;
import
org.testng.annotations.Test
;
/**
* Created by humengxin on 2018/11/13.
*/
@ContextConfiguration
(
classes
=
Config
.
class
)
public
class
签到管理
_DuibaTest
extends
AbstractTestNGSpringContextTests
{
@Autowired
SignService
signService
;
private
static
DuibaLog
logger
=
DuibaLog
.
getLogger
();
@Test
(
description
=
"新建签到活动"
)
public
void
a_
新建签到活动
()
throws
Exception
{
signService
.
find
();
//保存
signService
.
save
();
signService
.
findConfigById
();
signService
.
configEdit
();
signService
.
find
();
}
@Test
(
description
=
"预览签到活动"
)
public
void
b_
预览签到活动
()
throws
Exception
{
Response
response
=
signService
.
link
();
}
@Test
(
description
=
"获取链接"
)
public
void
c_
获取链接
()
throws
Exception
{
String
data
=
PublicMethod
.
data
();
//查询实物商品集合
Response
response
=
signService
.
getSignActivityUrl
();
//查看商品列表确认是否上架成功
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.isContainsCreditsRemainQueryUrl"
),
"true"
,
"校验获取链接失败"
);
logger
.
info
(
"校验获取链接成功"
);
}
@Test
(
description
=
"编辑签到活动"
)
public
void
d_
编辑签到活动
()
throws
Exception
{
signService
.
findConfigById
();
signService
.
configEdit
();
signService
.
find
();
}
@Test
(
description
=
"查询总签到个数"
)
public
void
e_
查询总签到个数
()
throws
Exception
{
String
data
=
PublicMethod
.
data
();
Response
response
=
signService
.
selectsignOperList
();
//查看签到列表个数是否成功
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.list[0].id"
),
"90"
,
"校验签到id失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.params.total"
),
"1"
,
"校验总个数失败"
);
logger
.
info
(
"校验签到总个数成功"
);
}
@Test
(
description
=
"删除签到"
)
public
void
f_
删除签到
()
throws
Exception
{
String
data
=
PublicMethod
.
data
();
Response
response
=
signService
.
selectsignOperList
();
String
id
=
response
.
jsonPath
().
getString
(
"data.list[0].signOperatingId"
);
//查看签到列表个数是否成功
Response
response1
=
signService
.
deleteSignOperatingById
(
id
);
Assert
.
assertEquals
(
response1
.
jsonPath
().
getString
(
"data.message"
),
"删除成功!"
,
"校验删除成功失败"
);
logger
.
info
(
"校验删除成功"
);
}
}
\ No newline at end of file
src/test/java/http/service/Saas/SignService.java
0 → 100644
View file @
3ab9ce8e
package
http
.
service
.
Saas
;
import
base.DuibaLog
;
import
http.service.Authorization
;
import
io.restassured.response.Response
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Service
;
import
org.testng.Assert
;
import
java.util.HashMap
;
import
java.util.Map
;
import
static
io
.
restassured
.
RestAssured
.
given
;
/**
* Created by humengxin on 2018/11/13.
*/
@Service
public
class
SignService
{
@Value
(
"${hdserver.host}"
)
String
hdHost
;
@Autowired
Authorization
authorization
;
private
DuibaLog
logger
=
DuibaLog
.
getLogger
();
//7查询签到管理列表数据:appid=19515
public
Response
selectsignOperList
()
throws
Exception
{
String
url
=
hdHost
+
"/saas/selectsignOperList"
;
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"rowId"
,
"1"
);
map
.
put
(
"appId"
,
"19515"
);
logger
.
info
(
"查询签到管理列表数据url:"
+
url
);
Response
response
=
given
().
contentType
(
"application/x-www-form-urlencoded;charset=UTF-8"
).
cookies
(
authorization
.
hdLoginSaas
()).
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
;
}
//5预览签到链接:appid=20979
public
Response
link
()
throws
Exception
{
String
url
=
hdHost
+
"/signin/preview/link"
;
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"type"
,
"2"
);
map
.
put
(
"appId"
,
"19515"
);
map
.
put
(
"activityId"
,
"90"
);
map
.
put
(
"skinId"
,
"51"
);
logger
.
info
(
"预览签到链接url:"
+
url
);
Response
response
=
given
().
contentType
(
"application/x-www-form-urlencoded;charset=UTF-8"
).
cookies
(
authorization
.
hdLoginSaas
()).
params
(
map
).
get
(
"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
;
}
//6获取链接接口
public
Response
getSignActivityUrl
()
throws
Exception
{
String
url
=
hdHost
+
"/signin/getSignActivityUrl"
;
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"appId"
,
"19515"
);
map
.
put
(
"id"
,
"90"
);
logger
.
info
(
"请求获取链接接口url:"
+
url
);
Response
response
=
given
().
contentType
(
"application/x-www-form-urlencoded;charset=UTF-8"
).
cookies
(
authorization
.
hdLoginSaas
()).
params
(
map
).
get
(
"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
;
}
//3查询某款签到活动
public
Response
findConfigById
()
throws
Exception
{
String
url
=
hdHost
+
"/signin/findConfigById"
;
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"appId"
,
"19515"
);
map
.
put
(
"actId"
,
"90"
);
logger
.
info
(
"查询某款签到活动url:"
+
url
);
Response
response
=
given
().
contentType
(
"application/x-www-form-urlencoded;charset=UTF-8"
).
cookies
(
authorization
.
hdLoginSaas
()).
params
(
map
).
get
(
"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
;
}
//4保存某款签到活动配置
public
Response
configEdit
()
throws
Exception
{
String
url
=
hdHost
+
"/signin/configEdit"
;
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"appId"
,
"19515"
);
map
.
put
(
"title"
,
"Saas开发者后台签到"
);
map
.
put
(
"description"
,
"<p>Saas开发者后台签到</p>"
);
map
.
put
(
"id"
,
"90"
);
map
.
put
(
"signRule"
,
"{\"acValidityType\":\"DAY\",\"cusCirType\":\"MONTH\",\"cusCirStart\":\"2018-06-15\",\"type\":\"CONTINUE\"}"
);
map
.
put
(
"reSignRule"
,
"{\"open\":true,\"dateUnit\":\"CUSTOM\",\"days\":30,\"conType\":\"NO\",\"credits\":null,\"card\":null,\"awardType\":\"NO\",\"countLimit\":\"30\",\"openAddLimit\":true,\"addLimitCycle\":null,\"addLimitCount\":null}"
);
map
.
put
(
"cntReward"
,
"{\"rwType\":\"CONTINUE\",\"plActSkinId\":null,\"plActId\":909,\"items\":[{\"days\":null,\"credits\":1,\"activityCount\":1}],\"plSkinOpen2Dev\":false,\"open\":false}"
);
map
.
put
(
"cirReward"
,
"{\"rwType\":\"CIRCLE\",\"plActSkinId\":100,\"plActId\":null,\"items\":[{\"days\":null,\"credits\":1,\"activityCount\":1}],\"plSkinOpen2Dev\":true,\"open\":true}"
);
map
.
put
(
"acmReward"
,
"{\"rwType\":\"ACCUMULATE\",\"plActSkinId\":100,\"plActId\":null,\"items\":[{\"days\":1,\"credits\":1,\"activityCount\":1}],\"plSkinOpen2Dev\":true,\"open\":true}"
);
map
.
put
(
"firstSignReward"
,
"{\"rwType\":\"FIRST_SIGN\",\"plActSkinId\":null,\"plActId\":null,\"items\":[{\"days\":1,\"credits\":0,\"activityCount\":1}],\"plSkinOpen2Dev\":false,\"open\":false}"
);
map
.
put
(
"fullSignReward"
,
"{\"rwType\":\"FULL_SIGN\",\"plActSkinId\":100,\"plActId\":null,\"items\":[{\"days\":1,\"credits\":100,\"activityCount\":100}],\"plSkinOpen2Dev\":true,\"open\":true}"
);
map
.
put
(
"firstSignReward"
,
"[]"
);
logger
.
info
(
"保存某款签到活动配置url:"
+
url
);
Response
response
=
given
().
contentType
(
"application/x-www-form-urlencoded;charset=UTF-8"
).
cookies
(
authorization
.
hdLoginSaas
()).
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
;
}
//1查询某款签到活动下绑定的皮肤
public
Response
find
()
throws
Exception
{
String
url
=
hdHost
+
"/signin/activityskin/find"
;
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"appId"
,
"19515"
);
map
.
put
(
"activityId"
,
"90"
);
map
.
put
(
"type"
,
"2"
);
logger
.
info
(
"查询某款签到活动下绑定的皮肤url:"
+
url
);
Response
response
=
given
().
contentType
(
"application/x-www-form-urlencoded;charset=UTF-8"
).
cookies
(
authorization
.
hdLoginSaas
()).
params
(
map
).
get
(
"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
;
}
//2查询某款签到活动关联的签到皮肤
public
Response
save
()
throws
Exception
{
String
url
=
hdHost
+
"/signin/save"
;
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"appId"
,
"19515"
);
map
.
put
(
"activityId"
,
"90"
);
map
.
put
(
"type"
,
"2"
);
map
.
put
(
"activitySkinId"
,
"51"
);
logger
.
info
(
"查询某款签到活动关联的签到皮肤url:"
+
url
);
Response
response
=
given
().
contentType
(
"application/x-www-form-urlencoded;charset=UTF-8"
).
cookies
(
authorization
.
hdLoginSaas
()).
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
;
}
//8删除某款签到活动
public
Response
deleteSignOperatingById
(
String
id
)
throws
Exception
{
String
url
=
hdHost
+
"/saas/deleteSignOperatingById"
;
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"id"
,
id
);
logger
.
info
(
"删除某款签到活动url:"
+
url
);
Response
response
=
given
().
contentType
(
"application/x-www-form-urlencoded;charset=UTF-8"
).
cookies
(
authorization
.
hdLoginSaas
()).
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
;
}
}
\ No newline at end of file
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