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
ce9988ca
Commit
ce9988ca
authored
Jul 11, 2019
by
吕雯燕
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lv
parent
ffe2f9b7
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
102 additions
and
65 deletions
+102
-65
兑吧新实物_兑换流程测试_ExchangeTest.java
...va/http/cases/ExchangeTest/兑吧新实物_兑换流程测试_ExchangeTest.java
+3
-1
自有新实物_兑换流程测试_ExchangeTest.java
...ses/ExchangeTest/自有_商品兑换限制/自有新实物_兑换流程测试_ExchangeTest.java
+38
-6
gawService.java
src/test/java/http/service/app/gawService.java
+61
-58
No files found.
src/test/java/http/cases/ExchangeTest/兑吧新实物_兑换流程测试_ExchangeTest.java
View file @
ce9988ca
...
...
@@ -466,9 +466,11 @@ public class 兑吧新实物_兑换流程测试_ExchangeTest extends CheckTemple
logger
.
info
(
"校验新实物确认下单页正确"
);
}
}
...
...
src/test/java/http/cases/ExchangeTest/自有_商品兑换限制/自有新实物_兑换流程测试_ExchangeTest.java
View file @
ce9988ca
...
...
@@ -61,7 +61,7 @@ public class 自有新实物_兑换流程测试_ExchangeTest extends CheckTemple
}
}
@Test
(
description
=
"
兑吧
新自有实物每人限购---每天限制"
)
@Test
(
description
=
"新自有实物每人限购---每天限制"
)
public
void
每人限购每天限购限制
()
throws
Exception
{
String
appItemId
=
"193752"
;
String
itemId
=
"null"
;
...
...
@@ -115,7 +115,7 @@ public class 自有新实物_兑换流程测试_ExchangeTest extends CheckTemple
}
}
@Test
(
description
=
"
兑吧
新自有实物每人限购---永久限制"
)
@Test
(
description
=
"新自有实物每人限购---永久限制"
)
public
void
每人限购永久限购限制
()
throws
Exception
{
String
appItemId
=
"193802"
;
String
itemId
=
"null"
;
...
...
@@ -169,7 +169,7 @@ public class 自有新实物_兑换流程测试_ExchangeTest extends CheckTemple
}
}
@Test
(
description
=
"
兑吧
新自有实物每人限购---周期限制"
)
@Test
(
description
=
"新自有实物每人限购---周期限制"
)
public
void
每人限购周期限制
()
throws
Exception
{
String
appItemId
=
"193803"
;
String
itemId
=
"null"
;
...
...
@@ -221,7 +221,7 @@ public class 自有新实物_兑换流程测试_ExchangeTest extends CheckTemple
}
@Test
(
description
=
"
兑吧
新自有实物每日限量"
)
@Test
(
description
=
"新自有实物每日限量"
)
public
void
每日限量限制
()
throws
Exception
{
String
appItemId
=
"193804"
;
String
itemId
=
"null"
;
...
...
@@ -321,7 +321,7 @@ public class 自有新实物_兑换流程测试_ExchangeTest extends CheckTemple
}
@Test
(
description
=
"
兑吧
新自有实物--库存限制"
)
@Test
(
description
=
"新自有实物--库存限制"
)
public
void
库存限制
()
throws
Exception
{
String
appItemId
=
"193811"
;
String
itemId
=
"null"
;
...
...
@@ -356,7 +356,7 @@ public class 自有新实物_兑换流程测试_ExchangeTest extends CheckTemple
@Test
(
description
=
"
兑吧
新自有实物会员兑换限制"
)
@Test
(
description
=
"新自有实物会员兑换限制"
)
public
void
会员兑换限制
()
throws
Exception
{
String
appItemId
=
"193810"
;
String
itemId
=
"null"
;
...
...
@@ -381,6 +381,36 @@ public class 自有新实物_兑换流程测试_ExchangeTest extends CheckTemple
}
@Test
(
description
=
"新自有实物用户id修改测试"
)
public
void
实物用户
id
篡改测试
()
throws
Exception
{
//uid: 大富翁app
//商品: lv测试应用55
int
uid
=
7204
;
String
appItemId
=
"197041"
;
String
itemId
=
null
;
String
message
=
""
;
//实物兑换
try
{
Response
response
=
gawService
.
objectExchange
(
uid
,
appItemId
,
itemId
);
response
.
prettyPrint
();
}
catch
(
Exception
e
){
message
=
e
.
toString
();
}
logger
.
info
(
message
);
Assert
.
assertTrue
(
message
.
contains
(
"\"desc\":\"无权访问\""
),
"校验message失败"
);
Assert
.
assertTrue
(
message
.
contains
(
"\"success\":false"
),
"校验success失败"
);
logger
.
info
(
"校验实物用户id篡改无法兑换成功"
);
}
//测试使用
//@Test(enabled=true, dataProvider="testdp", threadPoolSize=1, invocationCount=100)
@DataProvider
(
name
=
"testdp"
,
parallel
=
true
)
...
...
@@ -399,6 +429,8 @@ public class 自有新实物_兑换流程测试_ExchangeTest extends CheckTemple
};
}
// @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);
...
...
src/test/java/http/service/app/gawService.java
View file @
ce9988ca
...
...
@@ -123,15 +123,17 @@ public class gawService {
}
//优惠券兑换接口
public
Response
couponExchange
(
int
uid
,
String
appItemId
,
int
skuId
)
throws
Exception
{
//普通自有新实物兑换接口
public
Response
objectExchange
(
int
uid
,
String
appItemId
,
String
itemId
,
String
skuId
,
String
credits
,
String
actualCredits
)
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"
,
skuId
);
mapList
.
put
(
"appItemId"
,
appItemId
);
mapList
.
put
(
"credits"
,
"100"
);
mapList
.
put
(
"credits"
,
credits
);
mapList
.
put
(
"price"
,
0
);
list
.
add
(
mapList
);
...
...
@@ -139,7 +141,7 @@ public class gawService {
map
.
put
(
"remark"
,
""
);
//买家留言
map
.
put
(
"degreeId"
,
""
);
map
.
put
(
"actualPrice"
,
"0"
);
//总金额
map
.
put
(
"actualCredits"
,
"100"
);
//总积分
map
.
put
(
"actualCredits"
,
actualCredits
);
//总积分
map
.
put
(
"itemParam"
,
list
.
toArray
());
map
.
put
(
"payType"
,
"3"
);
map
.
put
(
"expressPrice"
,
"0"
);
...
...
@@ -148,8 +150,8 @@ public class gawService {
JSONObject
jsonParam
=
JSONObject
.
parseObject
(
JSON
.
toJSONString
(
map
));
logger
.
info
(
"请求实物兑换接口:"
+
"/gaw/
coupon
Exchange/create"
);
Response
response
=
given
().
contentType
(
"application/json; charset=UTF-8"
).
cookies
(
authorization
.
dafuwengLogin
(
uid
)).
body
(
jsonParam
).
post
(
"http://"
+
goodsHost
+
"/gaw/
coupon
Exchange/create"
);
logger
.
info
(
"请求实物兑换接口:"
+
"/gaw/
object
Exchange/create"
);
Response
response
=
given
().
contentType
(
"application/json; charset=UTF-8"
).
cookies
(
authorization
.
dafuwengLogin
(
uid
)).
body
(
jsonParam
).
post
(
"http://"
+
goodsHost
+
"/gaw/
object
Exchange/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");
...
...
@@ -165,16 +167,42 @@ public class gawService {
}
return
response
;
}
//实物确认下单
public
Response
confirmItemDetail
(
int
uid
,
String
appItemId
,
String
appSkuId
)
throws
Exception
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"degreeId"
,
""
);
map
.
put
(
"appItemId"
,
appItemId
);
map
.
put
(
"payType"
,
3
);
map
.
put
(
"appSkuId"
,
appSkuId
);
map
.
put
(
"vipFlag"
,
false
);
logger
.
info
(
"请求确认下单页接口:"
+
"/gaw/h5/confirmItemDetail"
);
Response
response
=
given
().
contentType
(
"application/json; charset=UTF-8"
).
cookies
(
authorization
.
dafuwengLogin
(
uid
)).
params
(
map
).
get
(
"http://"
+
goodsHost
+
"/gaw/h5/confirmItemDetail"
);
try
{
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"success"
),
"true"
);
}
catch
(
Exception
e
){
throw
new
Exception
(
"/gaw/h5/confirmItemDetail接口返回异常,返回信息:"
+
response
.
asString
());
}
catch
(
Error
er
){
throw
new
Exception
(
"/gaw/h5/confirmItemDetail接口返回异常,返回信息:"
+
response
.
asString
());
}
return
response
;
}
//优惠券兑换
public
Response
couponExchange
(
Map
cookies
,
String
appItemId
,
String
itemId
,
String
skuId
)
throws
Exception
{
//优惠券兑换接口
public
Response
couponExchange
(
int
uid
,
String
appItemId
,
int
skuId
)
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"
,
skuId
);
mapList
.
put
(
"appItemId"
,
appItemId
);
mapList
.
put
(
"credits"
,
"100"
);
...
...
@@ -183,38 +211,44 @@ public class gawService {
map
.
put
(
"remark"
,
""
);
//买家留言
map
.
put
(
"degreeId"
,
""
);
map
.
put
(
"actualPrice"
,
"0"
);
//总金额
map
.
put
(
"actualCredits"
,
"100"
);
//总积分
map
.
put
(
"itemParam"
,
list
.
toArray
());
map
.
put
(
"payType"
,
"3"
);
map
.
put
(
"expressPrice"
,
"0"
);
map
.
put
(
"validate"
,
""
);
map
.
put
(
"token"
,
"yrJRr7Cddp2YeQd"
);
JSONObject
jsonParam
=
JSONObject
.
parseObject
(
JSON
.
toJSONString
(
map
));
logger
.
info
(
"请求实物兑换接口:"
+
"/gaw/couponExchange/create"
);
Response
response
=
given
().
contentType
(
"application/json; charset=UTF-8"
).
cookies
(
cookies
).
body
(
jsonParam
).
post
(
"http://"
+
goodsHost
+
"/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");
// response.prettyPrint();
try
{
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"success"
),
"true"
);
}
catch
(
Exception
e
){
throw
new
Exception
(
"/gaw/
coupon
Exchange/create接口返回异常,返回信息:"
+
response
.
asString
());
throw
new
Exception
(
"/gaw/
object
Exchange/create接口返回异常,返回信息:"
+
response
.
asString
());
}
catch
(
Error
er
){
throw
new
Exception
(
"/gaw/
coupon
Exchange/create接口返回异常,返回信息:"
+
response
.
asString
());
throw
new
Exception
(
"/gaw/
object
Exchange/create接口返回异常,返回信息:"
+
response
.
asString
());
}
return
response
;
}
//优惠券兑换
接口
public
Response
couponExchange
(
Map
cookie
,
String
appItemId
,
int
skuId
)
throws
Exception
{
//优惠券兑换
public
Response
couponExchange
(
Map
cookie
s
,
String
appItemId
,
String
itemId
,
String
skuId
)
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"
,
skuId
);
mapList
.
put
(
"appItemId"
,
appItemId
);
mapList
.
put
(
"credits"
,
"100"
);
...
...
@@ -223,39 +257,34 @@ public class gawService {
map
.
put
(
"remark"
,
""
);
//买家留言
map
.
put
(
"degreeId"
,
""
);
map
.
put
(
"actualPrice"
,
"0"
);
//总金额
map
.
put
(
"actualCredits"
,
"100"
);
//总积分
map
.
put
(
"itemParam"
,
list
.
toArray
());
map
.
put
(
"payType"
,
"3"
);
map
.
put
(
"expressPrice"
,
"0"
);
map
.
put
(
"validate"
,
""
);
map
.
put
(
"token"
,
"yrJRr7Cddp2YeQd"
);
JSONObject
jsonParam
=
JSONObject
.
parseObject
(
JSON
.
toJSONString
(
map
));
logger
.
info
(
"请求实物兑换接口:"
+
"/gaw/couponExchange/create"
);
Response
response
=
given
().
contentType
(
"application/json; charset=UTF-8"
).
cookies
(
cookie
).
body
(
jsonParam
).
post
(
"http://"
+
goodsHost
+
"/gaw/couponExchange/create"
);
Response
response
=
given
().
contentType
(
"application/json; charset=UTF-8"
).
cookies
(
cookie
s
).
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");
// response.prettyPrint();
try
{
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"success"
),
"true"
);
}
catch
(
Exception
e
){
throw
new
Exception
(
"/gaw/
object
Exchange/create接口返回异常,返回信息:"
+
response
.
asString
());
throw
new
Exception
(
"/gaw/
coupon
Exchange/create接口返回异常,返回信息:"
+
response
.
asString
());
}
catch
(
Error
er
){
throw
new
Exception
(
"/gaw/
object
Exchange/create接口返回异常,返回信息:"
+
response
.
asString
());
throw
new
Exception
(
"/gaw/
coupon
Exchange/create接口返回异常,返回信息:"
+
response
.
asString
());
}
return
response
;
}
//
虚拟商品
兑换接口
public
Response
virtual
Exchange
(
Map
cookie
,
String
appItemId
,
int
skuId
)
throws
Exception
{
//
优惠券
兑换接口
public
Response
coupon
Exchange
(
Map
cookie
,
String
appItemId
,
int
skuId
)
throws
Exception
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
Map
<
String
,
Object
>
mapList
=
new
HashMap
<>();
...
...
@@ -280,7 +309,7 @@ public class gawService {
JSONObject
jsonParam
=
JSONObject
.
parseObject
(
JSON
.
toJSONString
(
map
));
logger
.
info
(
"请求实物兑换接口:"
+
"/gaw/couponExchange/create"
);
Response
response
=
given
().
contentType
(
"application/json; charset=UTF-8"
).
cookies
(
cookie
).
body
(
jsonParam
).
post
(
"http://"
+
goodsHost
+
"/gaw/
virtual
Exchange/create"
);
Response
response
=
given
().
contentType
(
"application/json; charset=UTF-8"
).
cookies
(
cookie
).
body
(
jsonParam
).
post
(
"http://"
+
goodsHost
+
"/gaw/
coupon
Exchange/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");
...
...
@@ -299,17 +328,15 @@ public class gawService {
}
//普通自有新实物兑换接口
public
Response
objectExchange
(
int
uid
,
String
appItemId
,
String
itemId
,
String
skuId
,
String
credits
,
String
actualCredits
)
throws
Exception
{
//虚拟商品兑换接口
public
Response
virtualExchange
(
Map
cookie
,
String
appItemId
,
int
skuId
)
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"
,
skuId
);
mapList
.
put
(
"appItemId"
,
appItemId
);
mapList
.
put
(
"credits"
,
credits
);
mapList
.
put
(
"credits"
,
"100"
);
mapList
.
put
(
"price"
,
0
);
list
.
add
(
mapList
);
...
...
@@ -317,7 +344,7 @@ public class gawService {
map
.
put
(
"remark"
,
""
);
//买家留言
map
.
put
(
"degreeId"
,
""
);
map
.
put
(
"actualPrice"
,
"0"
);
//总金额
map
.
put
(
"actualCredits"
,
actualCredits
);
//总积分
map
.
put
(
"actualCredits"
,
"100"
);
//总积分
map
.
put
(
"itemParam"
,
list
.
toArray
());
map
.
put
(
"payType"
,
"3"
);
map
.
put
(
"expressPrice"
,
"0"
);
...
...
@@ -326,8 +353,8 @@ public class gawService {
JSONObject
jsonParam
=
JSONObject
.
parseObject
(
JSON
.
toJSONString
(
map
));
logger
.
info
(
"请求实物兑换接口:"
+
"/gaw/
object
Exchange/create"
);
Response
response
=
given
().
contentType
(
"application/json; charset=UTF-8"
).
cookies
(
authorization
.
dafuwengLogin
(
uid
)).
body
(
jsonParam
).
post
(
"http://"
+
goodsHost
+
"/gaw/object
Exchange/create"
);
logger
.
info
(
"请求实物兑换接口:"
+
"/gaw/
coupon
Exchange/create"
);
Response
response
=
given
().
contentType
(
"application/json; charset=UTF-8"
).
cookies
(
cookie
).
body
(
jsonParam
).
post
(
"http://"
+
goodsHost
+
"/gaw/virtual
Exchange/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");
...
...
@@ -343,6 +370,7 @@ public class gawService {
}
return
response
;
}
...
...
@@ -578,30 +606,5 @@ public class gawService {
}
//实物确认下单
public
Response
confirmItemDetail
(
int
uid
,
String
appItemId
,
String
appSkuId
)
throws
Exception
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"degreeId"
,
""
);
map
.
put
(
"appItemId"
,
appItemId
);
map
.
put
(
"payType"
,
3
);
map
.
put
(
"appSkuId"
,
appSkuId
);
map
.
put
(
"vipFlag"
,
false
);
logger
.
info
(
"请求确认下单页接口:"
+
"/gaw/h5/confirmItemDetail"
);
Response
response
=
given
().
contentType
(
"application/json; charset=UTF-8"
).
cookies
(
authorization
.
dafuwengLogin
(
uid
)).
params
(
map
).
get
(
"http://"
+
goodsHost
+
"/gaw/h5/confirmItemDetail"
);
try
{
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"success"
),
"true"
);
}
catch
(
Exception
e
){
throw
new
Exception
(
"/gaw/h5/confirmItemDetail接口返回异常,返回信息:"
+
response
.
asString
());
}
catch
(
Error
er
){
throw
new
Exception
(
"/gaw/h5/confirmItemDetail接口返回异常,返回信息:"
+
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