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
88594e86
Commit
88594e86
authored
Dec 21, 2019
by
吕雯燕
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lv
parent
32d443f2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
158 additions
and
0 deletions
+158
-0
红包广场提现_AccessTest.java
.../java/http/cases/LotterySquareTest/红包广场提现_AccessTest.java
+66
-0
LotterySquareService.java
...test/java/http/service/Activity/LotterySquareService.java
+92
-0
No files found.
src/test/java/http/cases/LotterySquareTest/红包广场提现_AccessTest.java
0 → 100644
View file @
88594e86
package
http
.
cases
.
LotterySquareTest
;
import
base.DuibaTestBase
;
import
http.service.Activity.LotterySquareService
;
import
io.restassured.response.Response
;
import
org.apache.ibatis.jdbc.SQL
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.testng.Assert
;
import
org.testng.annotations.AfterMethod
;
import
org.testng.annotations.BeforeClass
;
import
org.testng.annotations.BeforeMethod
;
import
org.testng.annotations.Test
;
import
java.sql.SQLException
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.concurrent.CopyOnWriteArrayList
;
/**
* Created by lvwenyan on 2019/12/21
*/
public
class
红包广场提现
_AccessTest
extends
DuibaTestBase
{
@Autowired
LotterySquareService
lotterySquareService
;
@Test
(
description
=
"红包账户用户提现成功测试"
)
public
void
红包提现成功
()
throws
Exception
{
int
uid
=
7450
;
String
activityId
=
"1"
;
String
money
=
"1"
;
//查询提现页面
Response
indexResponse
=
lotterySquareService
.
cashIndexInfo
(
uid
,
activityId
);
indexResponse
.
prettyPrint
();
String
accountBalance
=
indexResponse
.
jsonPath
().
getString
(
"data.accountBalance"
);
String
leftCashTimes
=
indexResponse
.
jsonPath
().
getString
(
"data.leftCashTimes"
);
logger
.
info
(
"钱包余额:"
+
accountBalance
);
logger
.
info
(
"剩余可提现次数:"
+
leftCashTimes
);
String
accountBalanceResult
=
String
.
valueOf
(
Integer
.
valueOf
(
accountBalance
)
-
100
)
;
String
leftCashTimesResult
=
String
.
valueOf
(
Integer
.
valueOf
(
leftCashTimes
)
-
1
)
;
//提现接口
Response
cashDrawsResponse
=
lotterySquareService
.
cashDraws
(
uid
,
activityId
,
money
);
cashDrawsResponse
.
prettyPrint
();
//再次查询提现页面
indexResponse
=
lotterySquareService
.
cashIndexInfo
(
uid
,
activityId
);
accountBalance
=
indexResponse
.
jsonPath
().
getString
(
"data.accountBalance"
);
leftCashTimes
=
indexResponse
.
jsonPath
().
getString
(
"data.leftCashTimes"
);
logger
.
info
(
"提现后钱包余额:"
+
accountBalance
);
logger
.
info
(
"提现后剩余可提现次数:"
+
leftCashTimes
);
Assert
.
assertEquals
(
accountBalance
,
accountBalanceResult
,
"校验accountBalance失败"
);
Assert
.
assertEquals
(
leftCashTimes
,
leftCashTimesResult
,
"校验leftCashTimes失败"
);
logger
.
info
(
"校验成功:红包广场提现1元"
);
}
}
src/test/java/http/service/Activity/LotterySquareService.java
0 → 100644
View file @
88594e86
package
http
.
service
.
Activity
;
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 lvwenyan on 2019/12/21
*/
@Service
public
class
LotterySquareService
{
@Value
(
"${activity.host}"
)
String
activityHost
;
@Autowired
Authorization
authorization
;
private
DuibaLog
logger
=
DuibaLog
.
getLogger
();
/**
* @param uid
* @param actId 活动id
* @return
* @throws Exception
*/
public
Response
cashIndexInfo
(
int
uid
,
String
actId
)
throws
Exception
{
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"actId"
,
actId
);
logger
.
info
(
"请求/aaw/lotterySquare/cashIndexInfo接口"
);
Response
response
=
given
().
cookies
(
authorization
.
dafuwengLogin
(
uid
)).
params
(
map
).
get
(
activityHost
+
"/aaw/lotterySquare/cashIndexInfo"
);
try
{
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"success"
),
"true"
,
"/aaw/lotterySquare/cashIndexInfo接口失败"
);
}
catch
(
Exception
e
)
{
throw
new
Exception
(
"/aaw/lotterySquare/cashIndexInfo接口失败,返回信息:"
+
response
.
asString
());
}
catch
(
Error
er
)
{
throw
new
Exception
(
"/aaw/lotterySquare/cashIndexInfo接口失败,返回信息:"
+
response
.
asString
());
}
return
response
;
}
/**
* @param uid
* @param actId 活动id
* @param money 金额
* @return
* @throws Exception
*/
public
Response
cashDraws
(
int
uid
,
String
actId
,
String
money
)
throws
Exception
{
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"actId"
,
actId
);
map
.
put
(
"money"
,
money
);
map
.
put
(
"account"
,
"peeulk6392@sandbox.com"
);
map
.
put
(
"username"
,
"沙箱环境"
);
logger
.
info
(
"请求/aaw/lotterySquare/cashDraws接口"
);
Response
response
=
given
().
cookies
(
authorization
.
dafuwengLogin
(
uid
)).
contentType
(
"application/x-www-form-urlencoded;charset=UTF-8"
).
params
(
map
).
post
(
activityHost
+
"/aaw/lotterySquare/cashDraws"
);
try
{
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"success"
),
"true"
,
"/aaw/lotterySquare/cashDraws接口失败"
);
}
catch
(
Exception
e
)
{
throw
new
Exception
(
"/aaw/lotterySquare/cashDraws接口失败,返回信息:"
+
response
.
asString
());
}
catch
(
Error
er
)
{
throw
new
Exception
(
"/aaw/lotterySquare/cashDraws接口失败,返回信息:"
+
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