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
39b60bce
Commit
39b60bce
authored
Aug 01, 2019
by
马博
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master'
parents
188603d6
34f205c3
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
131 additions
and
43 deletions
+131
-43
自有新优惠券_兑换限制测试_ExchangeTest.java
...es/ExchangeTest/自有_商品兑换限制/自有新优惠券_兑换限制测试_ExchangeTest.java
+44
-0
自有新实物_兑换流程测试_ExchangeTest.java
...ses/ExchangeTest/自有_商品兑换限制/自有新实物_兑换流程测试_ExchangeTest.java
+38
-40
自有新虚拟商品_充值_兑换限制_ExchangeTest.java
.../ExchangeTest/自有_商品兑换限制/自有新虚拟商品_充值_兑换限制_ExchangeTest.java
+46
-0
定向测试.java
src/test/java/http/cases/NewActivityTest/定向测试.java
+1
-1
gawService.java
src/test/java/http/service/app/gawService.java
+2
-2
No files found.
src/test/java/http/cases/ExchangeTest/自有_商品兑换限制/自有新优惠券_兑换限制测试_ExchangeTest.java
View file @
39b60bce
...
...
@@ -628,6 +628,50 @@ public class 自有新优惠券_兑换限制测试_ExchangeTest extends CheckTem
}
@Test
(
description
=
"新优惠券扣库存测试"
)
public
void
优惠券扣库存测试
()
throws
Exception
{
int
uid
=
7312
;
String
appItemId
=
"197567"
;
int
skuId
=
187
;
//查询兑换前的库存
//stock_id 通过表tb_goods_batch 来查询
Map
<
String
,
Object
>
mapStock
=
jdbc
.
findSimpleResult
(
"SELECT * FROM stock.tb_stock WHERE stock_id = 1060747299329170094"
);
String
stock
=
String
.
valueOf
(
mapStock
.
get
(
"stock"
));
logger
.
info
(
"兑换前的库存:"
+
stock
);
Response
response
=
gawService
.
couponExchange
(
uid
,
appItemId
,
skuId
);
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 = 1060747299329170094"
);
String
newStock
=
String
.
valueOf
(
mapStock
.
get
(
"stock"
));
String
result
=
String
.
valueOf
(
Integer
.
valueOf
(
stock
)-
1
);
logger
.
info
(
"兑换后的库存:"
+
newStock
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.status"
),
"success"
,
"校验订单状态失败"
);
Assert
.
assertEquals
(
newStock
,
result
,
"校验扣库存失败"
);
logger
.
info
(
"校验新优惠券商品扣库存成功"
);
}
...
...
src/test/java/http/cases/ExchangeTest/自有_商品兑换限制/自有新实物_兑换流程测试_ExchangeTest.java
View file @
39b60bce
...
...
@@ -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
();
}
}
src/test/java/http/cases/ExchangeTest/自有_商品兑换限制/自有新虚拟商品_充值_兑换限制_ExchangeTest.java
View file @
39b60bce
...
...
@@ -500,4 +500,50 @@ public class 自有新虚拟商品_充值_兑换限制_ExchangeTest extends Chec
}
@Test
(
description
=
"虚拟商品扣库存测试"
)
public
void
虚拟商品扣库存测试
()
throws
Exception
{
int
uid
=
7313
;
Map
cookies
=
authorization
.
dafuwengLogin
(
uid
);
String
appItemId
=
"197568"
;
int
skuId
=
188
;
//查询兑换前的库存
//stock_id 通过表tb_app_item_sku 来查询
Map
<
String
,
Object
>
mapStock
=
jdbc
.
findSimpleResult
(
"SELECT * FROM stock.tb_stock WHERE stock_id = 1060758938511670188"
);
String
stock
=
String
.
valueOf
(
mapStock
.
get
(
"stock"
));
logger
.
info
(
"兑换前的库存:"
+
stock
);
Response
response
=
gawService
.
virtualExchange
(
cookies
,
appItemId
,
skuId
);
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 = 1060758938511670188"
);
String
newStock
=
String
.
valueOf
(
mapStock
.
get
(
"stock"
));
String
result
=
String
.
valueOf
(
Integer
.
valueOf
(
stock
)-
1
);
logger
.
info
(
"兑换后的库存:"
+
newStock
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.status"
),
"success"
,
"校验订单状态失败"
);
Assert
.
assertEquals
(
newStock
,
result
,
"校验扣库存失败"
);
logger
.
info
(
"校验充值商品扣库存成功"
);
}
}
src/test/java/http/cases/NewActivityTest/定向测试
_DuibaTest
.java
→
src/test/java/http/cases/NewActivityTest/定向测试.java
View file @
39b60bce
...
...
@@ -17,7 +17,7 @@ import org.testng.annotations.Test;
/**
* Created by zhaoran on 2018/1/2
*/
public
class
定向测试
_DuibaTest
extends
DuibaTestBase
{
public
class
定向测试
extends
DuibaTestBase
{
@Autowired
NewActivityService
newActivityService
;
...
...
src/test/java/http/service/app/gawService.java
View file @
39b60bce
...
...
@@ -222,7 +222,7 @@ public class gawService {
JSONObject
jsonParam
=
JSONObject
.
parseObject
(
JSON
.
toJSONString
(
map
));
logger
.
info
(
"请求
实物
兑换接口:"
+
"/gaw/couponExchange/create"
);
logger
.
info
(
"请求
优惠券
兑换接口:"
+
"/gaw/couponExchange/create"
);
Response
response
=
given
().
contentType
(
"application/json; charset=UTF-8"
).
cookies
(
authorization
.
dafuwengLogin
(
uid
)).
body
(
jsonParam
).
post
(
"http://"
+
goodsHost
+
"/gaw/couponExchange/create"
);
// Response saveResponse = given().contentType("application/x-www-form-urlencoded;charset=UTF-8").cookies(authorization.dafuwengLogin(uid)).params(map).post("http://"+goodsHost+"/gaw/objectExchange/create");
...
...
@@ -353,7 +353,7 @@ public class gawService {
JSONObject
jsonParam
=
JSONObject
.
parseObject
(
JSON
.
toJSONString
(
map
));
logger
.
info
(
"请求
实物兑换接口:"
+
"/gaw/coupon
Exchange/create"
);
logger
.
info
(
"请求
虚拟商品兑换接口:"
+
"/gaw/virtual
Exchange/create"
);
Response
response
=
given
().
contentType
(
"application/json; charset=UTF-8"
).
cookies
(
cookie
).
body
(
jsonParam
).
post
(
"http://"
+
goodsHost
+
"/gaw/virtualExchange/create"
);
// Response saveResponse = given().contentType("application/x-www-form-urlencoded;charset=UTF-8").cookies(authorization.dafuwengLogin(uid)).params(map).post("http://"+goodsHost+"/gaw/objectExchange/create");
...
...
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