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
b565ebab
Commit
b565ebab
authored
Apr 03, 2019
by
吕雯燕
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lv
parent
cef646ff
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
220 additions
and
5 deletions
+220
-5
兑吧卡密_兑换流程测试_ExchangeTest.java
...ava/http/cases/ExchangeTest/兑吧卡密_兑换流程测试_ExchangeTest.java
+44
-0
自有新优惠券_兑换限制测试_ExchangeTest.java
...es/ExchangeTest/自有_商品兑换限制/自有新优惠券_兑换限制测试_ExchangeTest.java
+83
-5
自有新卡密_兑换限制测试_ExchangeTest.java
...ses/ExchangeTest/自有_商品兑换限制/自有新卡密_兑换限制测试_ExchangeTest.java
+5
-0
自有老优惠券商品_兑换限制测试_ExchangeTest.java
.../ExchangeTest/自有_商品兑换限制/自有老优惠券商品_兑换限制测试_ExchangeTest.java
+88
-0
No files found.
src/test/java/http/cases/ExchangeTest/兑吧卡密_兑换流程测试_ExchangeTest.java
View file @
b565ebab
...
@@ -2,6 +2,7 @@ package http.cases.ExchangeTest;
...
@@ -2,6 +2,7 @@ package http.cases.ExchangeTest;
import
base.DuibaBase
;
import
base.DuibaBase
;
import
base.DuibaBases
;
import
base.DuibaBases
;
import
com.sun.jna.platform.win32.OaIdl
;
import
http.service.Activity.ManagerService
;
import
http.service.Activity.ManagerService
;
import
http.service.Authorization
;
import
http.service.Authorization
;
import
http.service.app.MobileService
;
import
http.service.app.MobileService
;
...
@@ -10,6 +11,7 @@ import http.service.app.tawService;
...
@@ -10,6 +11,7 @@ import http.service.app.tawService;
import
http.service.hd.DeveloperAccountService
;
import
http.service.hd.DeveloperAccountService
;
import
http.service.hd.DappConfigService
;
import
http.service.hd.DappConfigService
;
import
org.apache.logging.log4j.core.pattern.AbstractStyleNameConverter
;
import
org.apache.logging.log4j.core.pattern.AbstractStyleNameConverter
;
import
org.codehaus.jackson.annotate.JsonTypeInfo
;
import
org.testng.annotations.AfterClass
;
import
org.testng.annotations.AfterClass
;
import
org.testng.annotations.BeforeClass
;
import
org.testng.annotations.BeforeClass
;
import
org.testng.annotations.DataProvider
;
import
org.testng.annotations.DataProvider
;
...
@@ -459,6 +461,48 @@ public class 兑吧卡密_兑换流程测试_ExchangeTest extends CheckTemplet {
...
@@ -459,6 +461,48 @@ public class 兑吧卡密_兑换流程测试_ExchangeTest extends CheckTemplet {
}
}
@Test
(
description
=
"兑吧卡密跳转按钮"
)
public
void
马上使用跳转
()
throws
Exception
{
String
appItemId
=
"194957"
;
String
itemId
=
"32603"
;
String
skuId
=
"94"
;
Map
cookies
=
authorization
.
dafuwengLogin
(
uid
);
//优惠券兑换
Response
response
=
gawService
.
couponExchange
(
cookies
,
appItemId
,
itemId
,
skuId
);
String
orderId
=
response
.
jsonPath
().
getString
(
"data.orderId"
);
//获取兑换结果
response
=
tawService
.
orderStatus
(
orderId
,
uid
);
response
.
prettyPrint
();
String
status
=
response
.
jsonPath
().
getString
(
"data.status"
);
int
i
=
10
;
//异步接口,直到兑换成功
while
(
i
>
0
&&
status
.
equals
(
"processing"
))
{
Thread
.
sleep
(
1000
);
response
=
tawService
.
orderStatus
(
orderId
,
uid
);
response
.
prettyPrint
();
status
=
response
.
jsonPath
().
getString
(
"data.status"
);
i
--;
}
//优惠券订单结果页
Thread
.
sleep
(
3000
);
Response
detailResponse
=
tawService
.
detailItems
(
orderId
,
uid
);
detailResponse
.
prettyPrint
();
String
useButtonText
=
detailResponse
.
jsonPath
().
getString
(
"data[0].useButtonText"
);
String
iosDownloadUrl
=
detailResponse
.
jsonPath
().
getString
(
"data[0].iosDownloadUrl"
);
String
credits
=
detailResponse
.
jsonPath
().
getString
(
"data[0].credits"
);
Assert
.
assertEquals
(
useButtonText
,
"去使用"
,
"校验去使用按钮失败"
);
Assert
.
assertEquals
(
iosDownloadUrl
,
"http://www.iqiyi.com"
,
"校验按钮链接失败"
);
Assert
.
assertEquals
(
credits
,
"100"
,
"校验积分失败"
);
logger
.
info
(
"校验兑吧卡密去使用跳转按钮成功"
);
}
}
}
src/test/java/http/cases/ExchangeTest/自有_商品兑换限制/自有新优惠券_兑换限制测试_ExchangeTest.java
View file @
b565ebab
...
@@ -59,16 +59,25 @@ public class 自有新优惠券_兑换限制测试_ExchangeTest extends CheckTem
...
@@ -59,16 +59,25 @@ public class 自有新优惠券_兑换限制测试_ExchangeTest extends CheckTem
Object
[][]
result
=
null
;
Object
[][]
result
=
null
;
if
(
method
.
getName
().
equals
(
"日期兑换限制测试"
))
{
if
(
method
.
getName
().
equals
(
"日期兑换限制测试"
))
{
result
=
new
Object
[][]{
result
=
new
Object
[][]{
new
Object
[]{
1
,
"194281"
,
78
,
"
实物
日期兑换限制未开始测试"
},
//case1
new
Object
[]{
1
,
"194281"
,
78
,
"
优惠券
日期兑换限制未开始测试"
},
//case1
new
Object
[]{
2
,
"194282"
,
79
,
"
实物
日期兑换限制进行中测试"
},
//case2
new
Object
[]{
2
,
"194282"
,
79
,
"
优惠券
日期兑换限制进行中测试"
},
//case2
new
Object
[]{
3
,
"194283"
,
80
,
"
实物
日期兑换限制已结束"
},
//case3
new
Object
[]{
3
,
"194283"
,
80
,
"
优惠券
日期兑换限制已结束"
},
//case3
};
};
}
}
if
(
method
.
getName
().
equals
(
"库存不足测试"
))
{
if
(
method
.
getName
().
equals
(
"库存不足测试"
))
{
result
=
new
Object
[][]{
result
=
new
Object
[][]{
new
Object
[]{
"193847"
,
"
实物
库存不足测试"
},
//case1
new
Object
[]{
"193847"
,
"
优惠券
库存不足测试"
},
//case1
};
};
}
}
if
(
method
.
getName
().
equals
(
"优惠券马上使用按钮测试"
)){
result
=
new
Object
[][]{
new
Object
[]{
1
,
"194961"
,
96
,
"普通券马上使用按钮测试"
},
//case1
new
Object
[]{
2
,
"194962"
,
97
,
"链接券马上使用按钮测试"
},
//case2
new
Object
[]{
3
,
"194963"
,
98
,
"重复券马上使用按钮测试"
},
//case2
};
}
return
result
;
return
result
;
}
}
@Test
@Test
...
@@ -210,7 +219,7 @@ public class 自有新优惠券_兑换限制测试_ExchangeTest extends CheckTem
...
@@ -210,7 +219,7 @@ public class 自有新优惠券_兑换限制测试_ExchangeTest extends CheckTem
//异步接口,直到兑换成功
//异步接口,直到兑换成功
while
(
i
>
0
&&
"兑换正在处理中..."
.
equals
(
message
))
{
while
(
i
>
0
&&
"兑换正在处理中..."
.
equals
(
message
))
{
Thread
.
sleep
(
1000
);
Thread
.
sleep
(
1000
);
response
=
mobileService
.
orderStatusQuery
(
uid
,
orderI
d
);
response
=
tawService
.
orderStatus
(
orderId
,
ui
d
);
response
.
prettyPrint
();
response
.
prettyPrint
();
message
=
response
.
jsonPath
().
getString
(
"message"
);
message
=
response
.
jsonPath
().
getString
(
"message"
);
i
--;
i
--;
...
@@ -435,4 +444,73 @@ public class 自有新优惠券_兑换限制测试_ExchangeTest extends CheckTem
...
@@ -435,4 +444,73 @@ public class 自有新优惠券_兑换限制测试_ExchangeTest extends CheckTem
}
}
/**
* @param caseNum 用例编号
* @param appItemId 商品入库Id
* @param skuId skuId
* @param caseName 用例名称打印
* @throws Exception
*/
@Test
(
dataProvider
=
"providerMethod"
)
public
void
优惠券马上使用按钮测试
(
int
caseNum
,
String
appItemId
,
int
skuId
,
String
caseName
)
throws
Exception
{
int
uid
=
7028
;
logger
.
info
(
caseName
);
//优惠券兑换
Response
response
=
gawService
.
couponExchange
(
authorization
.
dafuwengLogin
(
uid
),
appItemId
,
skuId
);
response
.
prettyPrint
();
String
orderId
=
response
.
jsonPath
().
getString
(
"data.orderId"
);
//获取兑换结果
response
=
tawService
.
orderStatus
(
orderId
,
uid
);
response
.
prettyPrint
();
String
message
=
response
.
jsonPath
().
getString
(
"message"
);
int
i
=
10
;
//异步接口,直到兑换成功
while
(
i
>
0
&&
"兑换正在处理中..."
.
equals
(
message
))
{
Thread
.
sleep
(
1000
);
response
=
tawService
.
orderStatus
(
orderId
,
uid
);
response
.
prettyPrint
();
message
=
response
.
jsonPath
().
getString
(
"message"
);
i
--;
}
//优惠券订单结果页
Thread
.
sleep
(
3000
);
Response
detailResponse
=
tawService
.
detailItems
(
orderId
,
uid
);
String
useButtonText
=
detailResponse
.
jsonPath
().
getString
(
"data[0].useButtonText"
);
String
iosDownloadUrl
=
detailResponse
.
jsonPath
().
getString
(
"data[0].iosDownloadUrl"
);
String
credits
=
detailResponse
.
jsonPath
().
getString
(
"data[0].credits"
);
logger
.
info
(
"跳转链接:"
+
iosDownloadUrl
);
switch
(
caseNum
){
case
1
:
Assert
.
assertEquals
(
useButtonText
,
"去使用"
,
"校验按钮文案失败"
);
Assert
.
assertEquals
(
iosDownloadUrl
,
"https://www.duiba.com.cn"
,
"校验按钮跳转链接失败"
);
Assert
.
assertEquals
(
credits
,
"100"
,
"校验积分失败"
);
logger
.
info
(
"校验普通券码跳转按钮成功"
);
break
;
case
2
:
Assert
.
assertEquals
(
useButtonText
,
"去使用"
,
"校验按钮文案失败"
);
Assert
.
assertEquals
(
iosDownloadUrl
,
"https://www.iqiyi.com"
,
"校验按钮跳转链接失败"
);
Assert
.
assertEquals
(
credits
,
"100"
,
"校验积分失败"
);
logger
.
info
(
"校验链接券跳转按钮成功"
);
break
;
case
3
:
Assert
.
assertEquals
(
useButtonText
,
"去使用"
,
"校验按钮文案失败"
);
Assert
.
assertEquals
(
iosDownloadUrl
,
"https://www.baidu.com"
,
"校验按钮跳转链接失败"
);
Assert
.
assertEquals
(
credits
,
"100"
,
"校验积分失败"
);
logger
.
info
(
"校验重复券跳转按钮成功"
);
break
;
}
}
}
}
src/test/java/http/cases/ExchangeTest/自有_商品兑换限制/自有新卡密_兑换限制测试_ExchangeTest.java
View file @
b565ebab
...
@@ -476,4 +476,9 @@ public class 自有新卡密_兑换限制测试_ExchangeTest extends CheckTemple
...
@@ -476,4 +476,9 @@ public class 自有新卡密_兑换限制测试_ExchangeTest extends CheckTemple
}
}
}
}
src/test/java/http/cases/ExchangeTest/自有_商品兑换限制/自有老优惠券商品_兑换限制测试_ExchangeTest.java
View file @
b565ebab
...
@@ -8,6 +8,8 @@ import http.service.app.MobileService;
...
@@ -8,6 +8,8 @@ import http.service.app.MobileService;
import
http.service.app.VirtualExchangeService
;
import
http.service.app.VirtualExchangeService
;
import
http.service.hd.DappConfigService
;
import
http.service.hd.DappConfigService
;
import
http.service.hd.DeveloperAccountService
;
import
http.service.hd.DeveloperAccountService
;
import
http.service.app.CrecordService
;
import
http.service.app.tawService
;
import
io.restassured.response.Response
;
import
io.restassured.response.Response
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.testng.Assert
;
import
org.testng.Assert
;
...
@@ -41,6 +43,10 @@ public class 自有老优惠券商品_兑换限制测试_ExchangeTest extends Ch
...
@@ -41,6 +43,10 @@ public class 自有老优惠券商品_兑换限制测试_ExchangeTest extends Ch
DeveloperAccountService
developerAccountService
;
DeveloperAccountService
developerAccountService
;
@Autowired
@Autowired
DappConfigService
dappConfigService
;
DappConfigService
dappConfigService
;
@Autowired
CrecordService
crecordService
;
@Autowired
tawService
tawService
;
private
int
uid
=
7000
;
private
int
uid
=
7000
;
private
String
consumerId
=
"100144141"
;
private
String
consumerId
=
"100144141"
;
...
@@ -78,6 +84,13 @@ public class 自有老优惠券商品_兑换限制测试_ExchangeTest extends Ch
...
@@ -78,6 +84,13 @@ public class 自有老优惠券商品_兑换限制测试_ExchangeTest extends Ch
new
Object
[]{
"193826"
,
"实物库存不足测试"
},
//case1
new
Object
[]{
"193826"
,
"实物库存不足测试"
},
//case1
};
};
}
}
if
(
method
.
getName
().
equals
(
"优惠券马上使用按钮测试"
)){
result
=
new
Object
[][]{
new
Object
[]{
1
,
"194958"
,
"自有优惠券普通跳转链接测试"
},
//case1
new
Object
[]{
2
,
"194959"
,
"自有优惠券链接券跳转测试"
},
//case2
};
}
return
result
;
return
result
;
}
}
@Test
@Test
...
@@ -443,4 +456,79 @@ public class 自有老优惠券商品_兑换限制测试_ExchangeTest extends Ch
...
@@ -443,4 +456,79 @@ public class 自有老优惠券商品_兑换限制测试_ExchangeTest extends Ch
}
}
/**
* @param caseNum 用例编号
* @param appItemId 商品入库Id
* @param caseName 用例名称打印
* @throws Exception
*/
@Test
(
dataProvider
=
"providerMethod"
)
public
void
优惠券马上使用按钮测试
(
int
caseNum
,
String
appItemId
,
String
caseName
)
throws
Exception
{
logger
.
info
(
caseName
);
//优惠券兑换
Response
response
=
couponExchangeService
.
couponExchange
(
authorization
.
dafuwengLogin
(
uid
),
appItemId
,
null
);
response
.
prettyPrint
();
String
orderId
=
response
.
jsonPath
().
getString
(
"orderId"
);
//获取兑换结果
response
=
mobileService
.
orderStatusQuery
(
uid
,
orderId
);
response
.
prettyPrint
();
String
message
=
response
.
jsonPath
().
getString
(
"message"
);
int
i
=
10
;
//异步接口,直到兑换成功
while
(
i
>
0
&&
"兑换正在处理中..."
.
equals
(
message
))
{
Thread
.
sleep
(
1000
);
response
=
mobileService
.
orderStatusQuery
(
uid
,
orderId
);
response
.
prettyPrint
();
message
=
response
.
jsonPath
().
getString
(
"message"
);
i
--;
}
//优惠券兑换结果页
Response
resultResponse
=
crecordService
.
recordDetail
(
orderId
,
uid
);
// resultResponse.prettyPrint();
String
btnText
=
MatcherString
.
getString
(
resultResponse
.
asString
(),
"\"btnText\":\"(.*?)\","
,
1
);
String
actualPay
=
MatcherString
.
getString
(
resultResponse
.
asString
(),
"\"actualPay\":\"(.*?)\","
,
1
);
String
androidDownloadUrl
=
MatcherString
.
getString
(
resultResponse
.
asString
(),
"\"androidDownloadUrl\":\"(.*?)\","
,
1
);
logger
.
info
(
"跳转链接:"
+
androidDownloadUrl
);
//优惠券兑换记录页
Thread
.
sleep
(
3000
);
Response
detailResponse
=
tawService
.
detailItems
(
orderId
,
uid
);
// detailResponse.prettyPrint();
String
useButtonText
=
detailResponse
.
jsonPath
().
getString
(
"data[0].useButtonText"
);
String
iosDownloadUrl
=
detailResponse
.
jsonPath
().
getString
(
"data[0].iosDownloadUrl"
);
switch
(
caseNum
){
case
1
:
Assert
.
assertEquals
(
btnText
,
"马上前往"
,
"校验结果页按钮文案失败"
);
Assert
.
assertEquals
(
actualPay
,
"1积分"
,
"校验结果页积分文案失败"
);
Assert
.
assertEquals
(
androidDownloadUrl
,
"//activity.m.duibatest.com.cn/log/redirect?url=http%3A%2F%2Fwww.baidu.com&dpm=2239.25.1.0&dcm=102.194958.0.0"
,
"校验结果页按钮链接失败"
);
Assert
.
assertEquals
(
useButtonText
,
"去使用"
,
"校验兑换记录页按钮文案失败"
);
Assert
.
assertEquals
(
iosDownloadUrl
,
"http://www.iqiyi.com"
,
"校验兑换记录页按钮跳转链接失败"
);
logger
.
info
(
"校验自有优惠券普通券码跳转按钮成功"
);
break
;
case
2
:
Assert
.
assertEquals
(
btnText
,
"马上使用"
,
"校验结果页按钮文案失败"
);
Assert
.
assertEquals
(
actualPay
,
"1积分"
,
"校验结果页积分文案失败"
);
Assert
.
assertEquals
(
androidDownloadUrl
,
"//activity.m.duibatest.com.cn/log/redirect?url=https%3A%2F%2Fhj.vc%2F2fzK&dpm=2239.25.1.0&dcm=102.194959.0.0"
,
"校验结果页按钮链接失败"
);
Assert
.
assertEquals
(
useButtonText
,
"去使用"
,
"校验兑换记录页按钮文案失败"
);
Assert
.
assertEquals
(
iosDownloadUrl
,
"https://hj.vc/2fzK"
,
"校验兑换记录页按钮跳转链接失败"
);
logger
.
info
(
"校验自有优惠券链接券跳转按钮功"
);
break
;
}
}
}
}
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