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
06e40ed4
Commit
06e40ed4
authored
Mar 20, 2019
by
吕雯燕
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master'
parents
4bbbcd01
7fe09374
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
271 additions
and
16 deletions
+271
-16
新集卡_插件出奖异常返卡.xls
data/duiba/新集卡_插件出奖异常返卡.xls
+0
-0
兑吧新实物_兑换流程测试_ExchangeTest.java
...va/http/cases/ExchangeTest/兑吧新实物_兑换流程测试_ExchangeTest.java
+2
-2
新集卡_开奖流程_DuibaTest.java
...http/cases/NewCollectActivityTest/新集卡_开奖流程_DuibaTest.java
+53
-12
新集卡_插件开奖异常返卡_DuibaTest.java
.../cases/NewCollectActivityTest/新集卡_插件开奖异常返卡_DuibaTest.java
+200
-0
gawService.java
src/test/java/http/service/app/gawService.java
+16
-2
No files found.
data/duiba/新集卡_插件出奖异常返卡.xls
0 → 100644
View file @
06e40ed4
File added
src/test/java/http/cases/ExchangeTest/兑吧新实物_兑换流程测试_ExchangeTest.java
View file @
06e40ed4
...
...
@@ -44,8 +44,8 @@ public class 兑吧新实物_兑换流程测试_ExchangeTest extends CheckTemple
@Test
(
description
=
"兑吧新实物每人限购每日限制"
)
public
void
每人限购每日限制测试
()
throws
Exception
{
String
appItemId
=
"192950"
;
String
itemId
=
"32439"
;
int
appItemId
=
192950
;
int
itemId
=
32439
;
// try{
//第一次兑换
...
...
src/test/java/http/cases/NewCollectActivityTest/新集卡_开奖流程_DuibaTest.java
View file @
06e40ed4
...
...
@@ -12,6 +12,7 @@ import base.DuibaTestBase;
import
cn.com.duiba.activity.center.api.dto.activity.CLRewardDto
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
http.model.CollectGoodsInfo
;
import
http.service.Activity.NewCollectActivityService
;
import
http.service.Manager.GetManagerInfoService
;
...
...
@@ -47,6 +48,7 @@ public class 新集卡_开奖流程_DuibaTest extends DuibaTestBase {
private
static
DuibaLog
logger
=
DuibaLog
.
getLogger
();
String
orderNum
=
null
;
String
nomalOrderId
=
null
;
@DataProvider
public
Iterator
<
Object
[]>
provideMethod
(
Method
method
)
{
...
...
@@ -151,22 +153,60 @@ public class 新集卡_开奖流程_DuibaTest extends DuibaTestBase {
}
//
@Test
@Test
public
void
集卡开奖
_
直接出奖
_
奖品库存不足
()
throws
Exception
{
String
activityId
=
"
2718
"
;
String
collectRuleId
=
"
4444
"
;
Integer
uid
=
3835
;
String
consumerId
=
"100
090009
"
;
String
activityId
=
"
3610
"
;
String
collectRuleId
=
"
5182
"
;
Integer
uid
=
6921
;
String
consumerId
=
"100
144018
"
;
Response
playReasponse
=
this
.
playPlugin
(
activityId
,
collectRuleId
,
uid
);
playReasponse
.
prettyPrint
();
// Response playReasponse = this.playPlugin(activityId, collectRuleId, uid);
// 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 {
String
orderId
=
null
;
if
(
type
.
equals
(
"nomal"
)){
orderId
=
openResponse
.
jsonPath
().
getString
(
"orderId"
);
nomalOrderId
=
orderId
;
}
else
if
(
type
.
equals
(
"plugin"
)){
orderId
=
openResponse
.
jsonPath
().
getString
(
"orderId.orderNum"
);
orderNum
=
orderId
;
...
...
src/test/java/http/cases/NewCollectActivityTest/新集卡_插件开奖异常返卡_DuibaTest.java
0 → 100644
View file @
06e40ed4
/**
* Copyright (C), 2015-2019
* FileName: 新集卡_插件开奖异常返卡_DuibaTest
* Author: qianwenjun
* Date: 2019/3/20 14:12
* Description:
*/
package
http
.
cases
.
NewCollectActivityTest
;
import
base.DuibaBase
;
import
base.DuibaLog
;
import
base.DuibaTestBase
;
import
http.model.CollectGoodsInfo
;
import
http.service.Activity.NewCollectActivityService
;
import
http.service.Manager.GetManagerInfoService
;
import
io.restassured.response.Response
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.testng.Assert
;
import
org.testng.annotations.DataProvider
;
import
org.testng.annotations.Test
;
import
utils.ExcelDataProvider
;
import
java.lang.reflect.Method
;
import
java.util.Iterator
;
import
java.util.List
;
import
java.util.Map
;
/**
* 〈〉
*
* @author qianwenjun
* @create 2019/3/20
* @since 1.0.0
*/
public
class
新集卡
_
插件开奖异常返卡
_DuibaTest
extends
DuibaTestBase
{
@Autowired
NewCollectActivityService
newCollectActivityService
;
@Autowired
GetManagerInfoService
getManagerInfoService
;
private
static
DuibaLog
logger
=
DuibaLog
.
getLogger
();
String
orderNum
=
null
;
@DataProvider
public
Iterator
<
Object
[]>
provideMethod
(
Method
method
)
{
Iterator
<
Object
[]>
result
=
null
;
if
(
method
.
getName
().
equals
(
"插件出奖_异常返卡测试"
)){
result
=
new
ExcelDataProvider
(
"duiba/新集卡_插件出奖异常返卡"
);
}
return
result
;
}
@Test
(
dataProvider
=
"provideMethod"
)
public
void
插件出奖
_
异常返卡测试
(
Map
<
String
,
String
>
data
)
throws
Exception
{
String
casenum
=
data
.
get
(
"casenum"
);
String
activityId
=
data
.
get
(
"activityId"
);
String
collectRuleId
=
data
.
get
(
"collectRuleId"
);
Integer
uid
=
Integer
.
valueOf
(
data
.
get
(
"uid"
));
String
consumerId
=
data
.
get
(
"consumerId"
);
String
itemId
=
data
.
get
(
"itemId"
);
String
prizeLevel
=
data
.
get
(
"prizeLevel"
);
String
afterPrizeLevel
=
data
.
get
(
"afterPrizeLevel"
);
String
clickFlag
=
data
.
get
(
"clickFlag"
);
String
afterClickFlag
=
data
.
get
(
"afterClickFlag"
);
String
prizeType
=
data
.
get
(
"type"
);
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
(
itemId
)){
count
=
Integer
.
valueOf
(
info
.
getCount
());
logger
.
info
(
"用户卡片itemId="
+
itemId
+
"的数量为:"
+
count
);
break
;
}
}
Assert
.
assertEquals
(
collectGoodsInfo
.
jsonPath
().
getString
(
"prizeLevel"
),
prizeLevel
,
"集卡信息接口可开奖prizeLevel字段校验失败"
);
Assert
.
assertEquals
(
collectGoodsInfo
.
jsonPath
().
getString
(
"clickFlag"
),
clickFlag
,
"是否可点击开奖clickFlag校验失败"
);
logger
.
info
(
"获取集卡信息接口成功"
);
logger
.
info
(
"prizeLevel="
+
collectGoodsInfo
.
jsonPath
().
getString
(
"prizeLevel"
)+
"可开奖"
);
Response
openPrizeResponse
=
this
.
openPrize
(
collectRuleId
,
uid
,
"plugin"
);
openPrizeResponse
.
prettyPrint
();
Assert
.
assertEquals
(
openPrizeResponse
.
jsonPath
().
getString
(
"result"
),
"1"
,
"校验开奖接口失败"
);
Assert
.
assertEquals
(
openPrizeResponse
.
jsonPath
().
getString
(
"lottery.type"
),
prizeType
,
"校验开奖类型object失败"
);
logger
.
info
(
"校验开奖成功,开奖的奖项类型为:"
+
openPrizeResponse
.
jsonPath
().
getString
(
"lottery.type"
));
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
(
itemId
)){
afterCount
=
Integer
.
valueOf
(
info
.
getCount
());
Assert
.
assertEquals
(
count
,
afterCount
);
logger
.
info
(
"用户卡片itemId="
+
itemId
+
"的数量为:"
+
count
);
logger
.
info
(
"校验卡片返回成功"
);
break
;
}
}
Assert
.
assertEquals
(
afterCollectGoodsInfo
.
jsonPath
().
getString
(
"prizeLevel"
),
afterPrizeLevel
,
"集卡信息接口可开奖prizeLevel字段校验失败"
);
Assert
.
assertEquals
(
afterCollectGoodsInfo
.
jsonPath
().
getString
(
"clickFlag"
),
afterClickFlag
,
"是否可点击开奖clickFlag校验失败"
);
}
@Test
public
void
集卡开奖
_
单接口调试
()
throws
Exception
{
//手动开奖——开
String
activityId
=
"2741"
;
String
collectRuleId
=
"5182"
;
Integer
uid
=
6921
;
String
consumerId
=
"100091476"
;
String
count
=
"1"
;
String
afterCount
=
"0"
;
String
prizeLevel
=
"4"
;
String
afterPrizeLevel
=
"0"
;
String
clickFlag
=
"true"
;
String
afterClickFlag
=
"false"
;
String
prizeType
=
"thanks"
;
String
openResult
=
"2"
;
this
.
playPlugin
(
"3610"
,
"5182"
,
6921
);
consumerId
=
"100143586"
;
Response
collectGoodsInfo
=
newCollectActivityService
.
getCollectGoodsInfo
(
collectRuleId
,
uid
);
collectGoodsInfo
.
prettyPrint
();
Assert
.
assertEquals
(
collectGoodsInfo
.
jsonPath
().
getString
(
"prizeLevel"
),
prizeLevel
,
"集卡信息接口可开奖prizeLevel字段校验失败"
);
Assert
.
assertEquals
(
collectGoodsInfo
.
jsonPath
().
getString
(
"clickFlag"
),
clickFlag
,
"是否可点击开奖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"),"1","校验开奖接口失败");
// Assert.assertEquals(openPrizeResponse.jsonPath().getString("lottery.type"),prizeType,"校验开奖类型object失败");
logger
.
info
(
"校验开奖成功,开奖的奖项类型为:"
+
openPrizeResponse
.
jsonPath
().
getString
(
"lottery.type"
));
Response
afterCollectGoodsInfo
=
newCollectActivityService
.
getCollectGoodsInfo
(
collectRuleId
,
uid
);
afterCollectGoodsInfo
.
prettyPrint
();
}
public
Response
playPlugin
(
String
activityId
,
String
collectRuleId
,
int
uid
)
throws
Exception
{
Response
response
=
newCollectActivityService
.
doJoinPlugdraw
(
activityId
,
collectRuleId
,
uid
);
String
orderId
=
response
.
jsonPath
().
getString
(
"orderId"
);
response
=
newCollectActivityService
.
getOrderStatusPlugdraw
(
orderId
,
uid
);
String
result
=
String
.
valueOf
(
response
.
jsonPath
().
getString
(
"result"
));
int
i
=
30
;
while
(
i
>
0
&&(
result
.
equals
(
"0"
))){
Thread
.
sleep
(
1000
);
response
=
newCollectActivityService
.
getOrderStatusPlugdraw
(
orderId
,
uid
);
result
=
String
.
valueOf
(
response
.
jsonPath
().
getString
(
"result"
));
i
--;
}
return
response
;
}
public
Response
openPrize
(
String
collectRuleId
,
Integer
uid
,
String
type
)
throws
Exception
{
Response
openResponse
=
newCollectActivityService
.
openCollectGoodsPrize
(
collectRuleId
,
uid
);
openResponse
.
prettyPrint
();
String
orderId
=
null
;
if
(
type
.
equals
(
"nomal"
)){
orderId
=
openResponse
.
jsonPath
().
getString
(
"orderId"
);
}
else
if
(
type
.
equals
(
"plugin"
)){
orderId
=
openResponse
.
jsonPath
().
getString
(
"orderId.orderNum"
);
orderNum
=
orderId
;
}
Response
statusResponse
=
newCollectActivityService
.
getOpenOrderStatus
(
orderId
,
uid
);
String
playResult
=
String
.
valueOf
(
statusResponse
.
jsonPath
().
getString
(
"result"
));
int
i
=
16
;
while
(
i
>
0
&&
(
playResult
.
equals
(
"0"
)))
{
Thread
.
sleep
(
1000
);
statusResponse
=
newCollectActivityService
.
getOpenOrderStatus
(
orderId
,
uid
);
playResult
=
String
.
valueOf
(
statusResponse
.
jsonPath
().
getString
(
"result"
));
i
--;
}
return
statusResponse
;
}
}
\ No newline at end of file
src/test/java/http/service/app/gawService.java
View file @
06e40ed4
...
...
@@ -11,7 +11,9 @@ import org.springframework.beans.factory.annotation.Value;
import
org.springframework.stereotype.Service
;
import
org.testng.Assert
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
static
io
.
restassured
.
RestAssured
.
given
;
...
...
@@ -28,15 +30,24 @@ public class gawService {
//普通实物兑换接口
public
Response
objectExchange
(
int
uid
,
String
appItemId
,
String
itemId
)
throws
Exception
{
public
Response
objectExchange
(
int
uid
,
int
appItemId
,
int
itemId
)
throws
Exception
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
Map
<
String
,
Object
>
mapList
=
new
HashMap
<>();
List
<
Map
>
list
=
new
ArrayList
<>();
mapList
.
put
(
"itemId"
,
itemId
);
mapList
.
put
(
"skuId"
,
16
);
mapList
.
put
(
"appItemId"
,
appItemId
);
mapList
.
put
(
"credits"
,
"100"
);
mapList
.
put
(
"price"
,
0
);
list
.
add
(
mapList
);
map
.
put
(
"remark"
,
""
);
//买家留言
map
.
put
(
"degreeId"
,
""
);
map
.
put
(
"actualPrice"
,
"0"
);
//总金额
map
.
put
(
"actualCredits"
,
"100"
);
//总积分
map
.
put
(
"itemParam"
,
"[{\"itemId\":"
+
itemId
+
",\"skuId\":16,\"appItemId\":"
+
appItemId
+
",\"credits\":\"100\",\"price\":0}]"
);
map
.
put
(
"itemParam"
,
list
.
toArray
()
);
map
.
put
(
"payType"
,
"3"
);
map
.
put
(
"expressPrice"
,
"0"
);
map
.
put
(
"validate"
,
""
);
...
...
@@ -46,6 +57,9 @@ public class gawService {
logger
.
info
(
"请求实物兑换接口:"
+
"/gaw/objectExchange/create"
);
Response
response
=
given
().
contentType
(
"application/json; charset=UTF-8"
).
cookies
(
authorization
.
dafuwengLogin
(
uid
)).
body
(
jsonParam
).
post
(
"http://"
+
goodsHost
+
"/gaw/objectExchange/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");
response
.
prettyPrint
();
try
{
...
...
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