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
9154b158
Commit
9154b158
authored
Mar 20, 2019
by
qwj-github
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add
parent
89f9a45a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
65 additions
and
21 deletions
+65
-21
新集卡_开奖流程_DuibaTest.java
...http/cases/NewCollectActivityTest/新集卡_开奖流程_DuibaTest.java
+53
-12
新集卡_插件开奖异常返卡_DuibaTest.java
.../cases/NewCollectActivityTest/新集卡_插件开奖异常返卡_DuibaTest.java
+12
-9
No files found.
src/test/java/http/cases/NewCollectActivityTest/新集卡_开奖流程_DuibaTest.java
View file @
9154b158
...
@@ -12,6 +12,7 @@ import base.DuibaTestBase;
...
@@ -12,6 +12,7 @@ import base.DuibaTestBase;
import
cn.com.duiba.activity.center.api.dto.activity.CLRewardDto
;
import
cn.com.duiba.activity.center.api.dto.activity.CLRewardDto
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
http.model.CollectGoodsInfo
;
import
http.model.CollectGoodsInfo
;
import
http.service.Activity.NewCollectActivityService
;
import
http.service.Activity.NewCollectActivityService
;
import
http.service.Manager.GetManagerInfoService
;
import
http.service.Manager.GetManagerInfoService
;
...
@@ -47,6 +48,7 @@ public class 新集卡_开奖流程_DuibaTest extends DuibaTestBase {
...
@@ -47,6 +48,7 @@ public class 新集卡_开奖流程_DuibaTest extends DuibaTestBase {
private
static
DuibaLog
logger
=
DuibaLog
.
getLogger
();
private
static
DuibaLog
logger
=
DuibaLog
.
getLogger
();
String
orderNum
=
null
;
String
orderNum
=
null
;
String
nomalOrderId
=
null
;
@DataProvider
@DataProvider
public
Iterator
<
Object
[]>
provideMethod
(
Method
method
)
{
public
Iterator
<
Object
[]>
provideMethod
(
Method
method
)
{
...
@@ -151,22 +153,60 @@ public class 新集卡_开奖流程_DuibaTest extends DuibaTestBase {
...
@@ -151,22 +153,60 @@ public class 新集卡_开奖流程_DuibaTest extends DuibaTestBase {
}
}
//
@Test
@Test
public
void
集卡开奖
_
直接出奖
_
奖品库存不足
()
throws
Exception
{
public
void
集卡开奖
_
直接出奖
_
奖品库存不足
()
throws
Exception
{
String
activityId
=
"
2718
"
;
String
activityId
=
"
3610
"
;
String
collectRuleId
=
"
4444
"
;
String
collectRuleId
=
"
5182
"
;
Integer
uid
=
3835
;
Integer
uid
=
6921
;
String
consumerId
=
"100
090009
"
;
String
consumerId
=
"100
144018
"
;
Response
playReasponse
=
this
.
playPlugin
(
activityId
,
collectRuleId
,
uid
);
// Response playReasponse = this.playPlugin(activityId, collectRuleId, uid);
playReasponse
.
prettyPrint
();
// playReasponse.prettyPrint();
Response
collectGoodsInfo
=
newCollectActivityService
.
getCollectGoodsInfo
(
collectRuleId
,
uid
);
collectGoodsInfo
.
prettyPrint
();
Integer
count
=
null
;
List
<
CollectGoodsInfo
>
MyColInfos
=
collectGoodsInfo
.
jsonPath
().
getList
(
"collectGoods"
,
CollectGoodsInfo
.
class
);
for
(
CollectGoodsInfo
info:
MyColInfos
){
if
(
info
.
getId
().
equals
(
"32472"
)){
count
=
Integer
.
valueOf
(
info
.
getCount
());
logger
.
info
(
"用户卡片itemId="
+
"32472"
+
"的数量为:"
+
count
);
break
;
Response
openResponse
=
newCollectActivityService
.
openCollectGoodsPrize
(
collectRuleId
,
uid
);
}
String
orderId
=
openResponse
.
jsonPath
().
getString
(
"orderId"
);
}
Assert
.
assertEquals
(
collectGoodsInfo
.
jsonPath
().
getString
(
"prizeLevel"
),
"4"
,
"集卡信息接口可开奖prizeLevel字段校验失败"
);
Assert
.
assertEquals
(
collectGoodsInfo
.
jsonPath
().
getString
(
"clickFlag"
),
"true"
,
"是否可点击开奖clickFlag校验失败"
);
logger
.
info
(
"获取集卡信息接口成功"
);
logger
.
info
(
"prizeLevel="
+
collectGoodsInfo
.
jsonPath
().
getString
(
"prizeLevel"
)+
"可开奖"
);
//开奖
Response
openPrizeResponse
=
this
.
openPrize
(
collectRuleId
,
uid
,
"nomal"
);
openPrizeResponse
.
prettyPrint
();
Assert
.
assertEquals
(
openPrizeResponse
.
jsonPath
().
getString
(
"result"
),
"0"
,
"校验开奖接口失败"
);
Assert
.
assertEquals
(
openPrizeResponse
.
jsonPath
().
getString
(
"lotteryCode"
),
"0"
,
"校验开奖类型lotteryCode失败"
);
Response
afterCollectGoodsInfo
=
newCollectActivityService
.
getCollectGoodsInfo
(
collectRuleId
,
uid
);
afterCollectGoodsInfo
.
prettyPrint
();
Integer
afterCount
=
null
;
List
<
CollectGoodsInfo
>
afterMyColInfos
=
afterCollectGoodsInfo
.
jsonPath
().
getList
(
"collectGoods"
,
CollectGoodsInfo
.
class
);
for
(
CollectGoodsInfo
info:
afterMyColInfos
){
if
(
info
.
getId
().
equals
(
32472
)){
afterCount
=
Integer
.
valueOf
(
info
.
getCount
());
Assert
.
assertEquals
(
count
,
afterCount
);
logger
.
info
(
"用户卡片itemId=32472"
+
"的数量为:"
+
count
);
logger
.
info
(
"校验卡片返回成功"
);
break
;
}
}
Map
<
String
,
Object
>
openOrder
=
jdbc
.
findSimpleResult
(
"SELECT * FROM activity_order_con.tb_trade_center_activity_order_0914 WHERE order_num = ?\n"
,
nomalOrderId
);
logger
.
info
(
JSON
.
toJSONString
(
openOrder
));
Assert
.
assertEquals
(
openOrder
.
get
(
"exchange_status"
).
toString
(),
"3"
,
"开奖订单状态校验失败"
);
Assert
.
assertEquals
(
openOrder
.
get
(
"error4consumer"
).
toString
(),
"item 扣库存失败"
,
"开奖失败错误信息校验失败"
);
Assert
.
assertEquals
(
openOrder
.
get
(
"item_id"
).
toString
(),
"32474"
,
"库存不足的兑换项id校验失败"
);
Response
statusResponse
=
newCollectActivityService
.
getOpenOrderStatus
(
orderId
,
uid
);
String
playResult
=
String
.
valueOf
(
statusResponse
.
jsonPath
().
getString
(
"result"
));
//奖品库存不足,发奖接口调用成功,订单生成,exchange_status=3,message标明扣库存失败;用户卡片扣除。
}
}
...
@@ -432,6 +472,7 @@ public class 新集卡_开奖流程_DuibaTest extends DuibaTestBase {
...
@@ -432,6 +472,7 @@ public class 新集卡_开奖流程_DuibaTest extends DuibaTestBase {
String
orderId
=
null
;
String
orderId
=
null
;
if
(
type
.
equals
(
"nomal"
)){
if
(
type
.
equals
(
"nomal"
)){
orderId
=
openResponse
.
jsonPath
().
getString
(
"orderId"
);
orderId
=
openResponse
.
jsonPath
().
getString
(
"orderId"
);
nomalOrderId
=
orderId
;
}
else
if
(
type
.
equals
(
"plugin"
)){
}
else
if
(
type
.
equals
(
"plugin"
)){
orderId
=
openResponse
.
jsonPath
().
getString
(
"orderId.orderNum"
);
orderId
=
openResponse
.
jsonPath
().
getString
(
"orderId.orderNum"
);
orderNum
=
orderId
;
orderNum
=
orderId
;
...
...
src/test/java/http/cases/NewCollectActivityTest/新集卡_插件开奖异常返卡.java
→
src/test/java/http/cases/NewCollectActivityTest/新集卡_插件开奖异常返卡
_DuibaTest
.java
View file @
9154b158
/**
/**
* Copyright (C), 2015-2019
* Copyright (C), 2015-2019
* FileName: 新集卡_插件开奖异常返卡
* FileName: 新集卡_插件开奖异常返卡
_DuibaTest
* Author: qianwenjun
* Author: qianwenjun
* Date: 2019/3/20 14:12
* Date: 2019/3/20 14:12
* Description:
* Description:
...
@@ -32,7 +32,7 @@ import java.util.Map;
...
@@ -32,7 +32,7 @@ import java.util.Map;
* @create 2019/3/20
* @create 2019/3/20
* @since 1.0.0
* @since 1.0.0
*/
*/
public
class
新集卡
_
插件开奖异常返卡
extends
DuibaTestBase
{
public
class
新集卡
_
插件开奖异常返卡
_DuibaTest
extends
DuibaTestBase
{
@Autowired
@Autowired
NewCollectActivityService
newCollectActivityService
;
NewCollectActivityService
newCollectActivityService
;
...
@@ -111,16 +111,19 @@ public class 新集卡_插件开奖异常返卡 extends DuibaTestBase {
...
@@ -111,16 +111,19 @@ public class 新集卡_插件开奖异常返卡 extends DuibaTestBase {
}
}
// @Test
@Test
public
void
集卡开奖
_
单接口调试
()
throws
Exception
{
public
void
集卡开奖
_
单接口调试
()
throws
Exception
{
//手动开奖——开
//手动开奖——开
String
activityId
=
"2741"
;
String
activityId
=
"2741"
;
String
collectRuleId
=
"5182"
;
String
collectRuleId
=
"5182"
;
Integer
uid
=
69
14
;
Integer
uid
=
69
21
;
String
consumerId
=
"100091476"
;
String
consumerId
=
"100091476"
;
String
count
=
"1"
;
String
count
=
"1"
;
String
afterCount
=
"0"
;
String
afterCount
=
"0"
;
String
prizeLevel
=
"
3
"
;
String
prizeLevel
=
"
4
"
;
String
afterPrizeLevel
=
"0"
;
String
afterPrizeLevel
=
"0"
;
String
clickFlag
=
"true"
;
String
clickFlag
=
"true"
;
String
afterClickFlag
=
"false"
;
String
afterClickFlag
=
"false"
;
...
@@ -128,7 +131,7 @@ public class 新集卡_插件开奖异常返卡 extends DuibaTestBase {
...
@@ -128,7 +131,7 @@ public class 新集卡_插件开奖异常返卡 extends DuibaTestBase {
String
openResult
=
"2"
;
String
openResult
=
"2"
;
this
.
playPlugin
(
"36
09"
,
"5182"
,
6914
);
this
.
playPlugin
(
"36
10"
,
"5182"
,
6921
);
consumerId
=
"100143586"
;
consumerId
=
"100143586"
;
Response
collectGoodsInfo
=
newCollectActivityService
.
getCollectGoodsInfo
(
collectRuleId
,
uid
);
Response
collectGoodsInfo
=
newCollectActivityService
.
getCollectGoodsInfo
(
collectRuleId
,
uid
);
...
@@ -140,10 +143,10 @@ public class 新集卡_插件开奖异常返卡 extends DuibaTestBase {
...
@@ -140,10 +143,10 @@ public class 新集卡_插件开奖异常返卡 extends DuibaTestBase {
logger
.
info
(
"获取集卡信息接口成功"
);
logger
.
info
(
"获取集卡信息接口成功"
);
logger
.
info
(
"prizeLevel="
+
collectGoodsInfo
.
jsonPath
().
getString
(
"prizeLevel"
)+
"可开奖"
);
logger
.
info
(
"prizeLevel="
+
collectGoodsInfo
.
jsonPath
().
getString
(
"prizeLevel"
)+
"可开奖"
);
//开奖
//开奖
Response
openPrizeResponse
=
this
.
openPrize
(
collectRuleId
,
uid
,
"
plugin
"
);
Response
openPrizeResponse
=
this
.
openPrize
(
collectRuleId
,
uid
,
"
nomal
"
);
openPrizeResponse
.
prettyPrint
();
openPrizeResponse
.
prettyPrint
();
Assert
.
assertEquals
(
openPrizeResponse
.
jsonPath
().
getString
(
"result"
),
"1"
,
"校验开奖接口失败"
);
//
Assert.assertEquals(openPrizeResponse.jsonPath().getString("result"),"1","校验开奖接口失败");
Assert
.
assertEquals
(
openPrizeResponse
.
jsonPath
().
getString
(
"lottery.type"
),
prizeType
,
"校验开奖类型object失败"
);
//
Assert.assertEquals(openPrizeResponse.jsonPath().getString("lottery.type"),prizeType,"校验开奖类型object失败");
logger
.
info
(
"校验开奖成功,开奖的奖项类型为:"
+
openPrizeResponse
.
jsonPath
().
getString
(
"lottery.type"
));
logger
.
info
(
"校验开奖成功,开奖的奖项类型为:"
+
openPrizeResponse
.
jsonPath
().
getString
(
"lottery.type"
));
Response
afterCollectGoodsInfo
=
newCollectActivityService
.
getCollectGoodsInfo
(
collectRuleId
,
uid
);
Response
afterCollectGoodsInfo
=
newCollectActivityService
.
getCollectGoodsInfo
(
collectRuleId
,
uid
);
afterCollectGoodsInfo
.
prettyPrint
();
afterCollectGoodsInfo
.
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