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
4f54084d
Commit
4f54084d
authored
Nov 03, 2018
by
赵然
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
zr
parent
f21d02b6
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
259 additions
and
4 deletions
+259
-4
ObjectExchange_ExchangeTest.java
.../http/cases/ExchangeTest/ObjectExchange_ExchangeTest.java
+2
-1
Qb_兑换流程测试_ExchangeTest.java
.../java/http/cases/ExchangeTest/Qb_兑换流程测试_ExchangeTest.java
+2
-2
商品订单失败测试_ExchangeTest.java
...t/java/http/cases/ExchangeTest/商品订单失败测试_ExchangeTest.java
+1
-1
开发者账户余额校验测试_ExchangeTest.java
...ava/http/cases/ExchangeTest/开发者账户余额校验测试_ExchangeTest.java
+254
-0
No files found.
src/test/java/http/cases/ExchangeTest/ObjectExchange_ExchangeTest.java
View file @
4f54084d
...
...
@@ -438,6 +438,7 @@ public class ObjectExchange_ExchangeTest extends DuibaTestBase{
//直充类流量兑换
@Test
(
description
=
"直充类流量兑换"
)
public
void
流量兑换
()
throws
Exception
{
int
uid
=
4376
;
Thread
.
sleep
(
2000
);
Map
<
String
,
Object
>
mapuser
=
jdbc
.
findSimpleResult
(
"select * from dafuweng.user where id="
+
uid
);
String
credits
=
String
.
valueOf
(
mapuser
.
get
(
"credits"
));
...
...
@@ -446,7 +447,7 @@ public class ObjectExchange_ExchangeTest extends DuibaTestBase{
credits
=
String
.
valueOf
(
Integer
.
valueOf
(
credits
)
-
600
);
//兑换详情页
Response
response
=
mobileService
.
detail
(
authorization
.
dafuwengLogin
(
uid
),
"3"
);
Map
<
String
,
String
>
map
=
authorization
.
dafuwengLogin
(
uid
);
//
Map<String, String> map = authorization.dafuwengLogin(uid);
Assert
.
assertEquals
(
String
.
valueOf
(
response
.
getStatusCode
()),
"200"
,
"活动详情页请求异常"
);
//流量兑换
response
=
couponExchangeService
.
phoneflowExchange
(
authorization
.
dafuwengLogin
(
uid
),
"51200"
,
"3"
,
"13193354550"
,
"中国联通"
,
"陕西"
);
...
...
src/test/java/http/cases/ExchangeTest/Qb_兑换流程测试_ExchangeTest.java
View file @
4f54084d
...
...
@@ -209,7 +209,7 @@ public class Qb_兑换流程测试_ExchangeTest extends DuibaTestBase {
Assert
.
assertTrue
(
message
.
contains
(
"\"success\":false"
));
}
@Test
//
@Test
public
void
审核通过测试
()
throws
Exception
{
//查询兑换前的开发者账户余额
...
...
@@ -273,7 +273,7 @@ public class Qb_兑换流程测试_ExchangeTest extends DuibaTestBase {
logger
.
info
(
"校验支付宝扣费订单成功"
);
}
@Test
//
@Test
public
void
审核不通过测试
()
throws
Exception
{
//查询兑换前的开发者账户余额
...
...
src/test/java/http/cases/ExchangeTest/商品订单失败测试_ExchangeTest.java
View file @
4f54084d
...
...
@@ -279,7 +279,7 @@ public class 商品订单失败测试_ExchangeTest extends DuibaTestBase {
}
@Test
//
@Test
public
void
支付宝审核不通过测试
()
throws
Exception
{
//查询兑换前的开发者账户余额
...
...
src/test/java/http/cases/ExchangeTest/开发者账户余额校验测试_ExchangeTest.java
0 → 100644
View file @
4f54084d
package
http
.
cases
.
ExchangeTest
;
import
base.DuibaLog
;
import
base.DuibaTestBase
;
import
http.service.Activity.ManagerService
;
import
http.service.Authorization
;
import
http.service.app.*
;
import
http.service.hd.DeveloperAccountService
;
import
http.service.hd.DsOrderService
;
import
io.restassured.response.Response
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.testng.Assert
;
import
org.testng.annotations.Test
;
import
java.util.Map
;
/**
* Created by lvwenyan on 2018/06/08.
*/
public
class
开发者账户余额校验测试
_ExchangeTest
extends
DuibaTestBase
{
@Autowired
private
CouponExchangeService
couponExchangeService
;
@Autowired
private
ManagerService
managerService
;
@Autowired
private
MobileService
mobileService
;
@Autowired
private
DsOrderService
dsOrderService
;
@Autowired
QbExchangeService
qbExchangeService
;
@Autowired
private
AlipayExchangeService
alipayExchangeService
;
@Autowired
private
Authorization
authorization
;
@Autowired
private
DeveloperAccountService
developerAccountService
;
private
DuibaLog
logger
=
DuibaLog
.
getLogger
();
//指定用户
private
static
int
uid
=
3769
;
@Test
public
void
商品订单支付宝审核不通过测试
()
throws
Exception
{
//查询兑换前的开发者账户余额
// Response accountResponse = developerAccountService.accountInfo();
// String remainMoney = accountResponse.jsonPath().getString("data.remainMoney");
// logger.info("兑换前的开发者账户余额:" + remainMoney);
//支付宝兑换
String
orderId
=
this
.
支付宝兑换订单
(
uid
,
"peeulk6392@sandbox.com"
,
"沙箱环境"
,
"10"
);
logger
.
info
(
"订单号:"
+
orderId
);
//订单审核,判断是否在待审核节点
Map
<
String
,
Object
>
mapOrder
=
jdbc
.
findSimpleResult
(
"SELECT * FROM "
+
Database
.
orders_consumer
+
"."
+
Database
.
orders5
+
" WHERE id = "
+
orderId
);
String
flowWork
=
String
.
valueOf
(
mapOrder
.
get
(
"flowwork_stage"
));
logger
.
info
(
"数据库订单节点:"
+
flowWork
);
String
orderIdmain
=
String
.
valueOf
(
mapOrder
.
get
(
"order_num"
));
logger
.
info
(
"兑吧订单号为:"
+
orderIdmain
);
int
i
=
10
;
while
(
i
>
0
&&
!
flowWork
.
equals
(
"Audit-started"
))
{
Thread
.
sleep
(
300
);
mapOrder
=
jdbc
.
findSimpleResult
(
"SELECT * FROM "
+
Database
.
orders_consumer
+
"."
+
Database
.
orders5
+
" WHERE id = "
+
orderId
);
flowWork
=
String
.
valueOf
(
mapOrder
.
get
(
"flowwork_stage"
));
logger
.
info
(
"数据库订单节点:"
+
flowWork
);
i
--;
}
//订单审核
Response
auditResponse
=
dsOrderService
.
submitAudit
(
orderId
,
"reject"
);
auditResponse
.
prettyPrint
();
//判断订单是否审核失败
int
j
=
10
;
while
(
j
>
0
&&
!
flowWork
.
equals
(
"Fail-complete"
))
{
Thread
.
sleep
(
1000
);
auditResponse
=
dsOrderService
.
submitAudit
(
orderId
,
"reject"
);
mapOrder
=
jdbc
.
findSimpleResult
(
"SELECT * FROM "
+
Database
.
orders_consumer
+
"."
+
Database
.
orders5
+
" WHERE id = "
+
orderId
);
flowWork
=
String
.
valueOf
(
mapOrder
.
get
(
"flowwork_stage"
));
logger
.
info
(
"当前订单节点:"
+
flowWork
);
j
--;
}
String
status
=
String
.
valueOf
(
mapOrder
.
get
(
"status"
));
//兑换后的开发者账户余额
// accountResponse = developerAccountService.accountInfo();
// String remainMoneyNew = accountResponse.jsonPath().getString("data.remainMoney");
// logger.info("兑换后的开发者账户余额:" + remainMoneyNew);
//校验开发者账户余额变动
Response
accountResponse
=
developerAccountService
.
cashDetail
(
orderIdmain
);
String
remainMoney
=
String
.
valueOf
(
Integer
.
valueOf
(
accountResponse
.
jsonPath
().
getString
(
"data.list[1].balance"
))+
Integer
.
valueOf
(
accountResponse
.
jsonPath
().
getString
(
"data.list[1].moneyChange"
)));
logger
.
info
(
"兑换前的开发者账户余额:"
+
remainMoney
);
String
remainMoneyNew
=
accountResponse
.
jsonPath
().
getString
(
"data.list[0].balance"
);
logger
.
info
(
"兑换后的开发者账户余额:"
+
remainMoneyNew
);
Assert
.
assertEquals
(
remainMoneyNew
,
remainMoney
,
"校验开发者账户余额失败"
);
Assert
.
assertEquals
(
status
,
"fail"
,
"校验订单状态失败"
);
logger
.
info
(
"校验支付宝审核订单失败返还金额成功"
);
}
@Test
public
void
Qb
审核通过测试
()
throws
Exception
{
//查询兑换前的开发者账户余额
// Response accountResponse = developerAccountService.accountInfo();
// String remainMoney = accountResponse.jsonPath().getString("data.remainMoney");
// logger.info("兑换前的开发者账户余额:" + remainMoney);
// String remainMoneyNew =String.valueOf(Integer.valueOf(remainMoney) - 9600) ;
int
uid
=
2709
;
Response
response
=
qbExchangeService
.
doTakePrize
(
authorization
.
dafuwengLogin
(
uid
),
"1234345554"
,
"100"
);
String
orderId
=
(
String
)
response
.
jsonPath
().
get
(
"orderId"
);
response
.
prettyPrint
();
//订单审核,判断是否在待审核节点
Map
<
String
,
Object
>
mapOrder
=
jdbc
.
findSimpleResult
(
"SELECT * from orders_consumer.orders_0616 where id ="
+
orderId
);
String
flowWork
=
String
.
valueOf
(
mapOrder
.
get
(
"flowwork_stage"
));
logger
.
info
(
"数据库订单节点:"
+
flowWork
);
String
orderIdmain
=
String
.
valueOf
(
mapOrder
.
get
(
"order_num"
));
logger
.
info
(
"兑吧订单号为:"
+
orderIdmain
);
int
i
=
10
;
while
(
i
>
0
&&
!
flowWork
.
equals
(
"Audit-started"
))
{
Thread
.
sleep
(
300
);
mapOrder
=
jdbc
.
findSimpleResult
(
"SELECT * from orders_consumer.orders_0616 where id ="
+
orderId
);
flowWork
=
String
.
valueOf
(
mapOrder
.
get
(
"flowwork_stage"
));
logger
.
info
(
"数据库订单节点:"
+
flowWork
);
i
--;
}
Response
auditResponse
=
dsOrderService
.
submitAudit
(
orderId
,
"pass"
);
auditResponse
.
prettyPrint
();
//判断订单是否审核成功,如果订单没有成功则继续审核
int
j
=
10
;
while
(
j
>
0
&&
!
flowWork
.
equals
(
"Success-complete"
))
{
Thread
.
sleep
(
1000
);
auditResponse
=
dsOrderService
.
submitAudit
(
orderId
,
"pass"
);
mapOrder
=
jdbc
.
findSimpleResult
(
"SELECT * from orders_consumer.orders_0616 where id ="
+
orderId
);
flowWork
=
String
.
valueOf
(
mapOrder
.
get
(
"flowwork_stage"
));
logger
.
info
(
"数据库订单节点:"
+
flowWork
);
j
--;
}
String
status
=
String
.
valueOf
(
mapOrder
.
get
(
"status"
));
//兑换后的开发者账户余额
// accountResponse = developerAccountService.accountInfo();
// remainMoney = accountResponse.jsonPath().getString("data.remainMoney");
// logger.info("兑换后的开发者账户余额:" + remainMoney);
// Assert.assertEquals(remainMoney,remainMoneyNew,"校验开发者账户余额失败");
//校验开发者账户余额变动
Response
accountResponse
=
developerAccountService
.
cashDetail
(
orderIdmain
);
String
remainMoney
=
String
.
valueOf
(
Integer
.
valueOf
(
accountResponse
.
jsonPath
().
getString
(
"data.list[0].balance"
))+
Integer
.
valueOf
(
accountResponse
.
jsonPath
().
getString
(
"data.list[0].moneyChange"
)));
logger
.
info
(
"兑换前的开发者账户余额:"
+
remainMoney
);
remainMoney
=
String
.
valueOf
(
Integer
.
valueOf
(
remainMoney
)
-
9600
)
;
String
remainMoneyNew
=
accountResponse
.
jsonPath
().
getString
(
"data.list[0].balance"
);
logger
.
info
(
"兑换后的开发者账户余额:"
+
remainMoneyNew
);
Assert
.
assertEquals
(
remainMoneyNew
,
remainMoney
,
"校验开发者账户余额失败"
);
Assert
.
assertEquals
(
status
,
"success"
,
"校验订单状态失败"
);
logger
.
info
(
"校验支付宝扣费订单成功"
);
}
@Test
public
void
Qb
审核不通过测试
()
throws
Exception
{
//查询兑换前的开发者账户余额
// Response accountResponse = developerAccountService.accountInfo();
// String remainMoney = accountResponse.jsonPath().getString("data.remainMoney");
// logger.info("兑换前的开发者账户余额:" + remainMoney);
//qb兑换
int
uid
=
2709
;
Response
response
=
qbExchangeService
.
doTakePrize
(
authorization
.
dafuwengLogin
(
uid
),
"1234345554"
,
"100"
);
String
orderId
=
(
String
)
response
.
jsonPath
().
get
(
"orderId"
);
//订单审核,判断是否在待审核节点
Map
<
String
,
Object
>
mapOrder
=
jdbc
.
findSimpleResult
(
"SELECT * from orders_consumer.orders_0616 where id ="
+
orderId
);
String
flowWork
=
String
.
valueOf
(
mapOrder
.
get
(
"flowwork_stage"
));
logger
.
info
(
"数据库订单节点:"
+
flowWork
);
String
orderIdmain
=
String
.
valueOf
(
mapOrder
.
get
(
"order_num"
));
logger
.
info
(
"兑吧订单号为:"
+
orderIdmain
);
int
i
=
10
;
while
(
i
>
0
&&
!
flowWork
.
equals
(
"Audit-started"
))
{
Thread
.
sleep
(
300
);
mapOrder
=
jdbc
.
findSimpleResult
(
"SELECT * from orders_consumer.orders_0616 where id ="
+
orderId
);
flowWork
=
String
.
valueOf
(
mapOrder
.
get
(
"flowwork_stage"
));
logger
.
info
(
"数据库订单节点:"
+
flowWork
);
i
--;
}
//订单审核
Response
auditResponse
=
dsOrderService
.
submitAudit
(
orderId
,
"reject"
);
auditResponse
.
prettyPrint
();
//判断订单是否审核失败
int
j
=
10
;
while
(
j
>
0
&&
!
flowWork
.
equals
(
"Fail-complete"
))
{
Thread
.
sleep
(
1000
);
auditResponse
=
dsOrderService
.
submitAudit
(
orderId
,
"reject"
);
mapOrder
=
jdbc
.
findSimpleResult
(
"SELECT * from orders_consumer.orders_0616 where id ="
+
orderId
);
flowWork
=
String
.
valueOf
(
mapOrder
.
get
(
"flowwork_stage"
));
logger
.
info
(
"当前订单节点:"
+
flowWork
);
j
--;
}
String
status
=
String
.
valueOf
(
mapOrder
.
get
(
"status"
));
//兑换后的开发者账户余额
// accountResponse = developerAccountService.accountInfo();
// String remainMoneyNew = accountResponse.jsonPath().getString("data.remainMoney");
// logger.info("兑换后的开发者账户余额:" + remainMoneyNew);
// Assert.assertEquals(remainMoneyNew,remainMoney,"校验开发者账户余额失败");
Assert
.
assertEquals
(
status
,
"fail"
,
"校验订单状态失败"
);
//校验开发者账户余额变动
Response
accountResponse
=
developerAccountService
.
cashDetail
(
orderIdmain
);
String
remainMoney
=
String
.
valueOf
(
Integer
.
valueOf
(
accountResponse
.
jsonPath
().
getString
(
"data.list[1].balance"
))+
Integer
.
valueOf
(
accountResponse
.
jsonPath
().
getString
(
"data.list[1].moneyChange"
)));
logger
.
info
(
"兑换前的开发者账户余额:"
+
remainMoney
);
String
remainMoneyNew
=
accountResponse
.
jsonPath
().
getString
(
"data.list[0].balance"
);
logger
.
info
(
"兑换后的开发者账户余额:"
+
remainMoneyNew
);
Assert
.
assertEquals
(
remainMoneyNew
,
remainMoney
,
"校验开发者账户余额失败"
);
logger
.
info
(
"校验支付宝审核订单失败返还金额成功"
);
}
//支付宝兑换接口抽离
public
String
支付宝兑换订单
(
int
uid
,
String
alipay
,
String
realname
,
String
degreeId
)
throws
Exception
{
Response
response
=
alipayExchangeService
.
exchange
(
uid
,
alipay
,
realname
,
degreeId
);
String
orderId
=
response
.
jsonPath
().
getString
(
"orderId"
);
//查看兑换结果
response
=
mobileService
.
orderStatusQuery
(
authorization
.
dafuwengLogin
(
uid
),
orderId
);
response
.
prettyPrint
();
String
status
=
response
.
jsonPath
().
getString
(
"status"
);
//异步接口
int
i
=
10
;
while
(
i
>
0
&&
status
.
equals
(
"processing"
))
{
Thread
.
sleep
(
1000
);
response
=
mobileService
.
orderStatusQuery
(
authorization
.
dafuwengLogin
(
uid
),
orderId
);
response
.
prettyPrint
();
status
=
response
.
jsonPath
().
getString
(
"status"
);
i
--;
}
return
orderId
;
}
}
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