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
9fd3d239
Commit
9fd3d239
authored
Jul 18, 2019
by
马博
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master'
parents
1c8cea36
7d9b4b97
Changes
16
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
845 additions
and
113 deletions
+845
-113
Database.java
src/test/java/http/cases/ExchangeTest/Database.java
+6
-3
新Qb_兑换流程测试_ExchangeTest.java
...ases/ExchangeTest/兑吧_直充类商品兑换/新Qb_兑换流程测试_ExchangeTest.java
+83
-1
新多档位话费_兑换流程测试_ExchangeTest.java
...s/ExchangeTest/兑吧_直充类商品兑换/新多档位话费_兑换流程测试_ExchangeTest.java
+81
-0
新支付宝_兑换流程测试_ExchangeTest.java
...ses/ExchangeTest/兑吧_直充类商品兑换/新支付宝_兑换流程测试_ExchangeTest.java
+50
-0
兑吧卡密_兑换流程测试_ExchangeTest.java
...ava/http/cases/ExchangeTest/兑吧卡密_兑换流程测试_ExchangeTest.java
+58
-0
兑吧新优惠券_兑换流程测试_ExchangeTest.java
...a/http/cases/ExchangeTest/兑吧新优惠券_兑换流程测试_ExchangeTest.java
+57
-0
兑吧新实物_兑换流程测试_ExchangeTest.java
...va/http/cases/ExchangeTest/兑吧新实物_兑换流程测试_ExchangeTest.java
+74
-30
兑吧老优惠券_兑换流程测试_ExchangeTest.java
...a/http/cases/ExchangeTest/兑吧老优惠券_兑换流程测试_ExchangeTest.java
+1
-2
自有新优惠券_兑换限制测试_ExchangeTest.java
...es/ExchangeTest/自有_商品兑换限制/自有新优惠券_兑换限制测试_ExchangeTest.java
+54
-0
自有新卡密_兑换限制测试_ExchangeTest.java
...ses/ExchangeTest/自有_商品兑换限制/自有新卡密_兑换限制测试_ExchangeTest.java
+52
-0
自有新实物_兑换流程测试_ExchangeTest.java
...ses/ExchangeTest/自有_商品兑换限制/自有新实物_兑换流程测试_ExchangeTest.java
+135
-14
自有新虚拟商品_充值_兑换限制_ExchangeTest.java
.../ExchangeTest/自有_商品兑换限制/自有新虚拟商品_充值_兑换限制_ExchangeTest.java
+57
-0
秒杀商品_自有新优惠券_兑换限制_SeckillTest.java
...p/cases/SeckillTest/新秒杀/秒杀商品_自有新优惠券_兑换限制_SeckillTest.java
+2
-2
商品分组组件_DuibaTest.java
...st/java/http/cases/VisualEditorTest/商品分组组件_DuibaTest.java
+71
-1
gawService.java
src/test/java/http/service/app/gawService.java
+63
-60
RedisUtil.java
src/test/java/utils/RedisUtil.java
+1
-0
No files found.
src/test/java/http/cases/ExchangeTest/Database.java
View file @
9fd3d239
...
@@ -5,18 +5,21 @@ public class Database {
...
@@ -5,18 +5,21 @@ public class Database {
//主订单库
//主订单库
public
static
String
orders_consumer
=
"orders_consumer"
;
public
static
String
orders_consumer
=
"orders_consumer"
;
//主订单分表
//主订单分表
public
static
String
orders
=
"orders_0614"
;
public
static
String
orders2
=
"orders_0874"
;
public
static
String
orders2
=
"orders_0874"
;
public
static
String
orders3
=
"orders_0693"
;
public
static
String
orders3
=
"orders_0693"
;
public
static
String
orders4
=
"orders_0208"
;
public
static
String
orders5
=
"orders_0209"
;
public
static
String
orders5
=
"orders_0209"
;
public
static
String
orders6
=
"orders_0210"
;
public
static
String
orders6
=
"orders_0210"
;
public
static
String
orders7
=
"orders_0211"
;
public
static
String
orders8
=
"orders_0090"
;
public
static
String
orders8
=
"orders_0090"
;
public
static
String
orders9
=
"orders_0203"
;
public
static
String
orders9
=
"orders_0203"
;
public
static
String
orders10
=
"orders_0411"
;
public
static
String
orders10
=
"orders_0411"
;
public
static
String
orders11
=
"orders_0182"
;
public
static
String
orders11
=
"orders_0182"
;
public
static
String
orders12
=
"orders_0715"
;
public
static
String
orders12
=
"orders_0715"
;
public
static
String
orders13
=
"orders_0717"
;
public
static
String
orders14
=
"orders_0712"
;
public
static
String
orders15
=
"orders_0718"
;
public
static
String
orders16
=
"orders_0721"
;
...
...
src/test/java/http/cases/ExchangeTest/兑吧_直充类商品兑换/新Qb_兑换流程测试_ExchangeTest.java
View file @
9fd3d239
package
http
.
cases
.
ExchangeTest
.
兑吧
_
直充类商品兑换
;
package
http
.
cases
.
ExchangeTest
.
兑吧
_
直充类商品兑换
;
import
http.cases.ExchangeTest.CheckTemplet
;
import
http.cases.ExchangeTest.CheckTemplet
;
import
http.cases.ExchangeTest.Database
;
import
http.service.Authorization
;
import
http.service.Authorization
;
import
http.service.app.gawService
;
import
http.service.app.gawService
;
import
http.service.app.MobileService
;
import
http.service.app.MobileService
;
...
@@ -146,6 +147,7 @@ public class 新Qb_兑换流程测试_ExchangeTest extends CheckTemplet {
...
@@ -146,6 +147,7 @@ public class 新Qb_兑换流程测试_ExchangeTest extends CheckTemplet {
}
}
@Test
(
description
=
"3个Q币用户兑换限制每月1次"
)
@Test
(
description
=
"3个Q币用户兑换限制每月1次"
)
public
void
Q
币用户每月兑换限制测试
()
throws
Exception
{
public
void
Q
币用户每月兑换限制测试
()
throws
Exception
{
...
@@ -164,7 +166,7 @@ public class 新Qb_兑换流程测试_ExchangeTest extends CheckTemplet {
...
@@ -164,7 +166,7 @@ public class 新Qb_兑换流程测试_ExchangeTest extends CheckTemplet {
logger
.
info
(
"用户成功兑换一次"
);
logger
.
info
(
"用户成功兑换一次"
);
//再次兑换
//再次兑换
Thread
.
sleep
(
3
000
);
Thread
.
sleep
(
4
000
);
try
{
try
{
response
=
gawService
.
qbExchange
(
uid
,
actualCredits
,
degreeId
,
appItemId
,
credits
,
"123456789"
);
response
=
gawService
.
qbExchange
(
uid
,
actualCredits
,
degreeId
,
appItemId
,
credits
,
"123456789"
);
response
.
prettyPrint
();
response
.
prettyPrint
();
...
@@ -242,6 +244,86 @@ public class 新Qb_兑换流程测试_ExchangeTest extends CheckTemplet {
...
@@ -242,6 +244,86 @@ public class 新Qb_兑换流程测试_ExchangeTest extends CheckTemplet {
}
}
@Test
(
description
=
"Q币档位篡改测试"
)
public
void
Q
币档位篡改测试
()
throws
Exception
{
int
uid
=
7293
;
String
actualCredits
=
"3"
;
String
degreeId
=
"100"
;
String
appItemId
=
"196922"
;
String
credits
=
"3"
;
String
qq
=
"806854056"
;
String
message
=
""
;
//Q币兑换,档位参数不存在
try
{
Response
response
=
gawService
.
qbExchange
(
uid
,
actualCredits
,
degreeId
,
appItemId
,
credits
,
qq
);
response
.
prettyPrint
();
}
catch
(
Exception
e
){
message
=
e
.
toString
();
}
logger
.
info
(
message
);
Assert
.
assertTrue
(
message
.
contains
(
"\"success\":false"
),
"校验message失败"
);
Assert
.
assertTrue
(
message
.
contains
(
"\"desc\":\"档位不存在\""
),
"校验message失败"
);
logger
.
info
(
"校验Q币档位篡改无法兑换成功"
);
}
@Test
(
description
=
"Q币用户id篡改测试"
)
public
void
Q
币用户
id
篡改测试
()
throws
Exception
{
//商品: lv测试应用77
//uid1: 大富翁app
//uid2: lv测试应用88
int
uid1
=
7084
;
int
uid2
=
7292
;
String
actualCredits
=
"3"
;
String
degreeId
=
"3"
;
String
appItemId
=
"196922"
;
String
credits
=
"3"
;
String
qq
=
"806854056"
;
String
message
=
""
;
//话费兑换, 大富翁app已上架Q币
Response
response
=
gawService
.
qbExchange
(
uid1
,
actualCredits
,
degreeId
,
appItemId
,
credits
,
qq
);
response
.
prettyPrint
();
String
orderId
=
response
.
jsonPath
().
getString
(
"data.orderId"
);
//查询数据库
Thread
.
sleep
(
3000
);
Map
<
String
,
Object
>
mapOrderId
=
jdbc
.
findSimpleResult
(
"SELECT * FROM "
+
Database
.
orders_consumer
+
"."
+
Database
.
orders16
+
" where id = "
+
orderId
);
String
orderStatus
=
String
.
valueOf
(
mapOrderId
.
get
(
"status"
));
String
orderappId
=
String
.
valueOf
(
mapOrderId
.
get
(
"app_id"
));
String
orderCredits
=
String
.
valueOf
(
mapOrderId
.
get
(
"credits"
));
logger
.
info
(
"订单积分:"
+
orderCredits
);
Assert
.
assertEquals
(
orderStatus
,
"consume_success"
,
"校验status失败"
);
Assert
.
assertEquals
(
orderappId
,
"1"
,
"校验appId失败"
);
Assert
.
assertEquals
(
orderCredits
,
"300"
,
"校验credits失败"
);
logger
.
info
(
"校验Q币用户id1篡改兑换成功"
);
//Q币兑换,lv测试应用88app未上架Q币
try
{
Response
response2
=
gawService
.
qbExchange
(
uid2
,
actualCredits
,
degreeId
,
appItemId
,
credits
,
qq
);
response2
.
prettyPrint
();
}
catch
(
Exception
e
){
message
=
e
.
toString
();
}
logger
.
info
(
message
);
Assert
.
assertTrue
(
message
.
contains
(
"\"success\":false"
),
"校验message失败"
);
Assert
.
assertTrue
(
message
.
contains
(
"\"desc\":\"兑吧加钱购商品不可以加入到开发者商品中\""
),
"校验message失败"
);
//这个提示很奇怪
logger
.
info
(
"校验Q币用户id2篡改无法兑换成功"
);
}
public
Response
Q
币兑换
(
int
uid
,
String
actualCredits
,
String
degreeId
,
String
appItemId
,
String
credits
,
String
qq
)
throws
Exception
{
public
Response
Q
币兑换
(
int
uid
,
String
actualCredits
,
String
degreeId
,
String
appItemId
,
String
credits
,
String
qq
)
throws
Exception
{
Response
response
=
gawService
.
qbExchange
(
uid
,
actualCredits
,
degreeId
,
appItemId
,
credits
,
qq
);
Response
response
=
gawService
.
qbExchange
(
uid
,
actualCredits
,
degreeId
,
appItemId
,
credits
,
qq
);
...
...
src/test/java/http/cases/ExchangeTest/兑吧_直充类商品兑换/新多档位话费_兑换流程测试_ExchangeTest.java
View file @
9fd3d239
package
http
.
cases
.
ExchangeTest
.
兑吧
_
直充类商品兑换
;
package
http
.
cases
.
ExchangeTest
.
兑吧
_
直充类商品兑换
;
import
http.cases.ExchangeTest.CheckTemplet
;
import
http.cases.ExchangeTest.CheckTemplet
;
import
http.cases.ExchangeTest.Database
;
import
http.service.Authorization
;
import
http.service.Authorization
;
import
http.service.app.gawService
;
import
http.service.app.gawService
;
import
http.service.app.MobileService
;
import
http.service.app.MobileService
;
...
@@ -240,6 +241,86 @@ public class 新多档位话费_兑换流程测试_ExchangeTest extends CheckTem
...
@@ -240,6 +241,86 @@ public class 新多档位话费_兑换流程测试_ExchangeTest extends CheckTem
}
}
@Test
(
description
=
"话费档位篡改测试"
)
public
void
话费档位篡改测试
()
throws
Exception
{
int
uid
=
7268
;
String
actualCredits
=
"2"
;
String
degreeId
=
"100"
;
String
appItemId
=
"196923"
;
String
credits
=
"2"
;
String
message
=
""
;
//话费兑换,档位参数不存在
try
{
Thread
.
sleep
(
3000
);
Response
response
=
gawService
.
phonebillExchange
(
uid
,
actualCredits
,
degreeId
,
appItemId
,
credits
);
response
.
prettyPrint
();
}
catch
(
Exception
e
){
message
=
e
.
toString
();
}
logger
.
info
(
message
);
Assert
.
assertTrue
(
message
.
contains
(
"\"success\":false"
),
"校验message失败"
);
Assert
.
assertTrue
(
message
.
contains
(
"\"desc\":\"档位不存在\""
),
"校验message失败"
);
logger
.
info
(
"校验话费档位篡改无法兑换成功"
);
}
@Test
(
description
=
"话费用户id篡改测试"
)
public
void
话费用户
id
篡改测试
()
throws
Exception
{
//商品: lv测试应用77
//uid1: 大富翁app
//uid2: lv测试应用88
int
uid1
=
7085
;
int
uid2
=
7292
;
String
actualCredits
=
"5"
;
String
degreeId
=
"10"
;
String
appItemId
=
"196923"
;
String
credits
=
"5"
;
String
message
=
""
;
//话费兑换, 大富翁app已上架话费
Response
response
=
gawService
.
phonebillExchange
(
uid1
,
actualCredits
,
degreeId
,
appItemId
,
credits
);
response
.
prettyPrint
();
String
orderId
=
response
.
jsonPath
().
getString
(
"data.orderId"
);
//查询数据库
Thread
.
sleep
(
3000
);
Map
<
String
,
Object
>
mapOrderId
=
jdbc
.
findSimpleResult
(
"SELECT * FROM "
+
Database
.
orders_consumer
+
"."
+
Database
.
orders15
+
" where id = "
+
orderId
);
String
orderStatus
=
String
.
valueOf
(
mapOrderId
.
get
(
"status"
));
String
orderappId
=
String
.
valueOf
(
mapOrderId
.
get
(
"app_id"
));
String
orderCredits
=
String
.
valueOf
(
mapOrderId
.
get
(
"credits"
));
logger
.
info
(
"订单积分:"
+
orderCredits
);
Assert
.
assertEquals
(
orderStatus
,
"consume_success"
,
"校验status失败"
);
Assert
.
assertEquals
(
orderappId
,
"1"
,
"校验appId失败"
);
Assert
.
assertEquals
(
orderCredits
,
"1000"
,
"校验credits失败"
);
logger
.
info
(
"校验话费用户id1篡改兑换成功"
);
//话费兑换,lv测试应用88app未上架话费
try
{
Response
response2
=
gawService
.
phonebillExchange
(
uid2
,
actualCredits
,
degreeId
,
appItemId
,
credits
);
response2
.
prettyPrint
();
}
catch
(
Exception
e
){
message
=
e
.
toString
();
}
logger
.
info
(
message
);
Assert
.
assertTrue
(
message
.
contains
(
"\"success\":false"
),
"校验message失败"
);
Assert
.
assertTrue
(
message
.
contains
(
"\"desc\":\"无权访问\""
),
"校验message失败"
);
logger
.
info
(
"校验话费用户id2篡改无法兑换成功"
);
}
public
Response
话费兑换
(
int
uid
,
String
actualCredits
,
String
degreeId
,
String
appItemId
,
String
credits
)
throws
Exception
{
public
Response
话费兑换
(
int
uid
,
String
actualCredits
,
String
degreeId
,
String
appItemId
,
String
credits
)
throws
Exception
{
Response
response
=
gawService
.
phonebillExchange
(
uid
,
actualCredits
,
degreeId
,
appItemId
,
credits
);
Response
response
=
gawService
.
phonebillExchange
(
uid
,
actualCredits
,
degreeId
,
appItemId
,
credits
);
...
...
src/test/java/http/cases/ExchangeTest/兑吧_直充类商品兑换/新支付宝_兑换流程测试_ExchangeTest.java
View file @
9fd3d239
...
@@ -302,6 +302,56 @@ public class 新支付宝_兑换流程测试_ExchangeTest extends CheckTemplet {
...
@@ -302,6 +302,56 @@ public class 新支付宝_兑换流程测试_ExchangeTest extends CheckTemplet {
}
}
@Test
(
description
=
"支付宝用户id修改测试"
)
public
void
支付宝用户
id
篡改测试
()
throws
Exception
{
//商品: lv测试应用77
//uid1: 大富翁app
//uid2: lv测试应用88
int
uid1
=
7204
;
int
uid2
=
7291
;
String
actualCredits
=
"10"
;
String
degreeId
=
"10"
;
String
appItemId
=
"196921"
;
String
credits
=
"10"
;
String
message
=
""
;
//支付宝兑换, 大富翁app已上架支付宝
Response
response
=
gawService
.
alipayExchange
(
uid1
,
actualCredits
,
degreeId
,
appItemId
,
credits
);
response
.
prettyPrint
();
String
orderId
=
response
.
jsonPath
().
getString
(
"data.orderId"
);
//查询数据库
Thread
.
sleep
(
3000
);
Map
<
String
,
Object
>
mapOrderId
=
jdbc
.
findSimpleResult
(
"SELECT * FROM "
+
Database
.
orders_consumer
+
"."
+
Database
.
orders13
+
" where id = "
+
orderId
);
String
orderStatus
=
String
.
valueOf
(
mapOrderId
.
get
(
"status"
));
String
orderappId
=
String
.
valueOf
(
mapOrderId
.
get
(
"app_id"
));
String
orderCredits
=
String
.
valueOf
(
mapOrderId
.
get
(
"credits"
));
logger
.
info
(
"订单积分:"
+
orderCredits
);
Assert
.
assertEquals
(
orderStatus
,
"consume_success"
,
"校验status失败"
);
Assert
.
assertEquals
(
orderappId
,
"1"
,
"校验appId失败"
);
Assert
.
assertEquals
(
orderCredits
,
"1000"
,
"校验credits失败"
);
logger
.
info
(
"校验支付宝用户id1篡改兑换成功"
);
//支付宝兑换,lv测试应用88app未上架支付宝
try
{
Response
response2
=
gawService
.
alipayExchange
(
uid2
,
actualCredits
,
degreeId
,
appItemId
,
credits
);
response2
.
prettyPrint
();
}
catch
(
Exception
e
){
message
=
e
.
toString
();
}
logger
.
info
(
message
);
Assert
.
assertTrue
(
message
.
contains
(
"\"success\":false"
),
"校验message失败"
);
Assert
.
assertTrue
(
message
.
contains
(
"\"desc\":\"商家未采购商品\""
),
"校验message失败"
);
logger
.
info
(
"校验支付宝用户id2篡改无法兑换成功"
);
}
...
...
src/test/java/http/cases/ExchangeTest/兑吧卡密_兑换流程测试_ExchangeTest.java
View file @
9fd3d239
...
@@ -506,6 +506,64 @@ public class 兑吧卡密_兑换流程测试_ExchangeTest extends CheckTemplet {
...
@@ -506,6 +506,64 @@ public class 兑吧卡密_兑换流程测试_ExchangeTest extends CheckTemplet {
}
}
@Test
(
description
=
"兑吧卡密用户id篡改测试"
)
public
void
卡密用户
id
篡改测试
()
throws
Exception
{
//uid: 大富翁app
//商品: lv测试应用55
int
uid
=
11
;
String
appItemId
=
"197045"
;
String
itemId
=
"32657"
;
String
skuId
=
"173"
;
String
message
=
""
;
Map
cookies
=
authorization
.
dafuwengLogin
(
uid
);
//卡密兑换
try
{
Response
response
=
gawService
.
couponExchange
(
cookies
,
appItemId
,
itemId
,
skuId
);
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
(
description
=
"兑吧卡密skuId篡改测试"
)
public
void
卡密
skuId
篡改测试
()
throws
Exception
{
String
appItemId
=
"197045"
;
String
itemId
=
"32657"
;
String
skuId
=
"106"
;
String
message
=
""
;
Map
cookies
=
authorization
.
dafuwengLogin
(
uid
);
//优惠券兑换,skuId改为其它商品的
try
{
Response
response
=
gawService
.
couponExchange
(
cookies
,
appItemId
,
itemId
,
skuId
);
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
(
"校验卡密skuId篡改无法兑换成功"
);
}
}
}
src/test/java/http/cases/ExchangeTest/兑吧新优惠券_兑换流程测试_ExchangeTest.java
View file @
9fd3d239
...
@@ -498,5 +498,62 @@ public class 兑吧新优惠券_兑换流程测试_ExchangeTest extends CheckTem
...
@@ -498,5 +498,62 @@ public class 兑吧新优惠券_兑换流程测试_ExchangeTest extends CheckTem
@Test
(
description
=
"新优惠券用户id篡改测试"
)
public
void
优惠券用户
id
篡改测试
()
throws
Exception
{
//uid: 大富翁app
//商品: lv测试应用55
int
uid
=
10
;
String
appItemId
=
"197044"
;
String
itemId
=
"32656"
;
String
message
=
""
;
Map
cookies
=
authorization
.
dafuwengLogin
(
uid
);
//优惠券兑换
try
{
Response
response
=
gawService
.
couponExchange
(
cookies
,
appItemId
,
itemId
,
"172"
);
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
(
description
=
"新优惠券skuId篡改测试"
)
public
void
优惠券
skuId
篡改测试
()
throws
Exception
{
int
uid
=
7289
;
String
appItemId
=
"197044"
;
String
itemId
=
"32656"
;
String
message
=
""
;
Map
cookies
=
authorization
.
dafuwengLogin
(
uid
);
//优惠券兑换,skuId改为其它商品的
try
{
Response
response
=
gawService
.
couponExchange
(
cookies
,
appItemId
,
itemId
,
"105"
);
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
(
"校验优惠券skuId篡改无法兑换成功"
);
}
}
}
src/test/java/http/cases/ExchangeTest/兑吧新实物_兑换流程测试_ExchangeTest.java
View file @
9fd3d239
...
@@ -50,9 +50,9 @@ public class 兑吧新实物_兑换流程测试_ExchangeTest extends CheckTemple
...
@@ -50,9 +50,9 @@ public class 兑吧新实物_兑换流程测试_ExchangeTest extends CheckTemple
Object
[][]
result
=
null
;
Object
[][]
result
=
null
;
if
(
method
.
getName
().
equals
(
"日期兑换限制测试"
))
{
if
(
method
.
getName
().
equals
(
"日期兑换限制测试"
))
{
result
=
new
Object
[][]{
result
=
new
Object
[][]{
new
Object
[]{
1
,
"193805"
,
"32506"
,
"兑吧新实物日期兑换限制未开始"
},
//case1
new
Object
[]{
1
,
"193805"
,
"32506"
,
"
27"
,
"
兑吧新实物日期兑换限制未开始"
},
//case1
new
Object
[]{
2
,
"193806"
,
"32507"
,
"兑吧新实物日期兑换限制进行中"
},
//case2
new
Object
[]{
2
,
"193806"
,
"32507"
,
"
28"
,
"
兑吧新实物日期兑换限制进行中"
},
//case2
new
Object
[]{
3
,
"193807"
,
"32508"
,
"兑吧新实物日期兑换限制已结束"
},
//case3
new
Object
[]{
3
,
"193807"
,
"32508"
,
"
29"
,
"
兑吧新实物日期兑换限制已结束"
},
//case3
};
};
}
}
return
result
;
return
result
;
...
@@ -64,10 +64,11 @@ public class 兑吧新实物_兑换流程测试_ExchangeTest extends CheckTemple
...
@@ -64,10 +64,11 @@ public class 兑吧新实物_兑换流程测试_ExchangeTest extends CheckTemple
String
appItemId
=
"192950"
;
String
appItemId
=
"192950"
;
String
itemId
=
"32439"
;
String
itemId
=
"32439"
;
String
skuId
=
"16"
;
String
message
=
""
;
String
message
=
""
;
try
{
try
{
//第一次兑换
//第一次兑换
Response
response
=
gawService
.
objectExchange
(
uid
,
appItemId
,
itemId
);
Response
response
=
gawService
.
objectExchange
(
uid
,
appItemId
,
itemId
,
skuId
);
String
orderId
=
response
.
jsonPath
().
getString
(
"data.orderId"
);
String
orderId
=
response
.
jsonPath
().
getString
(
"data.orderId"
);
//获取兑换结果
//获取兑换结果
response
=
tawService
.
orderStatus
(
orderId
,
uid
);
response
=
tawService
.
orderStatus
(
orderId
,
uid
);
...
@@ -91,7 +92,7 @@ public class 兑吧新实物_兑换流程测试_ExchangeTest extends CheckTemple
...
@@ -91,7 +92,7 @@ public class 兑吧新实物_兑换流程测试_ExchangeTest extends CheckTemple
//第二次兑换
//第二次兑换
Thread
.
sleep
(
3000
);
Thread
.
sleep
(
3000
);
try
{
try
{
response
=
gawService
.
objectExchange
(
uid
,
appItemId
,
itemId
);
response
=
gawService
.
objectExchange
(
uid
,
appItemId
,
itemId
,
skuId
);
response
.
prettyPrint
();
response
.
prettyPrint
();
}
catch
(
Exception
e
){
}
catch
(
Exception
e
){
...
@@ -123,11 +124,12 @@ public class 兑吧新实物_兑换流程测试_ExchangeTest extends CheckTemple
...
@@ -123,11 +124,12 @@ public class 兑吧新实物_兑换流程测试_ExchangeTest extends CheckTemple
String
appItemId
=
"193756"
;
String
appItemId
=
"193756"
;
String
itemId
=
"32500"
;
String
itemId
=
"32500"
;
String
skuId
=
"18"
;
String
message
=
""
;
String
message
=
""
;
try
{
try
{
//第一次兑换
//第一次兑换
Response
response
=
gawService
.
objectExchange
(
uid
,
appItemId
,
itemId
);
Response
response
=
gawService
.
objectExchange
(
uid
,
appItemId
,
itemId
,
skuId
);
String
orderId
=
response
.
jsonPath
().
getString
(
"data.orderId"
);
String
orderId
=
response
.
jsonPath
().
getString
(
"data.orderId"
);
//获取兑换结果
//获取兑换结果
response
=
tawService
.
orderStatus
(
orderId
,
uid
);
response
=
tawService
.
orderStatus
(
orderId
,
uid
);
...
@@ -151,7 +153,7 @@ public class 兑吧新实物_兑换流程测试_ExchangeTest extends CheckTemple
...
@@ -151,7 +153,7 @@ public class 兑吧新实物_兑换流程测试_ExchangeTest extends CheckTemple
//第二次兑换
//第二次兑换
Thread
.
sleep
(
3000
);
Thread
.
sleep
(
3000
);
try
{
try
{
response
=
gawService
.
objectExchange
(
uid
,
appItemId
,
itemId
);
response
=
gawService
.
objectExchange
(
uid
,
appItemId
,
itemId
,
skuId
);
response
.
prettyPrint
();
response
.
prettyPrint
();
}
catch
(
Exception
e
){
}
catch
(
Exception
e
){
...
@@ -185,11 +187,12 @@ public class 兑吧新实物_兑换流程测试_ExchangeTest extends CheckTemple
...
@@ -185,11 +187,12 @@ public class 兑吧新实物_兑换流程测试_ExchangeTest extends CheckTemple
String
appItemId
=
"193757"
;
String
appItemId
=
"193757"
;
String
itemId
=
"32501"
;
String
itemId
=
"32501"
;
String
skuId
=
"19"
;
String
message
=
""
;
String
message
=
""
;
try
{
try
{
//第一次兑换
//第一次兑换
Response
response
=
gawService
.
objectExchange
(
uid
,
appItemId
,
itemId
);
Response
response
=
gawService
.
objectExchange
(
uid
,
appItemId
,
itemId
,
skuId
);
String
orderId
=
response
.
jsonPath
().
getString
(
"data.orderId"
);
String
orderId
=
response
.
jsonPath
().
getString
(
"data.orderId"
);
//获取兑换结果
//获取兑换结果
response
=
tawService
.
orderStatus
(
orderId
,
uid
);
response
=
tawService
.
orderStatus
(
orderId
,
uid
);
...
@@ -213,7 +216,7 @@ public class 兑吧新实物_兑换流程测试_ExchangeTest extends CheckTemple
...
@@ -213,7 +216,7 @@ public class 兑吧新实物_兑换流程测试_ExchangeTest extends CheckTemple
//第二次兑换
//第二次兑换
Thread
.
sleep
(
3000
);
Thread
.
sleep
(
3000
);
try
{
try
{
response
=
gawService
.
objectExchange
(
uid
,
appItemId
,
itemId
);
response
=
gawService
.
objectExchange
(
uid
,
appItemId
,
itemId
,
skuId
);
response
.
prettyPrint
();
response
.
prettyPrint
();
}
catch
(
Exception
e
){
}
catch
(
Exception
e
){
...
@@ -247,11 +250,12 @@ public class 兑吧新实物_兑换流程测试_ExchangeTest extends CheckTemple
...
@@ -247,11 +250,12 @@ public class 兑吧新实物_兑换流程测试_ExchangeTest extends CheckTemple
String
appItemId
=
"193801"
;
String
appItemId
=
"193801"
;
String
itemId
=
"32505"
;
String
itemId
=
"32505"
;
String
skuId
=
"23"
;
String
message
=
""
;
String
message
=
""
;
try
{
try
{
//第一次兑换
//第一次兑换
Response
response
=
gawService
.
objectExchange
(
uid
,
appItemId
,
itemId
);
Response
response
=
gawService
.
objectExchange
(
uid
,
appItemId
,
itemId
,
skuId
);
String
orderId
=
response
.
jsonPath
().
getString
(
"data.orderId"
);
String
orderId
=
response
.
jsonPath
().
getString
(
"data.orderId"
);
//获取兑换结果
//获取兑换结果
response
=
tawService
.
orderStatus
(
orderId
,
uid
);
response
=
tawService
.
orderStatus
(
orderId
,
uid
);
...
@@ -275,7 +279,7 @@ public class 兑吧新实物_兑换流程测试_ExchangeTest extends CheckTemple
...
@@ -275,7 +279,7 @@ public class 兑吧新实物_兑换流程测试_ExchangeTest extends CheckTemple
//第二次兑换
//第二次兑换
Thread
.
sleep
(
3000
);
Thread
.
sleep
(
3000
);
try
{
try
{
response
=
gawService
.
objectExchange
(
uid
,
appItemId
,
itemId
);
response
=
gawService
.
objectExchange
(
uid
,
appItemId
,
itemId
,
skuId
);
response
.
prettyPrint
();
response
.
prettyPrint
();
}
catch
(
Exception
e
){
}
catch
(
Exception
e
){
...
@@ -307,18 +311,19 @@ public class 兑吧新实物_兑换流程测试_ExchangeTest extends CheckTemple
...
@@ -307,18 +311,19 @@ public class 兑吧新实物_兑换流程测试_ExchangeTest extends CheckTemple
* @param caseNum 用例编号
* @param caseNum 用例编号
* @param appItemId 商品入库Id
* @param appItemId 商品入库Id
* @param itemId 商品id
* @param itemId 商品id
* @param skuId skuId
* @param caseName 用例名称打印
* @param caseName 用例名称打印
* @throws Exception
* @throws Exception
*/
*/
@Test
(
dataProvider
=
"providerMethod"
)
@Test
(
dataProvider
=
"providerMethod"
)
public
void
日期兑换限制测试
(
int
caseNum
,
String
appItemId
,
String
itemId
,
String
caseName
)
throws
Exception
{
public
void
日期兑换限制测试
(
int
caseNum
,
String
appItemId
,
String
itemId
,
String
skuId
,
String
caseName
)
throws
Exception
{
String
message
=
""
;
String
message
=
""
;
logger
.
info
(
caseName
);
logger
.
info
(
caseName
);
//兑换
//兑换
try
{
try
{
Response
response
=
gawService
.
objectExchange
(
uid
,
appItemId
,
itemId
);
Response
response
=
gawService
.
objectExchange
(
uid
,
appItemId
,
itemId
,
skuId
);
response
.
prettyPrint
();
response
.
prettyPrint
();
}
catch
(
Exception
e
){
}
catch
(
Exception
e
){
...
@@ -362,11 +367,12 @@ public class 兑吧新实物_兑换流程测试_ExchangeTest extends CheckTemple
...
@@ -362,11 +367,12 @@ public class 兑吧新实物_兑换流程测试_ExchangeTest extends CheckTemple
String
appItemId
=
"193808"
;
String
appItemId
=
"193808"
;
String
itemId
=
"32509"
;
String
itemId
=
"32509"
;
String
skuId
=
"30"
;
String
message
=
""
;
String
message
=
""
;
//会员等级无法兑换
//会员等级无法兑换
try
{
try
{
Response
response
=
gawService
.
objectExchange
(
uid
,
appItemId
,
itemId
);
Response
response
=
gawService
.
objectExchange
(
uid
,
appItemId
,
itemId
,
skuId
);
response
.
prettyPrint
();
response
.
prettyPrint
();
}
catch
(
Exception
e
){
}
catch
(
Exception
e
){
...
@@ -375,7 +381,7 @@ public class 兑吧新实物_兑换流程测试_ExchangeTest extends CheckTemple
...
@@ -375,7 +381,7 @@ public class 兑吧新实物_兑换流程测试_ExchangeTest extends CheckTemple
logger
.
info
(
message
);
logger
.
info
(
message
);
//会员等级可兑换,vip=5
//会员等级可兑换,vip=5
Response
response
=
gawService
.
objectExchange
(
authorization
.
generateSignAutoLogin
(
"vc2HvzM439YBQiB6LVy4uxC4uWm"
,
7001
),
appItemId
,
itemId
,
"16"
);
Response
response
=
gawService
.
objectExchange
(
authorization
.
generateSignAutoLogin
(
"vc2HvzM439YBQiB6LVy4uxC4uWm"
,
7001
),
appItemId
,
itemId
,
skuId
);
response
.
prettyPrint
();
response
.
prettyPrint
();
Assert
.
assertTrue
(
message
.
contains
(
"未达到会员等级要求"
),
"校验message失败"
);
Assert
.
assertTrue
(
message
.
contains
(
"未达到会员等级要求"
),
"校验message失败"
);
...
@@ -446,27 +452,59 @@ public class 兑吧新实物_兑换流程测试_ExchangeTest extends CheckTemple
...
@@ -446,27 +452,59 @@ public class 兑吧新实物_兑换流程测试_ExchangeTest extends CheckTemple
}
}
@Test
(
description
=
"新实物
确认下单页面
"
)
@Test
(
description
=
"新实物
用户id篡改测试
"
)
public
void
实物
确认下单
测试
()
throws
Exception
{
public
void
实物
用户
id
篡改
测试
()
throws
Exception
{
String
appItemId
=
"196218"
;
//uid: 大富翁app
String
appSkuId
=
"145"
;
//商品: lv测试应用55
int
uid
=
8
;
String
appItemId
=
"197040"
;
String
itemId
=
"32655"
;
String
skuId
=
"163"
;
String
message
=
""
;
Map
cookies
=
authorization
.
dafuwengLogin
(
uid
);
Response
response
=
gawService
.
confirmItemDetail
(
uid
,
appItemId
,
appSkuId
);
//实物兑换
response
.
prettyPrint
();
try
{
Response
response
=
gawService
.
objectExchange
(
cookies
,
appItemId
,
itemId
,
skuId
);
response
.
prettyPrint
();
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.items[0].sku.attr[0].value"
),
"白色"
,
"校验sku信息颜色失败"
);
}
catch
(
Exception
e
){
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.items[0].sku.attr[1].value"
),
"S"
,
"校验sku信息尺寸失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.items[0].sku.credits"
),
"100"
,
"校验sku商品积分失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.items[0].multiImage"
),
"//yun.dui88.com/images/201906/9p72lmu1qn.jpg"
,
"校验图片信息失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.items[0].title"
),
"【自动化勿动】自有实物sku"
,
"校验实物名称失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.orderCredits"
),
"100"
,
"校验订单积分失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.expressPrice"
),
"500"
,
"校验订单运费金额失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.consumerPayPrice"
),
"500"
,
"校验订单支付金额失败"
);
logger
.
info
(
"校验新实物确认下单页正确"
);
message
=
e
.
toString
();
}
logger
.
info
(
message
);
Assert
.
assertTrue
(
message
.
contains
(
"\"desc\":\"无权访问\""
),
"校验message失败"
);
Assert
.
assertTrue
(
message
.
contains
(
"\"success\":false"
),
"校验success失败"
);
logger
.
info
(
"校验实物用户id篡改无法兑换成功"
);
}
@Test
(
description
=
"新实物skuId篡改测试"
)
public
void
实物
skuId
篡改测试
()
throws
Exception
{
int
uid
=
7289
;
String
appItemId
=
"197040"
;
String
itemId
=
"32655"
;
String
message
=
""
;
Map
cookies
=
authorization
.
dafuwengLogin
(
uid
);
//实物兑换,skuId改为其它商品的
try
{
Response
response
=
gawService
.
objectExchange
(
cookies
,
appItemId
,
itemId
,
"36"
);
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
(
"校验实物skuId篡改无法兑换成功"
);
}
}
...
@@ -475,4 +513,10 @@ public class 兑吧新实物_兑换流程测试_ExchangeTest extends CheckTemple
...
@@ -475,4 +513,10 @@ public class 兑吧新实物_兑换流程测试_ExchangeTest extends CheckTemple
}
}
src/test/java/http/cases/ExchangeTest/兑吧老优惠券_兑换流程测试_ExchangeTest.java
View file @
9fd3d239
...
@@ -218,7 +218,6 @@ public class 兑吧老优惠券_兑换流程测试_ExchangeTest extends CheckTem
...
@@ -218,7 +218,6 @@ public class 兑吧老优惠券_兑换流程测试_ExchangeTest extends CheckTem
this
.
优惠券兑换
(
"174928"
,
"30319"
,
uid
);
this
.
优惠券兑换
(
"174928"
,
"30319"
,
uid
);
//每日限额用完,无法再次兑换
//每日限额用完,无法再次兑换
Thread
.
sleep
(
3000
);
Map
<
String
,
String
>
map
=
new
HashMap
<>();
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"appItemId"
,
"174928"
);
map
.
put
(
"appItemId"
,
"174928"
);
map
.
put
(
"itemId"
,
"30319"
);
map
.
put
(
"itemId"
,
"30319"
);
...
@@ -230,7 +229,7 @@ public class 兑吧老优惠券_兑换流程测试_ExchangeTest extends CheckTem
...
@@ -230,7 +229,7 @@ public class 兑吧老优惠券_兑换流程测试_ExchangeTest extends CheckTem
//获取按钮状态
//获取按钮状态
Response
detailResponse
=
mobileService
.
detail
(
authorization
.
dafuwengLogin
(
uid
),
"30319"
);
Response
detailResponse
=
mobileService
.
detail
(
authorization
.
dafuwengLogin
(
uid
),
"30319"
);
detailResponse
.
prettyPrint
();
//
detailResponse.prettyPrint();
String
exchangeText
=
MatcherString
.
getString
(
detailResponse
.
asString
(),
"\"exchangeText\":\"(.*?)\","
,
1
);
String
exchangeText
=
MatcherString
.
getString
(
detailResponse
.
asString
(),
"\"exchangeText\":\"(.*?)\","
,
1
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"message"
),
"今日已兑完,明天再来哦(14)"
,
"校验message失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"message"
),
"今日已兑完,明天再来哦(14)"
,
"校验message失败"
);
...
...
src/test/java/http/cases/ExchangeTest/自有_商品兑换限制/自有新优惠券_兑换限制测试_ExchangeTest.java
View file @
9fd3d239
...
@@ -576,5 +576,59 @@ public class 自有新优惠券_兑换限制测试_ExchangeTest extends CheckTem
...
@@ -576,5 +576,59 @@ public class 自有新优惠券_兑换限制测试_ExchangeTest extends CheckTem
@Test
(
description
=
"新优惠券用户id篡改测试"
)
public
void
优惠券用户
id
篡改测试
()
throws
Exception
{
//uid: 大富翁app
//商品: lv测试应用55
int
uid
=
6999
;
String
appItemId
=
"197048"
;
String
message
=
""
;
//优惠券兑换
try
{
Response
response
=
gawService
.
couponExchange
(
uid
,
appItemId
,
175
);
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
(
description
=
"新优惠券skuId篡改测试"
)
public
void
优惠券
skuId
篡改测试
()
throws
Exception
{
int
uid
=
7028
;
String
appItemId
=
"197048"
;
String
message
=
""
;
//优惠券兑换,skuId改为其它商品的
try
{
Response
response
=
gawService
.
couponExchange
(
uid
,
appItemId
,
105
);
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
(
"校验优惠券skuId篡改无法兑换成功"
);
}
}
}
src/test/java/http/cases/ExchangeTest/自有_商品兑换限制/自有新卡密_兑换限制测试_ExchangeTest.java
View file @
9fd3d239
...
@@ -480,6 +480,58 @@ public class 自有新卡密_兑换限制测试_ExchangeTest extends CheckTemple
...
@@ -480,6 +480,58 @@ public class 自有新卡密_兑换限制测试_ExchangeTest extends CheckTemple
@Test
(
description
=
"卡密用户id篡改测试"
)
public
void
卡密用户
id
篡改测试
()
throws
Exception
{
//uid: 大富翁app
//商品: lv测试应用55
int
uid
=
6997
;
String
appItemId
=
"197049"
;
String
message
=
""
;
//卡密兑换
try
{
Response
response
=
gawService
.
couponExchange
(
uid
,
appItemId
,
176
);
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
(
description
=
"卡密skuId篡改测试"
)
public
void
卡密
skuId
篡改测试
()
throws
Exception
{
int
uid
=
7294
;
String
appItemId
=
"197049"
;
String
message
=
""
;
//优惠券兑换,skuId改为其它商品的
try
{
Response
response
=
gawService
.
couponExchange
(
uid
,
appItemId
,
105
);
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
(
"校验卡密skuId篡改无法兑换成功"
);
}
}
}
src/test/java/http/cases/ExchangeTest/自有_商品兑换限制/自有新实物_兑换流程测试_ExchangeTest.java
View file @
9fd3d239
package
http
.
cases
.
ExchangeTest
.
自有
_
商品兑换限制
;
package
http
.
cases
.
ExchangeTest
.
自有
_
商品兑换限制
;
import
http.cases.ExchangeTest.CheckTemplet
;
import
http.cases.ExchangeTest.CheckTemplet
;
import
http.cases.ExchangeTest.Database
;
import
http.service.Authorization
;
import
http.service.Authorization
;
import
http.service.app.MobileService
;
import
http.service.app.MobileService
;
import
io.restassured.response.Response
;
import
io.restassured.response.Response
;
...
@@ -13,6 +14,7 @@ import utils.MatcherString;
...
@@ -13,6 +14,7 @@ import utils.MatcherString;
import
java.lang.reflect.Method
;
import
java.lang.reflect.Method
;
import
java.sql.SQLException
;
import
java.sql.SQLException
;
import
java.util.Map
;
public
class
自有新实物
_
兑换流程测试
_ExchangeTest
extends
CheckTemplet
{
public
class
自有新实物
_
兑换流程测试
_ExchangeTest
extends
CheckTemplet
{
@Autowired
@Autowired
...
@@ -34,9 +36,9 @@ public class 自有新实物_兑换流程测试_ExchangeTest extends CheckTemple
...
@@ -34,9 +36,9 @@ public class 自有新实物_兑换流程测试_ExchangeTest extends CheckTemple
Object
[][]
result
=
null
;
Object
[][]
result
=
null
;
if
(
method
.
getName
().
equals
(
"日期兑换限制测试"
))
{
if
(
method
.
getName
().
equals
(
"日期兑换限制测试"
))
{
result
=
new
Object
[][]{
result
=
new
Object
[][]{
new
Object
[]{
1
,
"193809"
,
""
,
"兑吧新实物日期兑换限制未开始"
},
//case1
new
Object
[]{
1
,
"193809"
,
""
,
"
31"
,
"
兑吧新实物日期兑换限制未开始"
},
//case1
new
Object
[]{
2
,
"194143"
,
""
,
"兑吧新实物日期兑换限制进行中"
},
//case2
new
Object
[]{
2
,
"194143"
,
""
,
"
72"
,
"
兑吧新实物日期兑换限制进行中"
},
//case2
new
Object
[]{
3
,
"194144"
,
""
,
"兑吧新实物日期兑换限制已结束"
},
//case3
new
Object
[]{
3
,
"194144"
,
""
,
"73"
,
"兑吧新实物日期兑换限制已结束"
},
//case3
};
};
}
}
return
result
;
return
result
;
...
@@ -61,7 +63,7 @@ public class 自有新实物_兑换流程测试_ExchangeTest extends CheckTemple
...
@@ -61,7 +63,7 @@ public class 自有新实物_兑换流程测试_ExchangeTest extends CheckTemple
}
}
}
}
@Test
(
description
=
"
兑吧
新自有实物每人限购---每天限制"
)
@Test
(
description
=
"新自有实物每人限购---每天限制"
)
public
void
每人限购每天限购限制
()
throws
Exception
{
public
void
每人限购每天限购限制
()
throws
Exception
{
String
appItemId
=
"193752"
;
String
appItemId
=
"193752"
;
String
itemId
=
"null"
;
String
itemId
=
"null"
;
...
@@ -115,7 +117,7 @@ public class 自有新实物_兑换流程测试_ExchangeTest extends CheckTemple
...
@@ -115,7 +117,7 @@ public class 自有新实物_兑换流程测试_ExchangeTest extends CheckTemple
}
}
}
}
@Test
(
description
=
"
兑吧
新自有实物每人限购---永久限制"
)
@Test
(
description
=
"新自有实物每人限购---永久限制"
)
public
void
每人限购永久限购限制
()
throws
Exception
{
public
void
每人限购永久限购限制
()
throws
Exception
{
String
appItemId
=
"193802"
;
String
appItemId
=
"193802"
;
String
itemId
=
"null"
;
String
itemId
=
"null"
;
...
@@ -169,7 +171,9 @@ public class 自有新实物_兑换流程测试_ExchangeTest extends CheckTemple
...
@@ -169,7 +171,9 @@ public class 自有新实物_兑换流程测试_ExchangeTest extends CheckTemple
}
}
}
}
@Test
(
description
=
"兑吧新自有实物每人限购---周期限制"
)
@Test
(
description
=
"新自有实物每人限购---周期限制"
)
public
void
每人限购周期限制
()
throws
Exception
{
public
void
每人限购周期限制
()
throws
Exception
{
String
appItemId
=
"193803"
;
String
appItemId
=
"193803"
;
String
itemId
=
"null"
;
String
itemId
=
"null"
;
...
@@ -221,7 +225,7 @@ public class 自有新实物_兑换流程测试_ExchangeTest extends CheckTemple
...
@@ -221,7 +225,7 @@ public class 自有新实物_兑换流程测试_ExchangeTest extends CheckTemple
}
}
@Test
(
description
=
"
兑吧
新自有实物每日限量"
)
@Test
(
description
=
"新自有实物每日限量"
)
public
void
每日限量限制
()
throws
Exception
{
public
void
每日限量限制
()
throws
Exception
{
String
appItemId
=
"193804"
;
String
appItemId
=
"193804"
;
String
itemId
=
"null"
;
String
itemId
=
"null"
;
...
@@ -272,22 +276,25 @@ public class 自有新实物_兑换流程测试_ExchangeTest extends CheckTemple
...
@@ -272,22 +276,25 @@ public class 自有新实物_兑换流程测试_ExchangeTest extends CheckTemple
}
}
}
}
/**
/**
* @param caseNum 用例编号
* @param caseNum 用例编号
* @param appItemId 商品入库Id
* @param appItemId 商品入库Id
* @param itemId 商品id
* @param itemId 商品id
* @param skuId skuId
* @param caseName 用例名称打印
* @param caseName 用例名称打印
* @throws Exception
* @throws Exception
*/
*/
@Test
(
dataProvider
=
"providerMethod"
)
@Test
(
dataProvider
=
"providerMethod"
)
public
void
日期兑换限制测试
(
int
caseNum
,
String
appItemId
,
String
itemId
,
String
caseName
)
throws
Exception
{
public
void
日期兑换限制测试
(
int
caseNum
,
String
appItemId
,
String
itemId
,
String
skuId
,
String
caseName
)
throws
Exception
{
String
message
=
""
;
String
message
=
""
;
logger
.
info
(
caseName
);
logger
.
info
(
caseName
);
//兑换
//兑换
try
{
try
{
Thread
.
sleep
(
3000
);
Thread
.
sleep
(
3000
);
Response
response
=
gawService
.
objectExchange
(
uid
,
appItemId
,
itemId
);
Response
response
=
gawService
.
objectExchange
(
uid
,
appItemId
,
itemId
,
skuId
);
response
.
prettyPrint
();
response
.
prettyPrint
();
}
catch
(
Exception
e
){
}
catch
(
Exception
e
){
message
=
e
.
toString
();
message
=
e
.
toString
();
...
@@ -321,7 +328,7 @@ public class 自有新实物_兑换流程测试_ExchangeTest extends CheckTemple
...
@@ -321,7 +328,7 @@ public class 自有新实物_兑换流程测试_ExchangeTest extends CheckTemple
}
}
@Test
(
description
=
"
兑吧
新自有实物--库存限制"
)
@Test
(
description
=
"新自有实物--库存限制"
)
public
void
库存限制
()
throws
Exception
{
public
void
库存限制
()
throws
Exception
{
String
appItemId
=
"193811"
;
String
appItemId
=
"193811"
;
String
itemId
=
"null"
;
String
itemId
=
"null"
;
...
@@ -355,18 +362,17 @@ public class 自有新实物_兑换流程测试_ExchangeTest extends CheckTemple
...
@@ -355,18 +362,17 @@ public class 自有新实物_兑换流程测试_ExchangeTest extends CheckTemple
}
}
@Test
(
description
=
"新自有实物会员兑换限制"
)
@Test
(
description
=
"兑吧新自有实物会员兑换限制"
)
public
void
会员兑换限制
()
throws
Exception
{
public
void
会员兑换限制
()
throws
Exception
{
String
appItemId
=
"193810"
;
String
appItemId
=
"193810"
;
String
itemId
=
"null"
;
String
itemId
=
"null"
;
String
message
=
""
;
String
message
=
""
;
String
skuId
=
"
27
"
;
String
skuId
=
"
32
"
;
//会员等级无法兑换
//会员等级无法兑换
try
{
try
{
//会员等级可兑换,vip=5
//会员等级可兑换,vip=5
Thread
.
sleep
(
3000
);
Thread
.
sleep
(
3000
);
Response
response
=
gawService
.
objectExchange
(
uid
,
appItemId
,
itemId
);
Response
response
=
gawService
.
objectExchange
(
uid
,
appItemId
,
itemId
,
skuId
);
response
.
prettyPrint
();
response
.
prettyPrint
();
}
catch
(
Exception
e
){
}
catch
(
Exception
e
){
...
@@ -381,6 +387,119 @@ public class 自有新实物_兑换流程测试_ExchangeTest extends CheckTemple
...
@@ -381,6 +387,119 @@ public class 自有新实物_兑换流程测试_ExchangeTest extends CheckTemple
}
}
@Test
(
description
=
"新实物确认下单页面"
)
public
void
实物确认下单测试
()
throws
Exception
{
int
uid
=
7290
;
String
appItemId
=
"196218"
;
String
appSkuId
=
"145"
;
Response
response
=
gawService
.
confirmItemDetail
(
uid
,
appItemId
,
appSkuId
);
response
.
prettyPrint
();
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.items[0].sku.attr[0].value"
),
"白色"
,
"校验sku信息颜色失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.items[0].sku.attr[1].value"
),
"S"
,
"校验sku信息尺寸失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.items[0].sku.credits"
),
"100"
,
"校验sku商品积分失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.items[0].multiImage"
),
"//yun.dui88.com/images/201906/9p72lmu1qn.jpg"
,
"校验图片信息失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.items[0].title"
),
"【自动化勿动】自有实物sku"
,
"校验实物名称失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.orderCredits"
),
"100"
,
"校验订单积分失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.expressPrice"
),
"500"
,
"校验订单运费金额失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.consumerPayPrice"
),
"500"
,
"校验订单支付金额失败"
);
logger
.
info
(
"校验新实物确认下单页正确"
);
}
@Test
(
description
=
"新实物用户id篡改测试"
)
public
void
实物用户
id
篡改测试
()
throws
Exception
{
//uid: 大富翁app
//商品: lv测试应用55
int
uid
=
7204
;
String
appItemId
=
"197041"
;
String
itemId
=
null
;
String
skuId
=
"159"
;
String
message
=
""
;
//实物兑换
try
{
Response
response
=
gawService
.
objectExchange
(
uid
,
appItemId
,
itemId
,
skuId
);
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
(
description
=
"新实物积分修改测试"
)
public
void
实物积分篡改测试
()
throws
Exception
{
int
uid
=
7288
;
String
appItemId
=
"197041"
;
String
itemId
=
null
;
String
skuId
=
"159"
;
//实物兑换,积分传0
Response
response
=
gawService
.
objectExchange
(
uid
,
appItemId
,
itemId
,
skuId
,
"0"
,
"0"
);
response
.
prettyPrint
();
String
orderId
=
response
.
jsonPath
().
getString
(
"data.orderId"
);
//查询数据库
Thread
.
sleep
(
3000
);
Map
<
String
,
Object
>
mapOrderId
=
jdbc
.
findSimpleResult
(
"SELECT * FROM "
+
Database
.
orders_consumer
+
"."
+
Database
.
orders14
+
" where id = "
+
orderId
);
String
orderStatus
=
String
.
valueOf
(
mapOrderId
.
get
(
"status"
));
String
orderCredits
=
String
.
valueOf
(
mapOrderId
.
get
(
"credits"
));
logger
.
info
(
"订单积分:"
+
orderCredits
);
Assert
.
assertEquals
(
orderStatus
,
"consume_success"
,
"校验status失败"
);
Assert
.
assertEquals
(
orderCredits
,
"100"
,
"校验credits失败"
);
logger
.
info
(
"校验实物积分篡改兑换成功"
);
}
@Test
(
description
=
"新实物skuId篡改测试"
)
public
void
实物
skuId
篡改测试
()
throws
Exception
{
int
uid
=
7288
;
String
appItemId
=
"197042"
;
String
itemId
=
null
;
String
message
=
""
;
Map
cookies
=
authorization
.
dafuwengLogin
(
uid
);
//实物兑换,skuId改为其它商品的
try
{
Response
response
=
gawService
.
objectExchange
(
cookies
,
appItemId
,
itemId
,
"36"
);
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
(
"校验实物skuId篡改无法兑换成功"
);
}
//测试使用
//测试使用
//@Test(enabled=true, dataProvider="testdp", threadPoolSize=1, invocationCount=100)
//@Test(enabled=true, dataProvider="testdp", threadPoolSize=1, invocationCount=100)
@DataProvider
(
name
=
"testdp"
,
parallel
=
true
)
@DataProvider
(
name
=
"testdp"
,
parallel
=
true
)
...
@@ -399,6 +518,8 @@ public class 自有新实物_兑换流程测试_ExchangeTest extends CheckTemple
...
@@ -399,6 +518,8 @@ public class 自有新实物_兑换流程测试_ExchangeTest extends CheckTemple
};
};
}
}
// @Test(enabled=true, dataProvider="testdp", threadPoolSize=1, invocationCount=100)
// @Test(enabled=true, dataProvider="testdp", threadPoolSize=1, invocationCount=100)
public
void
test
(
int
uid
)
throws
Exception
{
public
void
test
(
int
uid
)
throws
Exception
{
// System.out.println("Current Thread Id: " + Thread.currentThread().getId() + ". Dataprovider number: "+ dpNumber);
// System.out.println("Current Thread Id: " + Thread.currentThread().getId() + ". Dataprovider number: "+ dpNumber);
...
...
src/test/java/http/cases/ExchangeTest/自有_商品兑换限制/自有新虚拟商品_充值_兑换限制_ExchangeTest.java
View file @
9fd3d239
...
@@ -443,4 +443,61 @@ public class 自有新虚拟商品_充值_兑换限制_ExchangeTest extends Chec
...
@@ -443,4 +443,61 @@ public class 自有新虚拟商品_充值_兑换限制_ExchangeTest extends Chec
}
}
@Test
(
description
=
"新虚拟商品用户id篡改测试"
)
public
void
虚拟商品用户
id
篡改测试
()
throws
Exception
{
//uid: 大富翁app
//商品: lv测试应用55
int
uid
=
6970
;
String
appItemId
=
"197050"
;
String
message
=
""
;
Map
cookies
=
authorization
.
dafuwengLogin
(
uid
);
//虚拟商品兑换
try
{
Response
response
=
gawService
.
virtualExchange
(
cookies
,
appItemId
,
177
);
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
(
description
=
"新虚拟商品skuId篡改测试"
)
public
void
虚拟商品
skuId
篡改测试
()
throws
Exception
{
int
uid
=
7295
;
String
appItemId
=
"197050"
;
String
message
=
""
;
Map
cookies
=
authorization
.
dafuwengLogin
(
uid
);
//优惠券兑换,skuId改为其它商品的
try
{
Response
response
=
gawService
.
virtualExchange
(
cookies
,
appItemId
,
105
);
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
(
"校验虚拟商品skuId篡改无法兑换成功"
);
}
}
}
src/test/java/http/cases/SeckillTest/新秒杀/秒杀商品_自有新优惠券_兑换限制_SeckillTest.java
View file @
9fd3d239
...
@@ -201,7 +201,7 @@ public class 秒杀商品_自有新优惠券_兑换限制_SeckillTest extends Du
...
@@ -201,7 +201,7 @@ public class 秒杀商品_自有新优惠券_兑换限制_SeckillTest extends Du
@Test
(
description
=
"优惠券--活动未开始"
)
@Test
(
description
=
"优惠券--活动未开始"
)
public
void
优惠券活动未开始
()
throws
Exception
{
public
void
优惠券活动未开始
()
throws
Exception
{
String
appItemId
=
"19554
2
"
;
String
appItemId
=
"19554
1
"
;
String
itemId
=
null
;
String
itemId
=
null
;
String
message
=
""
;
String
message
=
""
;
String
actId
=
"29"
;
String
actId
=
"29"
;
...
@@ -240,7 +240,7 @@ public class 秒杀商品_自有新优惠券_兑换限制_SeckillTest extends Du
...
@@ -240,7 +240,7 @@ public class 秒杀商品_自有新优惠券_兑换限制_SeckillTest extends Du
@Test
(
description
=
"优惠券--活动已结束"
)
@Test
(
description
=
"优惠券--活动已结束"
)
public
void
优惠券活动已结束
()
throws
Exception
{
public
void
优惠券活动已结束
()
throws
Exception
{
String
appItemId
=
"19554
3
"
;
String
appItemId
=
"19554
2
"
;
String
itemId
=
null
;
String
itemId
=
null
;
String
message
=
""
;
String
message
=
""
;
String
actId
=
"30"
;
String
actId
=
"30"
;
...
...
src/test/java/http/cases/VisualEditorTest/商品分组组件_DuibaTest.java
View file @
9fd3d239
...
@@ -53,6 +53,13 @@ public class 商品分组组件_DuibaTest extends DuibaTestBase {
...
@@ -53,6 +53,13 @@ public class 商品分组组件_DuibaTest extends DuibaTestBase {
new
Object
[]{
2
,
"2104"
,
"商品分组-自有新商品"
},
//case2
new
Object
[]{
2
,
"2104"
,
"商品分组-自有新商品"
},
//case2
};
};
}
}
if
(
method
.
getName
().
equals
(
"手机端商品分组组件老商品展示"
)){
result
=
new
Object
[][]{
new
Object
[]{
1
,
"2124"
,
"商品分组-兑吧老商品"
},
//case1
new
Object
[]{
2
,
"2125"
,
"商品分组-自有老商品"
},
//case2
};
}
return
result
;
return
result
;
}
}
...
@@ -177,7 +184,7 @@ public class 商品分组组件_DuibaTest extends DuibaTestBase {
...
@@ -177,7 +184,7 @@ public class 商品分组组件_DuibaTest extends DuibaTestBase {
/**
/**
* @param caseNum 用例编号
* @param caseNum 用例编号
* @param classifyId 商品分组Id
* @param classifyId 商品分组Id
* @param caseName 用例名称打印
* @param caseName 用例名称打印
...
@@ -239,5 +246,68 @@ public class 商品分组组件_DuibaTest extends DuibaTestBase {
...
@@ -239,5 +246,68 @@ public class 商品分组组件_DuibaTest extends DuibaTestBase {
/**
* @param caseNum 用例编号
* @param classifyId 商品分组Id
* @param caseName 用例名称打印
* @throws Exception
*/
@Test
(
dataProvider
=
"providerMethod"
)
public
void
手机端商品分组组件老商品展示
(
int
caseNum
,
String
classifyId
,
String
caseName
)
throws
Exception
{
logger
.
info
(
"---"
+
caseName
+
"---"
);
//app:lv测试应用33
Map
cookies
=
authorization
.
dafuwengLogin
(
6569
);
Response
response
=
chwVisualEditorService
.
itemsList
(
cookies
,
classifyId
);
response
.
prettyPrint
();
switch
(
caseNum
){
case
1
:
//手机端接口排序与前端不一致
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.list[0].title"
),
"【自动化勿动】兑吧新优惠券普通券码跳转"
,
"校验第一个商品title失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.list[0].titleDownTxt"
),
"100积分"
,
"校验第一个商品credits失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.list[1].title"
),
"【自动化勿动】兑吧卡密跳转按钮"
,
"校验第二个商品title失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.list[1].titleDownTxt"
),
"200积分"
,
"校验第二个商品credits失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.list[2].title"
),
"【自动化勿动】兑吧新实物"
,
"校验第三个商品title失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.list[2].titleDownTxt"
),
"300积分"
,
"校验第三个商品credits失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.list[3].title"
),
"支付宝充值"
,
"校验第四个商品title失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.list[3].titleDownTxt"
),
"10万积分"
,
"校验第四个商品credits失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.list[4].title"
),
"10元话费"
,
"校验第五个商品title失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.list[4].titleDownTxt"
),
"1000积分"
,
"校验第五个商品credits失败"
);
logger
.
info
(
"校验商品分组1-兑吧新商品成功"
);
break
;
case
2
:
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.list[0].title"
),
"【自动化勿动】自有新优惠券跳转链接"
,
"校验第一个商品title失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.list[0].titleDownTxt"
),
"100积分"
,
"校验第一个商品credits失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.list[1].title"
),
"【自动化勿动】自有新实物加钱购"
,
"校验第二个商品title失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.list[1].titleDownTxt"
),
"150积分 + 10.00元"
,
"校验第二个商品credits失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.list[2].title"
),
"【自动化勿动】自有充值商品"
,
"校验第三个商品title失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.list[2].titleDownTxt"
),
"300积分"
,
"校验第三个商品credits失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.list[3].title"
),
"【自动化勿动】自有卡密"
,
"校验第四个商品title失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.list[3].titleDownTxt"
),
"550积分"
,
"校验第四个商品credits失败"
);
logger
.
info
(
"校验商品分组2-自有新商品成功"
);
break
;
}
}
}
}
src/test/java/http/service/app/gawService.java
View file @
9fd3d239
...
@@ -31,13 +31,13 @@ public class gawService {
...
@@ -31,13 +31,13 @@ public class gawService {
//普通实物兑换接口
//普通实物兑换接口
public
Response
objectExchange
(
int
uid
,
String
appItemId
,
String
itemId
)
throws
Exception
{
public
Response
objectExchange
(
int
uid
,
String
appItemId
,
String
itemId
,
String
skuId
)
throws
Exception
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
Map
<
String
,
Object
>
mapList
=
new
HashMap
<>();
Map
<
String
,
Object
>
mapList
=
new
HashMap
<>();
List
<
Map
>
list
=
new
ArrayList
<>();
List
<
Map
>
list
=
new
ArrayList
<>();
mapList
.
put
(
"itemId"
,
itemId
);
mapList
.
put
(
"itemId"
,
itemId
);
mapList
.
put
(
"skuId"
,
16
);
mapList
.
put
(
"skuId"
,
skuId
);
mapList
.
put
(
"appItemId"
,
appItemId
);
mapList
.
put
(
"appItemId"
,
appItemId
);
mapList
.
put
(
"credits"
,
"100"
);
mapList
.
put
(
"credits"
,
"100"
);
mapList
.
put
(
"price"
,
0
);
mapList
.
put
(
"price"
,
0
);
...
@@ -123,15 +123,17 @@ public class gawService {
...
@@ -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
>
map
=
new
HashMap
<>();
Map
<
String
,
Object
>
mapList
=
new
HashMap
<>();
Map
<
String
,
Object
>
mapList
=
new
HashMap
<>();
List
<
Map
>
list
=
new
ArrayList
<>();
List
<
Map
>
list
=
new
ArrayList
<>();
mapList
.
put
(
"itemId"
,
itemId
);
mapList
.
put
(
"skuId"
,
skuId
);
mapList
.
put
(
"skuId"
,
skuId
);
mapList
.
put
(
"appItemId"
,
appItemId
);
mapList
.
put
(
"appItemId"
,
appItemId
);
mapList
.
put
(
"credits"
,
"100"
);
mapList
.
put
(
"credits"
,
credits
);
mapList
.
put
(
"price"
,
0
);
mapList
.
put
(
"price"
,
0
);
list
.
add
(
mapList
);
list
.
add
(
mapList
);
...
@@ -139,7 +141,7 @@ public class gawService {
...
@@ -139,7 +141,7 @@ public class gawService {
map
.
put
(
"remark"
,
""
);
//买家留言
map
.
put
(
"remark"
,
""
);
//买家留言
map
.
put
(
"degreeId"
,
""
);
map
.
put
(
"degreeId"
,
""
);
map
.
put
(
"actualPrice"
,
"0"
);
//总金额
map
.
put
(
"actualPrice"
,
"0"
);
//总金额
map
.
put
(
"actualCredits"
,
"100"
);
//总积分
map
.
put
(
"actualCredits"
,
actualCredits
);
//总积分
map
.
put
(
"itemParam"
,
list
.
toArray
());
map
.
put
(
"itemParam"
,
list
.
toArray
());
map
.
put
(
"payType"
,
"3"
);
map
.
put
(
"payType"
,
"3"
);
map
.
put
(
"expressPrice"
,
"0"
);
map
.
put
(
"expressPrice"
,
"0"
);
...
@@ -148,8 +150,8 @@ public class gawService {
...
@@ -148,8 +150,8 @@ public class gawService {
JSONObject
jsonParam
=
JSONObject
.
parseObject
(
JSON
.
toJSONString
(
map
));
JSONObject
jsonParam
=
JSONObject
.
parseObject
(
JSON
.
toJSONString
(
map
));
logger
.
info
(
"请求实物兑换接口:"
+
"/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/
coupon
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");
// 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 {
...
@@ -165,16 +167,42 @@ public class gawService {
}
}
return
response
;
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
>
map
=
new
HashMap
<>();
Map
<
String
,
Object
>
mapList
=
new
HashMap
<>();
Map
<
String
,
Object
>
mapList
=
new
HashMap
<>();
List
<
Map
>
list
=
new
ArrayList
<>();
List
<
Map
>
list
=
new
ArrayList
<>();
mapList
.
put
(
"itemId"
,
itemId
);
mapList
.
put
(
"skuId"
,
skuId
);
mapList
.
put
(
"skuId"
,
skuId
);
mapList
.
put
(
"appItemId"
,
appItemId
);
mapList
.
put
(
"appItemId"
,
appItemId
);
mapList
.
put
(
"credits"
,
"100"
);
mapList
.
put
(
"credits"
,
"100"
);
...
@@ -183,38 +211,44 @@ public class gawService {
...
@@ -183,38 +211,44 @@ public class gawService {
map
.
put
(
"remark"
,
""
);
//买家留言
map
.
put
(
"remark"
,
""
);
//买家留言
map
.
put
(
"degreeId"
,
""
);
map
.
put
(
"actualPrice"
,
"0"
);
//总金额
map
.
put
(
"actualPrice"
,
"0"
);
//总金额
map
.
put
(
"actualCredits"
,
"100"
);
//总积分
map
.
put
(
"actualCredits"
,
"100"
);
//总积分
map
.
put
(
"itemParam"
,
list
.
toArray
());
map
.
put
(
"itemParam"
,
list
.
toArray
());
map
.
put
(
"payType"
,
"3"
);
map
.
put
(
"payType"
,
"3"
);
map
.
put
(
"expressPrice"
,
"0"
);
map
.
put
(
"validate"
,
""
);
map
.
put
(
"validate"
,
""
);
map
.
put
(
"token"
,
"yrJRr7Cddp2YeQd"
);
map
.
put
(
"token"
,
"yrJRr7Cddp2YeQd"
);
JSONObject
jsonParam
=
JSONObject
.
parseObject
(
JSON
.
toJSONString
(
map
));
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
(
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
{
try
{
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"success"
),
"true"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"success"
),
"true"
);
}
catch
(
Exception
e
){
}
catch
(
Exception
e
){
throw
new
Exception
(
"/gaw/
coupon
Exchange/create接口返回异常,返回信息:"
+
response
.
asString
());
throw
new
Exception
(
"/gaw/
object
Exchange/create接口返回异常,返回信息:"
+
response
.
asString
());
}
catch
(
Error
er
){
}
catch
(
Error
er
){
throw
new
Exception
(
"/gaw/
coupon
Exchange/create接口返回异常,返回信息:"
+
response
.
asString
());
throw
new
Exception
(
"/gaw/
object
Exchange/create接口返回异常,返回信息:"
+
response
.
asString
());
}
}
return
response
;
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
>
map
=
new
HashMap
<>();
Map
<
String
,
Object
>
mapList
=
new
HashMap
<>();
Map
<
String
,
Object
>
mapList
=
new
HashMap
<>();
List
<
Map
>
list
=
new
ArrayList
<>();
List
<
Map
>
list
=
new
ArrayList
<>();
mapList
.
put
(
"itemId"
,
itemId
);
mapList
.
put
(
"skuId"
,
skuId
);
mapList
.
put
(
"skuId"
,
skuId
);
mapList
.
put
(
"appItemId"
,
appItemId
);
mapList
.
put
(
"appItemId"
,
appItemId
);
mapList
.
put
(
"credits"
,
"100"
);
mapList
.
put
(
"credits"
,
"100"
);
...
@@ -223,39 +257,34 @@ public class gawService {
...
@@ -223,39 +257,34 @@ public class gawService {
map
.
put
(
"remark"
,
""
);
//买家留言
map
.
put
(
"remark"
,
""
);
//买家留言
map
.
put
(
"degreeId"
,
""
);
map
.
put
(
"actualPrice"
,
"0"
);
//总金额
map
.
put
(
"actualPrice"
,
"0"
);
//总金额
map
.
put
(
"actualCredits"
,
"100"
);
//总积分
map
.
put
(
"actualCredits"
,
"100"
);
//总积分
map
.
put
(
"itemParam"
,
list
.
toArray
());
map
.
put
(
"itemParam"
,
list
.
toArray
());
map
.
put
(
"payType"
,
"3"
);
map
.
put
(
"payType"
,
"3"
);
map
.
put
(
"expressPrice"
,
"0"
);
map
.
put
(
"validate"
,
""
);
map
.
put
(
"validate"
,
""
);
map
.
put
(
"token"
,
"yrJRr7Cddp2YeQd"
);
map
.
put
(
"token"
,
"yrJRr7Cddp2YeQd"
);
JSONObject
jsonParam
=
JSONObject
.
parseObject
(
JSON
.
toJSONString
(
map
));
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
(
cookie
).
body
(
jsonParam
).
post
(
"http://"
+
goodsHost
+
"/gaw/couponExchange/create"
);
Response
response
=
given
().
contentType
(
"application/json; charset=UTF-8"
).
cookies
(
cookies
).
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
{
try
{
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"success"
),
"true"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"success"
),
"true"
);
}
catch
(
Exception
e
){
}
catch
(
Exception
e
){
throw
new
Exception
(
"/gaw/
object
Exchange/create接口返回异常,返回信息:"
+
response
.
asString
());
throw
new
Exception
(
"/gaw/
coupon
Exchange/create接口返回异常,返回信息:"
+
response
.
asString
());
}
catch
(
Error
er
){
}
catch
(
Error
er
){
throw
new
Exception
(
"/gaw/
object
Exchange/create接口返回异常,返回信息:"
+
response
.
asString
());
throw
new
Exception
(
"/gaw/
coupon
Exchange/create接口返回异常,返回信息:"
+
response
.
asString
());
}
}
return
response
;
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
>
map
=
new
HashMap
<>();
Map
<
String
,
Object
>
mapList
=
new
HashMap
<>();
Map
<
String
,
Object
>
mapList
=
new
HashMap
<>();
...
@@ -280,7 +309,7 @@ public class gawService {
...
@@ -280,7 +309,7 @@ public class gawService {
JSONObject
jsonParam
=
JSONObject
.
parseObject
(
JSON
.
toJSONString
(
map
));
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
(
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");
// 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 {
...
@@ -299,17 +328,15 @@ public class gawService {
}
}
//虚拟商品兑换接口
//普通自有新实物兑换接口
public
Response
virtualExchange
(
Map
cookie
,
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
>
map
=
new
HashMap
<>();
Map
<
String
,
Object
>
mapList
=
new
HashMap
<>();
Map
<
String
,
Object
>
mapList
=
new
HashMap
<>();
List
<
Map
>
list
=
new
ArrayList
<>();
List
<
Map
>
list
=
new
ArrayList
<>();
mapList
.
put
(
"itemId"
,
itemId
);
mapList
.
put
(
"skuId"
,
skuId
);
mapList
.
put
(
"skuId"
,
skuId
);
mapList
.
put
(
"appItemId"
,
appItemId
);
mapList
.
put
(
"appItemId"
,
appItemId
);
mapList
.
put
(
"credits"
,
credits
);
mapList
.
put
(
"credits"
,
"100"
);
mapList
.
put
(
"price"
,
0
);
mapList
.
put
(
"price"
,
0
);
list
.
add
(
mapList
);
list
.
add
(
mapList
);
...
@@ -317,7 +344,7 @@ public class gawService {
...
@@ -317,7 +344,7 @@ public class gawService {
map
.
put
(
"remark"
,
""
);
//买家留言
map
.
put
(
"remark"
,
""
);
//买家留言
map
.
put
(
"degreeId"
,
""
);
map
.
put
(
"degreeId"
,
""
);
map
.
put
(
"actualPrice"
,
"0"
);
//总金额
map
.
put
(
"actualPrice"
,
"0"
);
//总金额
map
.
put
(
"actualCredits"
,
actualCredits
);
//总积分
map
.
put
(
"actualCredits"
,
"100"
);
//总积分
map
.
put
(
"itemParam"
,
list
.
toArray
());
map
.
put
(
"itemParam"
,
list
.
toArray
());
map
.
put
(
"payType"
,
"3"
);
map
.
put
(
"payType"
,
"3"
);
map
.
put
(
"expressPrice"
,
"0"
);
map
.
put
(
"expressPrice"
,
"0"
);
...
@@ -326,8 +353,8 @@ public class gawService {
...
@@ -326,8 +353,8 @@ public class gawService {
JSONObject
jsonParam
=
JSONObject
.
parseObject
(
JSON
.
toJSONString
(
map
));
JSONObject
jsonParam
=
JSONObject
.
parseObject
(
JSON
.
toJSONString
(
map
));
logger
.
info
(
"请求实物兑换接口:"
+
"/gaw/
object
Exchange/create"
);
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/object
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");
// 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 {
...
@@ -343,6 +370,7 @@ public class gawService {
}
}
return
response
;
return
response
;
}
}
...
@@ -578,30 +606,5 @@ public class gawService {
...
@@ -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
;
}
}
}
src/test/java/utils/RedisUtil.java
View file @
9fd3d239
...
@@ -60,6 +60,7 @@ public class RedisUtil {
...
@@ -60,6 +60,7 @@ public class RedisUtil {
map
.
put
(
"key"
,
key
);
map
.
put
(
"key"
,
key
);
Response
response
=
given
().
params
(
map
).
get
(
"http://activity.m.duibatest.com.cn/seedRedPacket/clearObjectKey"
);
Response
response
=
given
().
params
(
map
).
get
(
"http://activity.m.duibatest.com.cn/seedRedPacket/clearObjectKey"
);
response
.
prettyPrint
();
}
}
public
static
void
main
(
String
[]
args
)
{
public
static
void
main
(
String
[]
args
)
{
...
...
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