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
6e177c8d
Commit
6e177c8d
authored
Nov 08, 2018
by
周松波
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add cases
parent
5c6fca8c
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
104 additions
and
6 deletions
+104
-6
ContractSign_signTest.java
src/test/java/http/cases/SignTest/ContractSign_signTest.java
+102
-4
ContractSignService.java
src/test/java/http/service/Activity/ContractSignService.java
+2
-2
No files found.
src/test/java/http/cases/SignTest/ContractSign_signTest.java
View file @
6e177c8d
...
@@ -180,12 +180,12 @@ public class ContractSign_signTest extends DuibaTestBase {
...
@@ -180,12 +180,12 @@ public class ContractSign_signTest extends DuibaTestBase {
@Test
(
description
=
"活动ID=2,uid2第六天断签"
,
priority
=
3
)
@Test
(
description
=
"活动ID=2,uid2第六天断签"
,
priority
=
3
)
public
void
契约签到断签
()
throws
Exception
{
public
void
契约签到断签
()
throws
Exception
{
String
actI
D
=
"2"
;
String
actI
d
=
"2"
;
//当天为周期第一天,周期往前再挪6天
//当天为周期第一天,周期往前再挪6天
modifyIssuePeriod
(
issueId
,-
6
);
modifyIssuePeriod
(
issueId
,-
6
);
//补签前5天,第六天不签
//补签前5天,第六天不签
this
.
contractResign
(
actI
D
,
uid2
,
7
,
true
);
this
.
contractResign
(
actI
d
,
uid2
,
7
,
true
);
Response
homeInfoRes
=
ContractSignService
.
getHomeInfo
(
actI
D
,
uid2
);
Response
homeInfoRes
=
ContractSignService
.
getHomeInfo
(
actI
d
,
uid2
);
//homeInfoRes.prettyPrint();
//homeInfoRes.prettyPrint();
String
status
=
homeInfoRes
.
jsonPath
().
getString
(
"data.status"
);
String
status
=
homeInfoRes
.
jsonPath
().
getString
(
"data.status"
);
Assert
.
assertEquals
(
status
,
"5"
,
"当前签到状态不正确"
);
Assert
.
assertEquals
(
status
,
"5"
,
"当前签到状态不正确"
);
...
@@ -253,7 +253,7 @@ public class ContractSign_signTest extends DuibaTestBase {
...
@@ -253,7 +253,7 @@ public class ContractSign_signTest extends DuibaTestBase {
Assert
.
assertEquals
(
periodShow
,
period
,
"参与期次号不正确"
);
Assert
.
assertEquals
(
periodShow
,
period
,
"参与期次号不正确"
);
String
status
=
homeInfoRes
.
jsonPath
().
getString
(
"data.status"
);
String
status
=
homeInfoRes
.
jsonPath
().
getString
(
"data.status"
);
Assert
.
assertEquals
(
status
,
"6"
,
"当前参与状态不正确"
);
Assert
.
assertEquals
(
status
,
"6"
,
"当前参与状态不正确"
);
// 查询
中奖信息
// 查询
参与记录
Response
recordRes
=
ContractSignService
.
getContracts
(
actId
,
uid3
);
Response
recordRes
=
ContractSignService
.
getContracts
(
actId
,
uid3
);
String
contractId
=
recordRes
.
jsonPath
().
getString
(
"data.list[0].contractId"
);
String
contractId
=
recordRes
.
jsonPath
().
getString
(
"data.list[0].contractId"
);
String
doneStatus
=
recordRes
.
jsonPath
().
getString
(
"data.list[0].doneStatus"
);
String
doneStatus
=
recordRes
.
jsonPath
().
getString
(
"data.list[0].doneStatus"
);
...
@@ -266,9 +266,107 @@ public class ContractSign_signTest extends DuibaTestBase {
...
@@ -266,9 +266,107 @@ public class ContractSign_signTest extends DuibaTestBase {
String
rewardAmount
=
rewardRes
.
jsonPath
().
getString
(
"data"
);
String
rewardAmount
=
rewardRes
.
jsonPath
().
getString
(
"data"
);
Assert
.
assertEquals
(
rewardStatus
,
"true"
,
"领取奖励结果不正确"
);
Assert
.
assertEquals
(
rewardStatus
,
"true"
,
"领取奖励结果不正确"
);
Assert
.
assertEquals
(
rewardAmount
,
winCount
,
"领取奖励金额不正确"
);
Assert
.
assertEquals
(
rewardAmount
,
winCount
,
"领取奖励金额不正确"
);
//再次查询参与记录
recordRes
=
ContractSignService
.
getContracts
(
actId
,
uid3
);
doneStatus
=
recordRes
.
jsonPath
().
getString
(
"data.list[0].doneStatus"
);
Assert
.
assertEquals
(
doneStatus
,
"REWARD"
,
"当前期次完成状态不正确"
);
winCount
=
recordRes
.
jsonPath
().
getString
(
"data.list[0].winCount"
);
Assert
.
assertEquals
(
winCount
,
"7000"
,
"显示领取金额不正确"
);
//uid4领奖
recordRes
=
ContractSignService
.
getContracts
(
actId
,
uid4
);
contractId
=
recordRes
.
jsonPath
().
getString
(
"data.list[0].contractId"
);
ContractSignService
.
getReward
(
contractId
,
uid4
);
}
@Test
(
description
=
"打卡/收益排行榜,活动ID=2"
,
priority
=
6
)
public
void
参与记录
()
throws
Exception
{
// 查询断签用户参与记录
Response
recordRes
=
ContractSignService
.
getContracts
(
"2"
,
uid2
);
String
doneStatus
=
recordRes
.
jsonPath
().
getString
(
"data.list[0].doneStatus"
);
Assert
.
assertEquals
(
doneStatus
,
"FAIL"
,
"参与记录中参与状态不正确"
);
int
totalPay
=
recordRes
.
jsonPath
().
getInt
(
"data.totalPay"
);
int
totalSuccTime
=
recordRes
.
jsonPath
().
getInt
(
"data.totalSuccTime"
);
int
totalJoinTime
=
recordRes
.
jsonPath
().
getInt
(
"data.totalJoinTime"
);
int
totalProfit
=
recordRes
.
jsonPath
().
getInt
(
"data.totalProfit"
);
String
failDate
=
recordRes
.
jsonPath
().
getString
(
"data.list[0].failDate"
);
Date
now
=
new
Date
();
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"MM-dd"
);
Calendar
calendar
=
Calendar
.
getInstance
();
calendar
.
setTime
(
now
);
calendar
.
add
(
Calendar
.
DAY_OF_YEAR
,
-
2
);
String
failDateT
=
sdf
.
format
(
calendar
.
getTime
());
Assert
.
assertEquals
(
failDate
,
failDateT
,
"断签日期不正确"
);
Assert
.
assertEquals
(
totalPay
,
1000
,
"累计投入不正确"
);
Assert
.
assertEquals
(
totalJoinTime
,
1
,
"累计参与次数不正确"
);
Assert
.
assertEquals
(
totalSuccTime
,
0
,
"参与成功次数不正确"
);
Assert
.
assertEquals
(
totalProfit
,
0
,
"累计收益不正确"
);
//查询成功用户参与记录
recordRes
=
ContractSignService
.
getContracts
(
"2"
,
uid3
);
totalPay
=
recordRes
.
jsonPath
().
getInt
(
"data.totalPay"
);
totalSuccTime
=
recordRes
.
jsonPath
().
getInt
(
"data.totalSuccTime"
);
totalJoinTime
=
recordRes
.
jsonPath
().
getInt
(
"data.totalJoinTime"
);
totalProfit
=
recordRes
.
jsonPath
().
getInt
(
"data.totalProfit"
);
Assert
.
assertEquals
(
totalPay
,
1000
,
"累计投入不正确"
);
Assert
.
assertEquals
(
totalJoinTime
,
1
,
"累计参与次数不正确"
);
Assert
.
assertEquals
(
totalSuccTime
,
1
,
"参与成功次数不正确"
);
Assert
.
assertEquals
(
totalProfit
,
7000
,
"累计收益不正确"
);
}
}
@Test
(
description
=
"打卡/收益排行榜,活动ID=2"
,
priority
=
7
)
public
void
排行榜
()
throws
Exception
{
String
actId
=
"2"
;
//查询签到次数排行榜
Response
countResponse
=
ContractSignService
.
getContractRank
(
actId
,
10
,
1
,
uid3
);
String
status1
=
countResponse
.
jsonPath
().
getString
(
"success"
);
Assert
.
assertEquals
(
status1
,
"true"
,
"打卡次数排行榜查询失败"
);
String
rank1
=
countResponse
.
jsonPath
().
getString
(
"data.rankList[2]"
);
String
userInfo1
=
countResponse
.
jsonPath
().
getString
(
"data.user"
);
Assert
.
assertEquals
(
userInfo1
,
rank1
);
int
userRank1
=
countResponse
.
jsonPath
().
getInt
(
"data.user.rank"
);
int
userAmount1
=
countResponse
.
jsonPath
().
getInt
(
"data.user.amount"
);
int
userId1
=
countResponse
.
jsonPath
().
getInt
(
"data.user.consumerId"
);
String
nickName1
=
countResponse
.
jsonPath
().
getString
(
"data.user.nickName"
);
Assert
.
assertEquals
(
userRank1
,
3
,
"打卡排名不正确"
);
//Assert.assertEquals(userAmount1, 1, "打卡次数不正确");
Assert
.
assertEquals
(
userId1
,
100085019
,
"consumerId不正确"
);
Assert
.
assertEquals
(
nickName1
,
"Auto3720"
,
"用户名不正确"
);
//查询收益排行榜
Response
rewardResponse
=
ContractSignService
.
getContractRank
(
actId
,
10
,
2
,
uid3
);
String
status2
=
rewardResponse
.
jsonPath
().
getString
(
"success"
);
Assert
.
assertEquals
(
status2
,
"true"
,
"打卡次数排行榜查询失败"
);
String
rank2
=
rewardResponse
.
jsonPath
().
getString
(
"data.rankList[1]"
);
String
userInfo2
=
rewardResponse
.
jsonPath
().
getString
(
"data.user"
);
int
userRank2
=
rewardResponse
.
jsonPath
().
getInt
(
"data.user.rank"
);
int
userAmount2
=
rewardResponse
.
jsonPath
().
getInt
(
"data.user.amount"
);
int
userId2
=
rewardResponse
.
jsonPath
().
getInt
(
"data.user.consumerId"
);
String
nickName2
=
rewardResponse
.
jsonPath
().
getString
(
"data.user.nickName"
);
Assert
.
assertEquals
(
userInfo2
,
rank2
);
Assert
.
assertEquals
(
userRank2
,
2
,
"用户收益排名不正确"
);
//Assert.assertEquals(userAmount2, 6000, "收益金额不正确");
Assert
.
assertEquals
(
userId2
,
100085019
,
"consumerId不正确"
);
Assert
.
assertEquals
(
nickName2
,
"Auto3720"
,
"用户名不正确"
);
}
@Test
(
description
=
"中奖轮播"
,
priority
=
8
)
public
void
中奖轮播
()
throws
Exception
{
//删除redis key
// Map<String, String> carouselMap = new HashMap<>();
// carouselMap.put("key", );
// Response redisResponse = given().params(map).get(activityHost + "/signtest/redis/delKey");
// String redisResult = redisResponse.jsonPath().getString("success");
// Assert.assertEquals(redisResult, "true", "删除redis键值失败");
// 中奖轮播接口查询
Response
CarouselRes
=
ContractSignService
.
getRewardTodayLimit200
(
"2"
,
uid1
);
String
cid1
=
CarouselRes
.
jsonPath
().
getString
(
"data[1].consumerId"
);
String
partnerUserId1
=
CarouselRes
.
jsonPath
().
getString
(
"data[1].uid"
);
String
nickname1
=
CarouselRes
.
jsonPath
().
getString
(
"data[1].nickName"
);
String
winCount1
=
CarouselRes
.
jsonPath
().
getString
(
"data[1].winCount"
);
Assert
.
assertEquals
(
cid1
,
"100085020"
);
Assert
.
assertEquals
(
partnerUserId1
,
String
.
valueOf
(
uid4
));
Assert
.
assertEquals
(
nickname1
,
"Auto3721"
);
Assert
.
assertEquals
(
winCount1
,
"7000"
);
}
public
Map
<
String
,
String
>
doJoinResult
(
String
activityId
,
String
betAmount
,
int
uid
)
throws
Exception
{
public
Map
<
String
,
String
>
doJoinResult
(
String
activityId
,
String
betAmount
,
int
uid
)
throws
Exception
{
Response
doJoinRes
=
ContractSignService
.
doJoin
(
activityId
,
betAmount
,
uid
);
Response
doJoinRes
=
ContractSignService
.
doJoin
(
activityId
,
betAmount
,
uid
);
...
...
src/test/java/http/service/Activity/ContractSignService.java
View file @
6e177c8d
...
@@ -109,8 +109,8 @@ public class ContractSignService {
...
@@ -109,8 +109,8 @@ public class ContractSignService {
* @return
* @return
* @throws Exception
* @throws Exception
*/
*/
public
Response
getContractRank
(
String
activityId
,
String
topNum
,
String
showType
,
int
uid
)
throws
Exception
{
public
Response
getContractRank
(
String
activityId
,
int
topNum
,
int
showType
,
int
uid
)
throws
Exception
{
Map
<
String
,
String
>
map
=
new
HashMap
<>();
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"activityId"
,
activityId
);
map
.
put
(
"activityId"
,
activityId
);
map
.
put
(
"topNum"
,
topNum
);
map
.
put
(
"topNum"
,
topNum
);
map
.
put
(
"showType"
,
showType
);
map
.
put
(
"showType"
,
showType
);
...
...
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