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
4289696d
Commit
4289696d
authored
Mar 26, 2019
by
马博
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
efcd6009
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
65 additions
and
65 deletions
+65
-65
自有新优惠券_兑换限制测试.java
...java/http/cases/ExchangeTest/自有_商品兑换限制/自有新优惠券_兑换限制测试.java
+63
-63
gawService.java
src/test/java/http/service/app/gawService.java
+2
-2
No files found.
src/test/java/http/cases/ExchangeTest/自有_商品兑换限制/自有新优惠券_兑换限制测试.java
View file @
4289696d
...
...
@@ -78,7 +78,7 @@ public class 自有新优惠券_兑换限制测试 extends CheckTemplet{
try
{
//第一次兑换
Response
response
=
gawService
.
couponExchange
(
uid
,
appItemId
);
Response
response
=
gawService
.
couponExchange
(
uid
,
appItemId
,
38
);
response
.
prettyPrint
();
String
orderId
=
response
.
jsonPath
().
getString
(
"data.orderId"
);
//获取兑换结果
...
...
@@ -103,7 +103,7 @@ public class 自有新优惠券_兑换限制测试 extends CheckTemplet{
//第二次兑换
Thread
.
sleep
(
3000
);
try
{
response
=
gawService
.
couponExchange
(
uid
,
appItemId
);
response
=
gawService
.
couponExchange
(
uid
,
appItemId
,
38
);
response
.
prettyPrint
();
}
catch
(
Exception
e
){
...
...
@@ -128,67 +128,67 @@ public class 自有新优惠券_兑换限制测试 extends CheckTemplet{
}
//
@Test
//
public void 用户永久限制消费测试() throws Exception {
//
// String appItemId = "19382
3";
//
//
try{
//
//
//第一次兑换
// Response response = couponExchangeService.couponExchange(authorization.dafuwengLogin(uid), appItemId, null
);
// String orderId = response.jsonPath().getString("
orderId");
//
//获取兑换结果
// response = mobileService.orderStatusQuery(uid,orderI
d);
//
response.prettyPrint();
//
String message = response.jsonPath().getString("message");
//
int i = 10;
//
//异步接口,直到兑换成功
//
while (i > 0 && "兑换正在处理中...".equals(message)) {
//
Thread.sleep(1000);
// response = mobileService.orderStatusQuery(uid,orderI
d);
//
response.prettyPrint();
//
message = response.jsonPath().getString("message");
//
i--;
//
}
//
//
Response detailResponse = mobileService.appItemDetail(authorization.dafuwengLogin(uid),appItemId);
//
detailResponse.prettyPrint();
//
String exchangeText = MatcherString.getString(detailResponse.asString(), "\"exchangeText\":\"(.*?)\",", 1);
//
logger.info("商品兑换按钮:" + exchangeText);
//
//
//第二次兑换
//
Thread.sleep(3000);
//
try{
// response = couponExchangeService.couponExchange(authorization.dafuwengLogin(uid), appItemId, null
);
//
response.prettyPrint();
//
//
}catch (Exception e){
//
message = e.toString();
//
}
//
logger.info(message);
//
//
Assert.assertTrue(message.contains("已达兑换次数上限"),"校验message失败");
//
Assert.assertTrue(message.contains("\"success\":false"),"校验success失败");
//
//
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+"'");
//
//
jdbc.update("DELETE FROM credits_dev.consumer_limit_record_only WHERE item_id = '"+itemId+"'");
//
//
//
//
}
//
//
//
}
//
@Test
public
void
用户永久限制消费测试
()
throws
Exception
{
String
appItemId
=
"19384
3"
;
try
{
//第一次兑换
Response
response
=
gawService
.
couponExchange
(
uid
,
appItemId
,
40
);
String
orderId
=
response
.
jsonPath
().
getString
(
"data.
orderId"
);
//获取兑换结果
response
=
tawService
.
orderStatus
(
orderId
,
ui
d
);
response
.
prettyPrint
();
String
message
=
response
.
jsonPath
().
getString
(
"message"
);
int
i
=
10
;
//异步接口,直到兑换成功
while
(
i
>
0
&&
"兑换正在处理中..."
.
equals
(
message
))
{
Thread
.
sleep
(
1000
);
response
=
tawService
.
orderStatus
(
orderId
,
ui
d
);
response
.
prettyPrint
();
message
=
response
.
jsonPath
().
getString
(
"message"
);
i
--;
}
Response
detailResponse
=
mobileService
.
appItemDetail
(
authorization
.
dafuwengLogin
(
uid
),
appItemId
);
detailResponse
.
prettyPrint
();
String
exchangeText
=
MatcherString
.
getString
(
detailResponse
.
asString
(),
"\"exchangeText\":\"(.*?)\","
,
1
);
logger
.
info
(
"商品兑换按钮:"
+
exchangeText
);
//第二次兑换
Thread
.
sleep
(
3000
);
try
{
response
=
gawService
.
couponExchange
(
uid
,
appItemId
,
40
);
response
.
prettyPrint
();
}
catch
(
Exception
e
){
message
=
e
.
toString
();
}
logger
.
info
(
message
);
Assert
.
assertTrue
(
message
.
contains
(
"已达兑换次数上限"
),
"校验message失败"
);
Assert
.
assertTrue
(
message
.
contains
(
"\"success\":false"
),
"校验success失败"
);
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+"'");
// jdbc.update("DELETE FROM credits_dev.consumer_limit_record_only WHERE item_id = '"+itemId+"'");
}
}
// @Test
// public void 每日兑换上限测试() throws Exception {
//
...
...
src/test/java/http/service/app/gawService.java
View file @
4289696d
...
...
@@ -75,12 +75,12 @@ public class gawService {
}
//优惠券兑换接口
public
Response
couponExchange
(
int
uid
,
String
appItemId
)
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
(
"skuId"
,
38
);
mapList
.
put
(
"skuId"
,
skuId
);
mapList
.
put
(
"appItemId"
,
appItemId
);
mapList
.
put
(
"credits"
,
"100"
);
mapList
.
put
(
"price"
,
0
);
...
...
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