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
8769cb94
Commit
8769cb94
authored
Nov 25, 2019
by
吕雯燕
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lv
parent
0a2ecc98
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
51 additions
and
16 deletions
+51
-16
积分夺宝开奖_AccessTest.java
...t/java/http/cases/HappyCodeNewTest/积分夺宝开奖_AccessTest.java
+28
-16
HappyCodeNewService.java
src/test/java/http/service/Activity/HappyCodeNewService.java
+23
-0
No files found.
src/test/java/http/cases/HappyCodeNewTest/积分夺宝开奖_AccessTest.java
View file @
8769cb94
...
...
@@ -32,38 +32,50 @@ public class 积分夺宝开奖_AccessTest extends DuibaTestBase {
}
@Test
@Test
(
description
=
"夺宝码开奖,领奖优惠券奖品"
)
public
void
夺宝领奖
()
throws
Exception
{
//手动触发开奖
int
uid
=
7396
;
String
activityId
=
"45465"
;
String
detailId
=
"6"
;
String
basicId
=
"5"
;
String
phaseId
=
"12"
;
//手动触发开奖
Response
response
=
happyCodeNewService
.
openPrize
(
uid
);
response
.
prettyPrint
();
//查询数据库表,已开奖-3,开奖后才能领奖
Map
map
=
jdbc
.
findSimpleResult
(
"SELECT * FROM act_com_conf.`tb_happy_code_item_phase` where id = 12"
);
String
phase_status
=
String
.
valueOf
(
map
.
get
(
"phase_status"
));
String
winner_id
=
String
.
valueOf
(
map
.
get
(
"winner_id"
));
String
win_code
=
String
.
valueOf
(
map
.
get
(
"win_code"
));
logger
.
info
(
"领奖状态:"
+
phase_status
);
logger
.
info
(
"中奖用户id:"
+
winner_id
);
logger
.
info
(
"中奖用户夺宝码:"
+
win_code
);
Assert
.
assertEquals
(
phase_status
,
"3"
,
"校验phase_status期次状态失败"
);
//领奖
Response
rewardResponse
=
happyCodeNewService
.
getReward
(
uid
,
activityId
,
detailId
);
rewardResponse
.
prettyPrint
();
Response
response
=
happyCodeNewService
.
getReward
(
uid
,
activityId
,
detailId
);
response
.
prettyPrint
();
//夺宝详情页面
Response
detailResponse
=
happyCodeNewService
.
detail
(
uid
,
activityId
,
basicId
,
phaseId
);
detailResponse
.
prettyPrint
();
String
phaseStatus
=
String
.
valueOf
(
detailResponse
.
jsonPath
().
getString
(
"data.phaseStatus"
));
String
prizeCode
=
String
.
valueOf
(
detailResponse
.
jsonPath
().
getString
(
"data.prizeCode"
));
String
prizeType
=
String
.
valueOf
(
detailResponse
.
jsonPath
().
getString
(
"data.prizeType"
));
String
rewardStatus
=
String
.
valueOf
(
detailResponse
.
jsonPath
().
getString
(
"data.rewardStatus"
));
//校验数据库与夺宝详情数据
map
=
jdbc
.
findSimpleResult
(
"SELECT * FROM act_com_conf.`tb_happy_code_item_phase` where id = 12"
);
phase_status
=
String
.
valueOf
(
map
.
get
(
"phase_status"
));
String
winner_id
=
String
.
valueOf
(
map
.
get
(
"winner_id"
));
String
win_code
=
String
.
valueOf
(
map
.
get
(
"win_code"
));
logger
.
info
(
"中奖用户id:"
+
winner_id
);
logger
.
info
(
"中奖用户夺宝码:"
+
win_code
);
Assert
.
assertEquals
(
phaseStatus
,
phase_status
,
"校验phase_status期次状态失败"
);
Assert
.
assertEquals
(
prizeCode
,
win_code
,
"校验prizeCode中奖夺宝码失败"
);
Assert
.
assertEquals
(
prizeType
,
"coupon"
,
"校验prizeType失败"
);
Assert
.
assertEquals
(
rewardStatus
,
"2"
,
"校验rewardStatus失败"
);
Assert
.
assertEquals
(
winner_id
,
"100164126"
,
"校验中奖用户id失败"
);
logger
.
info
(
"校验夺宝码开奖成功"
);
}
}
src/test/java/http/service/Activity/HappyCodeNewService.java
View file @
8769cb94
...
...
@@ -16,6 +16,7 @@ import java.util.List;
import
java.util.Map
;
import
static
io
.
restassured
.
RestAssured
.
given
;
import
static
io
.
restassured
.
RestAssured
.
trustStore
;
/**
* Created by lvwenyan on 2019/11/23
...
...
@@ -140,6 +141,28 @@ public class HappyCodeNewService {
return
response
;
}
/**
* 手动触发定时任务开奖接口
* @param uid 用户id
*/
public
Response
openPrize
(
int
uid
)
throws
Exception
{
logger
.
info
(
"请求/aaw/happyCodeNew/openPrize"
);
Response
response
=
given
().
cookies
(
authorization
.
dafuwengLogin
(
uid
)).
get
(
activityHost
+
"/aaw/happyCodeNew/openPrize"
);
try
{
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"success"
),
"true"
,
"/aaw/happyCodeNew/openPrize接口失败"
);
}
catch
(
Exception
e
)
{
throw
new
Exception
(
"/aaw/happyCodeNew/openPrize接口失败,返回信息:"
+
response
.
asString
());
}
catch
(
Error
er
)
{
throw
new
Exception
(
"/aaw/happyCodeNew/openPrize接口失败,返回信息:"
+
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