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
98d4dc16
Commit
98d4dc16
authored
Mar 14, 2019
by
吕雯燕
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'duiba_wenyan' into develop
parents
a1271345
943253c7
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
68 additions
and
15 deletions
+68
-15
Database.java
src/test/java/http/cases/ExchangeTest/Database.java
+1
-0
兑吧老优惠券_兑换流程测试_ExchangeTest.java
...a/http/cases/ExchangeTest/兑吧老优惠券_兑换流程测试_ExchangeTest.java
+19
-14
开发者账户余额校验测试_ExchangeTest.java
...ava/http/cases/ExchangeTest/开发者账户余额校验测试_ExchangeTest.java
+2
-1
DeveloperAccountService.java
src/test/java/http/service/hd/DeveloperAccountService.java
+24
-0
DsOrderService.java
src/test/java/http/service/hd/DsOrderService.java
+22
-0
No files found.
src/test/java/http/cases/ExchangeTest/Database.java
View file @
98d4dc16
...
...
@@ -13,4 +13,5 @@ public class Database {
public
static
String
orders6
=
"orders_0210"
;
public
static
String
orders7
=
"orders_0211"
;
public
static
String
orders8
=
"orders_0090"
;
public
static
String
orders9
=
"orders_0203"
;
}
src/test/java/http/cases/ExchangeTest/兑吧老优惠券_兑换流程测试_ExchangeTest.java
View file @
98d4dc16
...
...
@@ -80,6 +80,7 @@ public class 兑吧老优惠券_兑换流程测试_ExchangeTest extends CheckTem
new
Object
[]{
3
,
"171481"
,
"29540"
,
"yrJRr7Cddp2YeQd"
,
"优惠券日期兑换限制已结束"
},
//case2
};
}
if
(
method
.
getName
().
equals
(
"优惠券库存不足测试"
))
{
result
=
new
Object
[][]{
new
Object
[]{
"169775"
,
"29180"
,
"yrJRr7Cddp2YeQd"
,
"优惠券商品库存不足测试"
},
//case1
...
...
@@ -300,11 +301,12 @@ public class 兑吧老优惠券_兑换流程测试_ExchangeTest extends CheckTem
}
@Test
@Test
(
description
=
"兑吧优惠券审核通过测试"
)
public
void
优惠券审核通过测试
()
throws
Exception
{
String
appItemId
=
"169698"
;
String
itemId
=
"29156"
;
int
uid
=
6569
;
String
appItemId
=
"191878"
;
String
itemId
=
"32383"
;
// //查询兑换前的开发者余额
// Response accountResponse = developerAccountService.accountInfo();
...
...
@@ -317,15 +319,17 @@ public class 兑吧老优惠券_兑换流程测试_ExchangeTest extends CheckTem
logger
.
info
(
"订单号:"
+
orderId
);
//订单审核,判断是否在待审核节点
Map
<
String
,
Object
>
mapOrder
=
jdbc
.
findSimpleResult
(
"SELECT * FROM "
+
Database
.
orders_consumer
+
"."
+
Database
.
orders
4
+
" WHERE id = "
+
orderId
);
Map
<
String
,
Object
>
mapOrder
=
jdbc
.
findSimpleResult
(
"SELECT * FROM "
+
Database
.
orders_consumer
+
"."
+
Database
.
orders
9
+
" WHERE id = "
+
orderId
);
String
flowWork
=
String
.
valueOf
(
mapOrder
.
get
(
"flowwork_stage"
));
logger
.
info
(
"数据库订单节点:"
+
flowWork
);
Assert
.
assertEquals
(
flowWork
,
"Audit-started"
,
"校验数据库订单节点失败"
);
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
.
orders
4
+
" WHERE id = "
+
orderId
);
mapOrder
=
jdbc
.
findSimpleResult
(
"SELECT * FROM "
+
Database
.
orders_consumer
+
"."
+
Database
.
orders
9
+
" WHERE id = "
+
orderId
);
flowWork
=
String
.
valueOf
(
mapOrder
.
get
(
"flowwork_stage"
));
logger
.
info
(
"数据库订单节点:"
+
flowWork
);
i
--;
...
...
@@ -338,8 +342,8 @@ public class 兑吧老优惠券_兑换流程测试_ExchangeTest extends CheckTem
int
j
=
10
;
while
(
j
>
0
&&
!
flowWork
.
equals
(
"Success-complete"
))
{
Thread
.
sleep
(
1000
);
auditResponse
=
dsOrderService
.
submitAudit
(
orderId
,
"pass"
);
mapOrder
=
jdbc
.
findSimpleResult
(
"SELECT * FROM "
+
Database
.
orders_consumer
+
"."
+
Database
.
orders
4
+
" WHERE id = "
+
orderId
);
auditResponse
=
dsOrderService
.
submitAudit
(
"22542"
,
orderId
,
"pass"
,
authorization
.
hdLoginCommonNew
(
"15833333333"
)
);
mapOrder
=
jdbc
.
findSimpleResult
(
"SELECT * FROM "
+
Database
.
orders_consumer
+
"."
+
Database
.
orders
9
+
" WHERE id = "
+
orderId
);
flowWork
=
String
.
valueOf
(
mapOrder
.
get
(
"flowwork_stage"
));
logger
.
info
(
"数据库订单节点:"
+
flowWork
);
j
--;
...
...
@@ -349,7 +353,7 @@ public class 兑吧老优惠券_兑换流程测试_ExchangeTest extends CheckTem
Assert
.
assertEquals
(
status
,
"success"
,
"订单状态校验失败"
);
//校验开发者账户余额变动
Response
accountResponse
=
developerAccountService
.
cashDetail
(
orderIdmain
);
Response
accountResponse
=
developerAccountService
.
cashDetail
(
authorization
.
hdLoginCommonNew
(
"15833333333"
),
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
)
-
1000
)
;
...
...
@@ -744,16 +748,16 @@ public class 兑吧老优惠券_兑换流程测试_ExchangeTest extends CheckTem
}
@Test
@Test
(
description
=
"兑吧优惠券会员等级测试"
)
public
void
会员等级测试
()
throws
Exception
{
String
appItemId
=
"191
778
"
;
String
itemId
=
"323
74
"
;
String
appItemId
=
"191
876
"
;
String
itemId
=
"323
82
"
;
String
message
=
""
;
//会员等级无法兑换
try
{
Response
response
=
couponExchangeService
.
objectExchange
(
authorization
.
dafuwengLogin
(
uid
),
appItemId
,
itemId
,
"null"
,
"yrJRr7Cddp2YeQd"
,
"null"
);
Response
response
=
couponExchangeService
.
couponExchange
(
authorization
.
dafuwengLogin
(
uid
),
appItemId
,
itemId
);
response
.
prettyPrint
();
}
catch
(
Exception
e
){
...
...
@@ -762,13 +766,14 @@ public class 兑吧老优惠券_兑换流程测试_ExchangeTest extends CheckTem
logger
.
info
(
message
);
//会员等级可兑换,vip=5
Response
response
=
couponExchangeService
.
objectExchange
(
authorization
.
generateSignAutoLogin
(
"2wGQc3MZaQsqYFWcX4gguya5PnnS"
,
3402
),
appItemId
,
itemId
,
"null"
,
"yrJRr7Cddp2YeQd"
,
"null"
);
Response
response
=
couponExchangeService
.
couponExchange
(
authorization
.
generateSignAutoLogin
(
"2wGQc3MZaQsqYFWcX4gguya5PnnS"
,
3402
),
appItemId
,
itemId
);
response
.
prettyPrint
();
Assert
.
assertTrue
(
message
.
contains
(
"会员等级不符,请挑选其他吧(15)"
),
"校验message失败"
);
Assert
.
assertTrue
(
message
.
contains
(
"\"success\":false"
),
"校验success失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"success"
),
"true"
,
"校验兑换结果失败"
);
logger
.
info
(
"校验实物会员等级成功"
);
logger
.
info
(
"校验兑吧优惠券会员等级成功"
);
}
...
...
src/test/java/http/cases/ExchangeTest/开发者账户余额校验测试_ExchangeTest.java
View file @
98d4dc16
...
...
@@ -255,7 +255,8 @@ public class 开发者账户余额校验测试_ExchangeTest extends CheckTemplet
* @param caseName 用例名称打印
* @throws Exception
*/
@Test
(
dataProvider
=
"providerMethod"
)
//已经在优惠券兑换流程中覆盖
// @Test(dataProvider = "providerMethod")
public
void
优惠券兑换审核通过测试
(
int
caseNum
,
String
appItemId
,
String
itemId
,
String
caseName
)
throws
Exception
{
// int uid = 3768;
logger
.
info
(
caseName
);
...
...
src/test/java/http/service/hd/DeveloperAccountService.java
View file @
98d4dc16
...
...
@@ -4,6 +4,7 @@ package http.service.hd;
import
base.DuibaLog
;
import
http.service.Authorization
;
import
io.restassured.http.Cookies
;
import
io.restassured.response.Response
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
...
...
@@ -89,4 +90,27 @@ public class DeveloperAccountService {
return
response
;
}
//根据订单号查询开发者账户记录
public
Response
cashDetail
(
Map
cookies
,
String
orderId
)
throws
Exception
{
String
url
=
hdHost
+
"/developerAccount/cashDetail"
;
logger
.
info
(
"请求cashDetail开发者后台账户记录信息接口"
);
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"mode"
,
"two"
);
map
.
put
(
"orderId"
,
orderId
);
map
.
put
(
"rowId"
,
"1"
);
Response
response
=
given
().
cookies
(
cookies
).
params
(
map
).
get
(
"http://"
+
url
);
try
{
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"success"
),
"true"
,
"/developerAccount/cashDetail接口失败"
);
}
catch
(
Exception
e
){
throw
new
Exception
(
"/developerAccount/cashDetail接口失败,返回信息:"
+
response
.
asString
());
}
catch
(
Error
er
){
throw
new
Exception
(
"/developerAccount/cashDetail接口失败,返回信息:"
+
response
.
asString
());
}
return
response
;
}
}
src/test/java/http/service/hd/DsOrderService.java
View file @
98d4dc16
...
...
@@ -73,4 +73,26 @@ public class DsOrderService {
return
response
;
}
public
Response
submitAudit
(
String
appId
,
String
idArray
,
String
audit
,
Map
cookies
)
throws
Exception
{
String
url
=
hdHost
+
"/dsOrder/submitAudit"
;
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"appId"
,
appId
);
map
.
put
(
"idArray"
,
idArray
);
map
.
put
(
"audit"
,
audit
);
map
.
put
(
"reason"
,
"测试订单审核不通过"
);
logger
.
info
(
"请求订单审核接口:"
+
url
);
Response
response
=
given
().
contentType
(
"application/x-www-form-urlencoded;charset=UTF-8"
).
cookies
(
cookies
).
params
(
map
).
post
(
"http://"
+
url
);
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
;
}
}
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