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
14224116
Commit
14224116
authored
Aug 01, 2019
by
吕雯燕
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'duiba_wenyan'
parents
0dd6fe41
c43da568
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
40 deletions
+38
-40
自有新实物_兑换流程测试_ExchangeTest.java
...ses/ExchangeTest/自有_商品兑换限制/自有新实物_兑换流程测试_ExchangeTest.java
+38
-40
No files found.
src/test/java/http/cases/ExchangeTest/自有_商品兑换限制/自有新实物_兑换流程测试_ExchangeTest.java
View file @
14224116
...
...
@@ -497,55 +497,53 @@ public class 自有新实物_兑换流程测试_ExchangeTest extends CheckTemple
}
@Test
(
description
=
"新实物扣库存测试"
)
public
void
实物扣库存测试
()
throws
Exception
{
int
uid
=
7302
;
String
appItemId
=
"197385"
;
String
itemId
=
null
;
String
skuId
=
"183"
;
String
credits
=
"10"
;
String
actualCredits
=
"10"
;
//查询兑换前的库存
//stock_id 通过表tb_app_item_sku 来查询
Map
<
String
,
Object
>
mapStock
=
jdbc
.
findSimpleResult
(
"SELECT * FROM stock.tb_stock WHERE stock_id = 1059049813690420183"
);
String
stock
=
String
.
valueOf
(
mapStock
.
get
(
"stock"
));
logger
.
info
(
"兑换前的库存:"
+
stock
);
Response
response
=
gawService
.
objectExchange
(
uid
,
appItemId
,
itemId
,
skuId
,
credits
,
actualCredits
);
String
orderId
=
response
.
jsonPath
().
getString
(
"data.orderId"
);
//获取兑换结果
response
=
tawService
.
orderStatus
(
orderId
,
uid
);
response
.
prettyPrint
();
String
status
=
response
.
jsonPath
().
getString
(
"data.status"
);
int
i
=
10
;
//异步接口,直到兑换成功
while
(
i
>
0
&&
status
.
equals
(
"processing"
))
{
Thread
.
sleep
(
1000
);
response
=
tawService
.
orderStatus
(
orderId
,
uid
);
response
.
prettyPrint
();
status
=
response
.
jsonPath
().
getString
(
"data.status"
);
i
--;
}
mapStock
=
jdbc
.
findSimpleResult
(
"SELECT * FROM stock.tb_stock WHERE stock_id = 1059049813690420183"
);
String
newStock
=
String
.
valueOf
(
mapStock
.
get
(
"stock"
));
String
result
=
String
.
valueOf
(
Integer
.
valueOf
(
stock
)-
1
);
logger
.
info
(
"兑换后的库存:"
+
newStock
);
//测试使用
//@Test(enabled=true, dataProvider="testdp", threadPoolSize=1, invocationCount=100)
@DataProvider
(
name
=
"testdp"
,
parallel
=
true
)
public
static
Object
[][]
testdp
(){
return
new
Object
[][]{
{
1
},
{
2
},
{
3
},
{
4
},
{
162
},
{
6
},
{
8
},
{
10
},
{
157
},
{
158
}
};
}
// @Test(enabled=true, dataProvider="testdp", threadPoolSize=1, invocationCount=100)
public
void
test
(
int
uid
)
throws
Exception
{
// System.out.println("Current Thread Id: " + Thread.currentThread().getId() + ". Dataprovider number: "+ dpNumber);
// Thread.sleep(5000);
String
appItemId
=
"159040"
;
String
itemId
=
"null"
;
String
message
=
""
;
String
skuId
=
"144"
;
String
actualCredits
=
"8"
;
String
credits
=
"100"
;
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.status"
),
"wait_delivery"
,
"校验订单状态失败"
);
Assert
.
assertEquals
(
newStock
,
result
,
"校验扣库存失败"
);
logger
.
info
(
"校验新实物商品扣库存成功"
);
Thread
.
sleep
(
4000
);
Response
response
=
gawService
.
objectExchange
(
uid
,
appItemId
,
itemId
,
skuId
,
credits
,
actualCredits
);
response
.
prettyPrint
();
//(enabled=true, dataProvider="testdp", threadPoolSize=1, invocationCount=2)
}
String
orderId
=
response
.
jsonPath
().
getString
(
"data.orderId"
);
response
=
tawService
.
orderStatus
(
orderId
,
uid
);
response
.
prettyPrint
();
}
}
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