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
8ee2ea5e
Commit
8ee2ea5e
authored
Dec 05, 2019
by
吕雯燕
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'duiba_wenyan'
parents
060492a5
614497eb
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
47 deletions
+28
-47
兑吧新优惠券_兑换流程测试_ExchangeTest.java
...a/http/cases/ExchangeTest/兑吧新优惠券_兑换流程测试_ExchangeTest.java
+28
-47
No files found.
src/test/java/http/cases/ExchangeTest/兑吧新优惠券_兑换流程测试_ExchangeTest.java
View file @
8ee2ea5e
...
...
@@ -9,17 +9,15 @@ import http.service.app.tawService;
import
http.service.hd.DeveloperAccountService
;
import
http.service.hd.DappConfigService
;
import
org.apache.logging.log4j.core.pattern.AbstractStyleNameConverter
;
import
org.testng.annotations.AfterClass
;
import
org.testng.annotations.BeforeClass
;
import
org.testng.annotations.DataProvider
;
import
org.testng.annotations.*
;
import
utils.MatcherString
;
import
base.DuibaLog
;
import
io.restassured.response.Response
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.testng.Assert
;
import
org.testng.annotations.Test
;
import
java.lang.reflect.Method
;
import
java.sql.SQLException
;
import
java.util.HashMap
;
import
java.util.Map
;
import
utils.RedisUtil
;
...
...
@@ -68,6 +66,32 @@ public class 兑吧新优惠券_兑换流程测试_ExchangeTest extends CheckTem
}
@BeforeMethod
public
void
before
(){
try
{
//更新数据表 每人限购批次限制测试
jdbc
.
update
(
"DELETE FROM credits_dev.consumer_limit_record WHERE item_id = 32514"
);
jdbc
.
update
(
"DELETE FROM credits_dev.consumer_limit_record_only WHERE item_id = 32514"
);
//更新数据表,每人限购永久限制测试
jdbc
.
update
(
"DELETE FROM credits_dev.consumer_limit_record WHERE item_id = 32513"
);
jdbc
.
update
(
"DELETE FROM credits_dev.consumer_limit_record_only WHERE item_id = 32513"
);
//更新数据表,每人限购每日限制测试
jdbc
.
update
(
"DELETE FROM credits_dev.consumer_limit_record WHERE item_id = 32512"
);
//更新数据表,每日限量测试
jdbc
.
update
(
"DELETE FROM goods.tb_everyday_limit WHERE item_id = 32515"
);
}
catch
(
SQLException
e
)
{
e
.
printStackTrace
();
}
}
@Test
(
description
=
"兑吧新优惠券每人限购每日"
)
public
void
每人限购每日限制测试
()
throws
Exception
{
...
...
@@ -77,7 +101,6 @@ public class 兑吧新优惠券_兑换流程测试_ExchangeTest extends CheckTem
Map
cookies
=
authorization
.
dafuwengLogin
(
uid
);
String
message
=
""
;
try
{
//第一次兑换
Response
response
=
gawService
.
couponExchange
(
cookies
,
appItemId
,
itemId
,
skuId
);
String
orderId
=
response
.
jsonPath
().
getString
(
"data.orderId"
);
...
...
@@ -118,15 +141,6 @@ public class 兑吧新优惠券_兑换流程测试_ExchangeTest extends CheckTem
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
+
"'"
);
}
}
...
...
@@ -140,7 +154,6 @@ public class 兑吧新优惠券_兑换流程测试_ExchangeTest extends CheckTem
Map
cookies
=
authorization
.
dafuwengLogin
(
uid
);
String
message
=
""
;
try
{
//第一次兑换
Response
response
=
gawService
.
couponExchange
(
cookies
,
appItemId
,
itemId
,
skuId
);
String
orderId
=
response
.
jsonPath
().
getString
(
"data.orderId"
);
...
...
@@ -180,16 +193,6 @@ public class 兑吧新优惠券_兑换流程测试_ExchangeTest extends CheckTem
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
+
"'"
);
}
}
...
...
@@ -203,7 +206,6 @@ public class 兑吧新优惠券_兑换流程测试_ExchangeTest extends CheckTem
Map
cookies
=
authorization
.
dafuwengLogin
(
uid
);
String
message
=
""
;
try
{
//第一次兑换
Response
response
=
gawService
.
couponExchange
(
cookies
,
appItemId
,
itemId
,
skuId
);
String
orderId
=
response
.
jsonPath
().
getString
(
"data.orderId"
);
...
...
@@ -244,16 +246,6 @@ public class 兑吧新优惠券_兑换流程测试_ExchangeTest extends CheckTem
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
+
"'"
);
}
}
...
...
@@ -267,7 +259,6 @@ public class 兑吧新优惠券_兑换流程测试_ExchangeTest extends CheckTem
Map
cookies
=
authorization
.
dafuwengLogin
(
uid
);
String
message
=
""
;
try
{
//第一次兑换
Response
response
=
gawService
.
couponExchange
(
cookies
,
appItemId
,
itemId
,
skuId
);
String
orderId
=
response
.
jsonPath
().
getString
(
"data.orderId"
);
...
...
@@ -307,16 +298,6 @@ public class 兑吧新优惠券_兑换流程测试_ExchangeTest extends CheckTem
Assert
.
assertEquals
(
exchangeText
,
"每日限量已兑完"
,
"校验兑换按钮失败"
);
logger
.
info
(
"校验优惠券每日限量成功"
);
}
catch
(
Exception
e
){
throw
new
Exception
(
"异常信息打印:"
+
e
);
}
finally
{
jdbc
.
update
(
"DELETE FROM goods.tb_everyday_limit WHERE item_id = '"
+
itemId
+
"'"
);
}
}
...
...
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