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
bfe69838
Commit
bfe69838
authored
Mar 12, 2019
by
吕雯燕
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lv
parent
e579132d
Changes
2
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
80 additions
and
12 deletions
+80
-12
优惠券_兑换流程测试_ExchangeTest.java
...java/http/cases/ExchangeTest/优惠券_兑换流程测试_ExchangeTest.java
+80
-12
兑吧老实物_兑换流程测试_ExchangeTest.java
...va/http/cases/ExchangeTest/兑吧老实物_兑换流程测试_ExchangeTest.java
+0
-0
No files found.
src/test/java/http/cases/ExchangeTest/优惠券_兑换流程测试_ExchangeTest.java
View file @
bfe69838
...
...
@@ -263,7 +263,6 @@ public class 优惠券_兑换流程测试_ExchangeTest extends CheckTemplet {
map
.
put
(
"itemId"
,
itemId
);
map
.
put
(
"token"
,
token
);
//优惠券兑换
Response
response
=
given
().
contentType
(
"application/x-www-form-urlencoded;charset=UTF-8"
).
cookies
(
authorization
.
dafuwengLogin
(
uid
)).
params
(
map
).
post
(
url
+
"/couponExchange/exchange"
);
response
.
prettyPrint
();
...
...
@@ -400,8 +399,8 @@ public class 优惠券_兑换流程测试_ExchangeTest extends CheckTemplet {
//获取按钮状态
Response
detailResponse
=
mobileService
.
detail
(
authorization
.
dafuwengLogin
(
uid
),
"29293"
);
detailResponse
.
prettyPrint
();
String
exchangeText
=
MatcherString
.
getString
(
detailResponse
.
asString
(),
"\"exchangeText\":\"(.*?)\","
,
1
);
logger
.
info
(
"兑换按钮:"
+
exchangeText
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"message"
),
"已达兑换次数上限"
,
"校验用户兑换限制失败"
);
Assert
.
assertEquals
(
exchangeText
,
"已达兑换次数上限"
,
"校验马上兑换按钮状态失败"
);
...
...
@@ -424,16 +423,18 @@ public class 优惠券_兑换流程测试_ExchangeTest extends CheckTemplet {
@Test
public
void
优惠券用户每日兑换限制测试
()
throws
Exception
{
String
appItemId
=
"191781"
;
String
itemId
=
"32377"
;
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"appItemId"
,
"171478"
);
map
.
put
(
"itemId"
,
"29531"
);
map
.
put
(
"appItemId"
,
appItemId
);
map
.
put
(
"itemId"
,
itemId
);
map
.
put
(
"token"
,
"yrJRr7Cddp2YeQd"
);
try
{
//优惠券兑换,用户兑换限制次数1次
Response
response
=
this
.
优惠券兑换
(
"171478"
,
"29531"
,
uid
);
Response
response
=
this
.
优惠券兑换
(
appItemId
,
itemId
,
uid
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"status"
),
"success"
,
"校验兑换失败"
);
logger
.
info
(
"用户成功兑换一次"
);
//再次兑换
Thread
.
sleep
(
3000
);
...
...
@@ -441,13 +442,13 @@ public class 优惠券_兑换流程测试_ExchangeTest extends CheckTemplet {
response
.
prettyPrint
();
//获取按钮状态
Response
detailResponse
=
mobileService
.
detail
(
authorization
.
dafuwengLogin
(
uid
),
"29531"
);
detailResponse
.
prettyPrint
();
Response
detailResponse
=
mobileService
.
detail
(
authorization
.
dafuwengLogin
(
uid
),
itemId
);
String
exchangeText
=
MatcherString
.
getString
(
detailResponse
.
asString
(),
"\"exchangeText\":\"(.*?)\","
,
1
);
logger
.
info
(
"兑换按钮:"
+
exchangeText
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"message"
),
"今日已达兑换上限"
,
"校验用户兑换限制失败"
);
Assert
.
assertEquals
(
exchangeText
,
"今日已达兑换上限"
,
"校验马上兑换按钮状态失败"
);
logger
.
info
(
"校验优惠券用户每
天
兑换限制成功"
);
logger
.
info
(
"校验优惠券用户每
日
兑换限制成功"
);
}
catch
(
Exception
e
){
...
...
@@ -455,12 +456,53 @@ public class 优惠券_兑换流程测试_ExchangeTest extends CheckTemplet {
}
finally
{
jdbc
.
update
(
"DELETE FROM credits_dev.consumer_limit_record WHERE item_id = '
29531
'"
);
jdbc
.
update
(
"DELETE FROM credits_dev.consumer_limit_record WHERE item_id = '
"
+
itemId
+
"
'"
);
}
}
@Test
public
void
优惠券用户批次兑换限制测试
()
throws
Exception
{
String
appItemId
=
"191782"
;
String
itemId
=
"32378"
;
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"appItemId"
,
appItemId
);
map
.
put
(
"itemId"
,
itemId
);
map
.
put
(
"token"
,
"yrJRr7Cddp2YeQd"
);
try
{
//优惠券兑换,用户兑换限制次数1次
Response
response
=
this
.
优惠券兑换
(
appItemId
,
itemId
,
uid
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"status"
),
"success"
,
"校验兑换失败"
);
//再次兑换
Thread
.
sleep
(
3000
);
response
=
given
().
contentType
(
"application/x-www-form-urlencoded;charset=UTF-8"
).
cookies
(
authorization
.
dafuwengLogin
(
uid
)).
params
(
map
).
post
(
url
+
"/couponExchange/exchange"
);
response
.
prettyPrint
();
//获取按钮状态
Response
detailResponse
=
mobileService
.
detail
(
authorization
.
dafuwengLogin
(
uid
),
itemId
);
String
exchangeText
=
MatcherString
.
getString
(
detailResponse
.
asString
(),
"\"exchangeText\":\"(.*?)\","
,
1
);
logger
.
info
(
"兑换按钮:"
+
exchangeText
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"message"
),
"已达兑换次数上限"
,
"校验用户兑换限制失败"
);
Assert
.
assertEquals
(
exchangeText
,
"已达兑换次数上限"
,
"校验马上兑换按钮状态失败"
);
logger
.
info
(
"校验优惠券用户批次兑换限制成功"
);
}
catch
(
Exception
e
){
throw
new
Exception
(
"异常信息打印:"
+
e
);
}
finally
{
jdbc
.
update
(
"DELETE FROM credits_dev.consumer_limit_record WHERE item_id = '"
+
itemId
+
"'"
);
}
}
@Test
public
void
优惠券每日兑换上限测试
()
throws
Exception
{
...
...
@@ -474,7 +516,6 @@ public class 优惠券_兑换流程测试_ExchangeTest extends CheckTemplet {
//优惠券兑换,用户兑换限制次数1次
Response
response
=
this
.
优惠券兑换
(
"170295"
,
"29294"
,
uid
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"status"
),
"success"
,
"校验兑换失败"
);
logger
.
info
(
"用户成功兑换一次"
);
//再次兑换
Thread
.
sleep
(
3000
);
...
...
@@ -483,8 +524,8 @@ public class 优惠券_兑换流程测试_ExchangeTest extends CheckTemplet {
//获取按钮状态
Response
detailResponse
=
mobileService
.
detail
(
authorization
.
dafuwengLogin
(
uid
),
"29294"
);
detailResponse
.
prettyPrint
();
String
exchangeText
=
MatcherString
.
getString
(
detailResponse
.
asString
(),
"\"exchangeText\":\"(.*?)\","
,
1
);
logger
.
info
(
"兑换按钮:"
+
exchangeText
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"message"
),
"今日已兑完,明天再来哦(14)"
,
"校验每日兑换上限失败"
);
...
...
@@ -719,6 +760,33 @@ public class 优惠券_兑换流程测试_ExchangeTest extends CheckTemplet {
}
@Test
public
void
会员等级测试
()
throws
Exception
{
String
appItemId
=
"191778"
;
String
itemId
=
"32374"
;
String
message
=
""
;
//会员等级无法兑换
try
{
Response
response
=
couponExchangeService
.
objectExchange
(
authorization
.
dafuwengLogin
(
uid
),
appItemId
,
itemId
,
"null"
,
"yrJRr7Cddp2YeQd"
,
"null"
);
response
.
prettyPrint
();
}
catch
(
Exception
e
){
message
=
e
.
toString
();
}
logger
.
info
(
message
);
//会员等级可兑换,vip=5
Response
response
=
couponExchangeService
.
objectExchange
(
authorization
.
generateSignAutoLogin
(
"2wGQc3MZaQsqYFWcX4gguya5PnnS"
,
3402
),
appItemId
,
itemId
,
"null"
,
"yrJRr7Cddp2YeQd"
,
"null"
);
response
.
prettyPrint
();
Assert
.
assertTrue
(
message
.
contains
(
"会员等级不符,请挑选其他吧(15)"
),
"校验message失败"
);
Assert
.
assertTrue
(
message
.
contains
(
"\"success\":false"
),
"校验success失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"success"
),
"true"
,
"校验兑换结果失败"
);
logger
.
info
(
"校验实物会员等级成功"
);
}
/**
* @param caseNum 用例编号
...
...
src/test/java/http/cases/ExchangeTest/实物_兑换流程测试_ExchangeTest.java
→
src/test/java/http/cases/ExchangeTest/
兑吧老
实物_兑换流程测试_ExchangeTest.java
View file @
bfe69838
This diff is collapsed.
Click to expand it.
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