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
81775641
Commit
81775641
authored
Nov 12, 2018
by
panyuli
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'panyuli' into develop
parents
12afc8b3
5e2d9f85
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
435 additions
and
83 deletions
+435
-83
优惠券_兑换流程测试_ExchangeTest.java
...java/http/cases/ExchangeTest/优惠券_兑换流程测试_ExchangeTest.java
+1
-7
优惠券_兑换流程测试pyl_ExchangeTest.java
...a/http/cases/ExchangeTest/优惠券_兑换流程测试pyl_ExchangeTest.java
+181
-0
虚拟商品_兑换异常测试.java
src/test/java/http/cases/ExchangeTest/虚拟商品_兑换异常测试.java
+0
-71
虚拟商品_兑换异常测试_ExchangeTest.java
...ava/http/cases/ExchangeTest/虚拟商品_兑换异常测试_ExchangeTest.java
+193
-0
CrecordService.java
src/test/java/http/service/app/CrecordService.java
+1
-0
LogService.java
src/test/java/http/service/app/LogService.java
+37
-0
MobileService.java
src/test/java/http/service/app/MobileService.java
+21
-2
VirtualExchangeService.java
src/test/java/http/service/app/VirtualExchangeService.java
+1
-3
No files found.
src/test/java/http/cases/ExchangeTest/优惠券_兑换流程测试_ExchangeTest.java
View file @
81775641
...
...
@@ -17,10 +17,7 @@ import org.testng.annotations.Test;
import
java.lang.reflect.Method
;
import
java.text.SimpleDateFormat
;
import
java.util.Calendar
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.*
;
import
static
io
.
restassured
.
RestAssured
.
given
;
...
...
@@ -776,8 +773,6 @@ public class 优惠券_兑换流程测试_ExchangeTest extends DuibaTestBase {
}
//优惠券兑换接口抽离
public
Response
优惠券兑换
(
String
appItemId
,
String
itemId
,
int
uid
)
throws
Exception
{
Response
response
=
couponExchangeService
.
couponExchange
(
authorization
.
dafuwengLogin
(
uid
),
appItemId
,
itemId
);
...
...
@@ -822,5 +817,4 @@ public class 优惠券_兑换流程测试_ExchangeTest extends DuibaTestBase {
}
src/test/java/http/cases/ExchangeTest/优惠券_兑换流程测试pyl_ExchangeTest.java
0 → 100644
View file @
81775641
package
http
.
cases
.
ExchangeTest
;
import
base.DuibaLog
;
import
base.DuibaTestBase
;
import
http.service.Activity.ManagerService
;
import
http.service.Authorization
;
import
http.service.app.CouponExchangeService
;
import
http.service.app.CrecordService
;
import
http.service.app.LogService
;
import
http.service.app.MobileService
;
import
http.service.hd.DeveloperAccountService
;
import
http.service.hd.DsOrderService
;
import
io.restassured.response.Response
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.testng.Assert
;
import
org.testng.annotations.AfterClass
;
import
org.testng.annotations.DataProvider
;
import
org.testng.annotations.Test
;
import
utils.MatcherString
;
import
utils.RedisUtil
;
import
java.lang.reflect.Method
;
import
java.text.SimpleDateFormat
;
import
java.util.Calendar
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.Map
;
import
static
io
.
restassured
.
RestAssured
.
given
;
/**
* Created by panyuli on 2018/07/06.
*/
public
class
优惠券
_
兑换流程测试
pyl_ExchangeTest
extends
DuibaTestBase
{
@Autowired
private
MobileService
mobileService
;
@Autowired
private
Authorization
authorization
;
@Autowired
private
CouponExchangeService
couponExchangeService
;
@Autowired
private
DsOrderService
dsOrderService
;
@Autowired
ManagerService
managerService
;
@Autowired
DeveloperAccountService
developerAccountService
;
@Autowired
CrecordService
crecordService
;
@Autowired
LogService
logService
;
private
DuibaLog
logger
=
DuibaLog
.
getLogger
();
// private MysqlUtils jdbc;
private
String
url
=
"http://activity.m.duibatest.com.cn"
;
//指定用户
private
static
int
uid
=
4478
;
@Test
(
description
=
"自有优惠券商品兑换成功页添加跳转链接开启,界面按钮显示"
)
public
void
兑换成功页添加跳转链接开启
()
throws
Exception
{
logger
.
info
(
"自有优惠券商品兑换成功页添加跳转链接开启,界面按钮显示"
);
Response
response
=
mobileService
.
appItemDetail
(
authorization
.
dafuwengLogin
(
uid
),
"185439"
);
// response.prettyPrint();
// logger.info( "response.prettyPrint()"+ response.asString());
Map
<
String
,
String
>
map
=
authorization
.
dafuwengLogin
(
uid
,
true
);
// Iterator it = map.entrySet().iterator();
// while (it.hasNext()) {
// Map.Entry entry = (Map.Entry) it.next();
// Object key = entry.getKey();
// Object value = entry.getValue();
// System.out.println("key=" + key + " value=" + value);
// }
Assert
.
assertEquals
(
response
.
asString
().
contains
(
"马上兑换"
),
true
,
"页面数据返回错误"
);
logger
.
info
(
"校验 页面数据文本信息 成功"
);
response
=
couponExchangeService
.
couponExchange
(
authorization
.
dafuwengLogin
(
uid
),
"185439"
,
null
);
String
orderId
=
response
.
jsonPath
().
getString
(
"orderId"
);
logger
.
info
(
"订单号:"
+
orderId
);
response
=
mobileService
.
orderStatusQuery
(
authorization
.
dafuwengLogin
(
uid
),
orderId
);
response
.
prettyPrint
();
String
status
=
response
.
jsonPath
().
getString
(
"status"
);
//异步接口
int
i
=
10
;
while
(
i
>
0
&&
status
.
equals
(
"processing"
))
{
Thread
.
sleep
(
1000
);
response
=
mobileService
.
orderStatusQuery
(
authorization
.
dafuwengLogin
(
uid
),
orderId
);
response
.
prettyPrint
();
status
=
response
.
jsonPath
().
getString
(
"status"
);
i
--;
}
// response.prettyPrint();
Response
resultResponse
=
crecordService
.
recordDetail
(
orderId
,
uid
);
//resultResponse.prettyPrint();
String
exchangeText
=
MatcherString
.
getString
(
resultResponse
.
asString
(),
"\"btnText\":\"(.*?)\","
,
1
);
logger
.
info
(
"exchangeText"
+
exchangeText
);
Assert
.
assertEquals
(
resultResponse
.
asString
().
contains
(
"马上使用"
),
true
,
"页面数据返回错误"
);
Assert
.
assertEquals
(
exchangeText
,
"马上使用"
,
"页面数据返回错误"
);
logger
.
info
(
"自有优惠券商品兑换成功页添加跳转链接开启,界面按钮显示息 成功"
);
}
@Test
(
description
=
"自有优惠券兑换失败兑换条展示错乱 bugid=908131"
)
public
void
优惠券兑换失败兑换条展示错乱
()
throws
Exception
{
logger
.
info
(
"自有优惠券商品兑换成功页添加跳转链接开启,界面按钮显示"
);
Response
response
=
mobileService
.
appItemDetail
(
authorization
.
dafuwengLogin
(
uid
),
"185529"
);
Map
<
String
,
String
>
map
=
authorization
.
dafuwengLogin
(
uid
,
true
);
Assert
.
assertEquals
(
response
.
asString
().
contains
(
"马上兑换"
),
true
,
"页面数据返回错误"
);
logger
.
info
(
"校验 页面数据文本信息 成功"
);
response
=
couponExchangeService
.
couponExchange
(
authorization
.
dafuwengLogin
(
uid
),
"185529"
,
null
);
String
orderId
=
response
.
jsonPath
().
getString
(
"orderId"
);
logger
.
info
(
"订单号:"
+
orderId
);
response
=
mobileService
.
orderStatusQuery
(
authorization
.
dafuwengLogin
(
uid
),
orderId
);
response
.
prettyPrint
();
String
status
=
response
.
jsonPath
().
getString
(
"status"
);
//异步接口
int
i
=
10
;
while
(
i
>
0
&&
status
.
equals
(
"processing"
))
{
Thread
.
sleep
(
1000
);
response
=
mobileService
.
orderStatusQuery
(
authorization
.
dafuwengLogin
(
uid
),
orderId
);
response
.
prettyPrint
();
status
=
response
.
jsonPath
().
getString
(
"status"
);
i
--;
}
// response.prettyPrint();
Response
resultResponse
=
crecordService
.
recordDetailNew
(
orderId
,
uid
);
resultResponse
.
prettyPrint
();
String
exchangeText
=
MatcherString
.
getString
(
resultResponse
.
asString
(),
"\"isShowButton\":(.*?),"
,
1
);
logger
.
info
(
"exchangeText:"
+
exchangeText
);
Assert
.
assertEquals
(
exchangeText
,
"false"
,
"页面数据返回错误"
);
Assert
.
assertEquals
(
resultResponse
.
asString
().
contains
(
"马上兑换"
),
false
,
"页面数据返回错误"
);
//Assert.assertEquals(resultResponse.asString().contains("审核中"),true,"页面数据返回错误");
logger
.
info
(
"自有优惠券兑换失败兑换条展示错乱 成功"
);
}
@Test
(
description
=
"自有优惠券商品兑换成功页添加跳转链接开启,界面按钮显示"
)
public
void
兑换成功页添加界面按钮显示且可以正常调转
()
throws
Exception
{
logger
.
info
(
"自有优惠券商品兑换成功页添加跳转链接开启,界面按钮显示"
);
Response
response
=
mobileService
.
appItemDetail
(
authorization
.
dafuwengLogin
(
uid
),
"185571"
);
// response.prettyPrint();
// logger.info( "response.prettyPrint()"+ response.asString());
Map
<
String
,
String
>
map
=
authorization
.
dafuwengLogin
(
uid
,
true
);
Assert
.
assertEquals
(
response
.
asString
().
contains
(
"马上兑换"
),
true
,
"页面数据返回错误"
);
logger
.
info
(
"校验 页面数据文本信息 成功"
);
response
=
couponExchangeService
.
couponExchange
(
authorization
.
dafuwengLogin
(
uid
),
"185571"
,
null
);
String
orderId
=
response
.
jsonPath
().
getString
(
"orderId"
);
logger
.
info
(
"订单号:"
+
orderId
);
response
=
mobileService
.
orderStatusQuery
(
authorization
.
dafuwengLogin
(
uid
),
orderId
);
response
.
prettyPrint
();
String
status
=
response
.
jsonPath
().
getString
(
"status"
);
//异步接口
int
i
=
10
;
while
(
i
>
0
&&
status
.
equals
(
"processing"
))
{
Thread
.
sleep
(
1000
);
response
=
mobileService
.
orderStatusQuery
(
authorization
.
dafuwengLogin
(
uid
),
orderId
);
response
.
prettyPrint
();
status
=
response
.
jsonPath
().
getString
(
"status"
);
i
--;
}
// response.prettyPrint();
Response
resultResponse
=
crecordService
.
recordDetail
(
orderId
,
uid
);
//resultResponse.prettyPrint();
String
exchangeText
=
MatcherString
.
getString
(
resultResponse
.
asString
(),
"\"btnText\":\"(.*?)\","
,
1
);
logger
.
info
(
"exchangeText"
+
exchangeText
);
Assert
.
assertEquals
(
resultResponse
.
asString
().
contains
(
"马上兑换"
),
true
,
"页面数据返回错误"
);
Assert
.
assertEquals
(
exchangeText
,
"马上兑换"
,
"页面数据返回错误"
);
exchangeText
=
MatcherString
.
getString
(
resultResponse
.
asString
(),
"\"androidDownloadUrl\":\"(.*?)\","
,
1
);
String
url
=
exchangeText
;
logger
.
info
(
"url:"
+
url
);
// resultResponse.prettyPrint();
Assert
.
assertEquals
(
resultResponse
.
asString
().
contains
(
"www.baidu.com"
),
true
,
"按钮对应的连接数据返回错误"
);
logger
.
info
(
"自有优惠券商品兑换成功页添加跳转链接开启,界面按钮显示息 成功"
);
}
}
src/test/java/http/cases/ExchangeTest/虚拟商品_兑换异常测试.java
deleted
100644 → 0
View file @
12afc8b3
package
http
.
cases
.
ExchangeTest
;
import
base.DuibaTestBase
;
import
http.service.Activity.ManagerService
;
import
http.service.Authorization
;
import
http.service.app.MobileService
;
import
http.service.app.VirtualExchangeService
;
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.util.Map
;
/**
* Created by yeqinqin on 2018/6/11.
*/
public
class
虚拟商品
_
兑换异常测试
extends
DuibaTestBase
{
@Autowired
private
MobileService
mobileService
;
@Autowired
private
Authorization
authorization
;
@Autowired
ManagerService
managerService
;
@Autowired
VirtualExchangeService
virtualExchangeService
;
private
DuibaLog
logger
=
DuibaLog
.
getLogger
();
//指定用户
private
static
int
uid
=
0
;
//实物兑换积分不足
@Test
(
description
=
"自有虚拟商品积分不足"
)
public
void
积分不足
()
throws
Exception
{
//活动详情页
Response
response
=
mobileService
.
appItemDetail
(
authorization
.
dafuwengLogin
(
uid
),
"181159"
);
Map
<
String
,
String
>
map
=
authorization
.
dafuwengLogin
(
uid
,
true
);
Assert
.
assertEquals
(
String
.
valueOf
(
response
.
getStatusCode
()),
"200"
,
"商品详情页面"
);
response
.
prettyPrint
();
System
.
out
.
println
(
response
.
asString
());
System
.
out
.
println
(
"女汉子"
);
//自有虚拟商品兑换
response
=
virtualExchangeService
.
exchange
(
authorization
.
dafuwengLogin
(
uid
),
"181159"
,
"123"
);
//获取orderId
String
orderId
=
response
.
jsonPath
().
getString
(
"orderId"
);
response
=
mobileService
.
orderAmbStatusQuery
(
uid
,
orderId
);
response
.
prettyPrint
();
String
message
=
response
.
jsonPath
().
getString
(
"data.message"
);
//异步接口,直到兑换成功
int
i
=
10
;
//异步接口,直到兑换成功
while
(
i
>
0
&&
"兑换正在处理中..."
.
equals
(
message
)){
Thread
.
sleep
(
1000
);
response
=
mobileService
.
orderAmbStatusQuery
(
uid
,
orderId
);
response
.
prettyPrint
();
message
=
response
.
jsonPath
().
getString
(
"data.message"
);
i
--;
}
Assert
.
assertEquals
(
message
.
trim
(),
"兑换失败,用户积分余额不足"
,
"校验自有虚拟商品积分不足"
);
}
}
src/test/java/http/cases/ExchangeTest/虚拟商品_兑换异常测试_ExchangeTest.java
0 → 100644
View file @
81775641
package
http
.
cases
.
ExchangeTest
;
import
base.DuibaTestBase
;
import
http.service.Activity.ManagerService
;
import
http.service.Authorization
;
import
http.service.app.CrecordService
;
import
http.service.app.MobileService
;
import
http.service.app.VirtualExchangeService
;
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
utils.MatcherString
;
import
java.util.Map
;
/**
* Created by panyuli on 2018/6/11.
*/
public
class
虚拟商品
_
兑换异常测试
_ExchangeTest
extends
DuibaTestBase
{
@Autowired
private
MobileService
mobileService
;
@Autowired
private
Authorization
authorization
;
@Autowired
ManagerService
managerService
;
@Autowired
VirtualExchangeService
virtualExchangeService
;
@Autowired
CrecordService
crecordService
;
private
DuibaLog
logger
=
DuibaLog
.
getLogger
();
//指定用户
private
static
int
uid
=
4502
;
//实物兑换积分不足
@Test
(
description
=
"自有虚拟商品积分不足"
)
public
void
自有虚拟商品积分不足
()
throws
Exception
{
logger
.
info
(
"自有虚拟商品积分不足"
);
uid
=
3086
;
//商品详情页面
Response
response
=
mobileService
.
appItemDetail
(
authorization
.
dafuwengLogin
(
uid
),
"185534"
);
Map
<
String
,
String
>
map
=
authorization
.
dafuwengLogin
(
uid
,
true
);
response
.
prettyPrint
();
Assert
.
assertEquals
(
response
.
asString
().
contains
(
"不足,去赚"
),
true
,
"页面数据返回错误"
);
logger
.
info
(
"校验 页面数据文本信息 成功"
);
//自有虚拟商品兑换
response
=
virtualExchangeService
.
exchange
(
authorization
.
dafuwengLogin
(
uid
),
"185534"
,
"121"
);
response
.
prettyPrint
();
//获取orderId
String
orderId
=
response
.
jsonPath
().
getString
(
"orderId"
);
logger
.
info
(
"orderid:"
+
orderId
);
response
=
mobileService
.
orderAmbStatusQuery
(
uid
,
orderId
);
String
message
=
response
.
jsonPath
().
getString
(
"data.message"
);
int
i
=
10
;
//异步接口,直到兑换成功
while
(
i
>
0
&&
"兑换正在处理中..."
.
equals
(
message
)){
Thread
.
sleep
(
1000
);
response
=
mobileService
.
orderAmbStatusQuery
(
uid
,
orderId
);
response
.
prettyPrint
();
message
=
response
.
jsonPath
().
getString
(
"data.message"
);
i
--;
}
Assert
.
assertEquals
(
message
.
trim
(),
"兑换失败,用户积分余额不足"
,
"校验自有虚拟商品积分不足"
);
logger
.
info
(
"校验积分不足验证成功"
);
}
@Test
(
description
=
"自有虚拟商品库存不足"
)
public
void
自有虚拟商品库存不足
()
throws
Exception
{
logger
.
info
(
"自有虚拟商品库存不足"
);
//用户id
uid
=
4502
;
//活动详情页
Response
response
=
mobileService
.
appItemDetail
(
authorization
.
dafuwengLogin
(
uid
),
"185535"
);
Map
<
String
,
String
>
map
=
authorization
.
dafuwengLogin
(
uid
,
true
);
Assert
.
assertEquals
(
response
.
asString
().
contains
(
"已兑完"
),
true
,
"页面数据返回错误"
);
logger
.
info
(
"校验 页面数据文本信息 成功"
);
String
message
=
null
;
try
{
response
=
virtualExchangeService
.
exchange
(
authorization
.
dafuwengLogin
(
uid
),
"185535"
,
"123"
);
response
.
prettyPrint
();
}
catch
(
Exception
e
){
message
=
e
.
toString
();
}
Assert
.
assertTrue
(
message
.
contains
(
"今日已兑完,明天再来哦(14)"
),
"今日已兑完,校验失败"
);
logger
.
info
(
"自有虚拟商品库存不足"
);
}
@Test
(
description
=
"虚拟商品用户每日兑换限制测试只能兑换一次"
)
public
void
自有虚拟商品用户每日兑换限制测试只能兑换一次
()
throws
Exception
{
try
{
logger
.
info
(
"虚拟商品用户每日兑换限制测试只能兑换一次"
);
//商品详情页面
Response
response
=
mobileService
.
appItemDetail
(
authorization
.
dafuwengLogin
(
uid
),
"185684"
);
Map
<
String
,
String
>
map
=
authorization
.
dafuwengLogin
(
uid
,
true
);
Assert
.
assertEquals
(
response
.
asString
().
contains
(
"马上兑换"
),
true
,
"页面数据返回错误"
);
logger
.
info
(
"校验 页面数据文本信息 成功"
);
//自有虚拟商品兑换
response
=
virtualExchangeService
.
exchange
(
authorization
.
dafuwengLogin
(
uid
),
"185684"
,
"123"
);
//获取orderId
String
orderId
=
response
.
jsonPath
().
getString
(
"orderId"
);
logger
.
info
(
"orderid:"
+
orderId
);
response
=
mobileService
.
orderAmbStatusQuery
(
uid
,
orderId
);
String
message
=
response
.
jsonPath
().
getString
(
"data.message"
);
int
i
=
10
;
//异步接口,直到兑换成功
while
(
i
>
0
&&
"兑换正在处理中..."
.
equals
(
message
)){
Thread
.
sleep
(
1000
);
response
=
mobileService
.
orderAmbStatusQuery
(
uid
,
orderId
);
response
.
prettyPrint
();
message
=
response
.
jsonPath
().
getString
(
"data.message"
);
i
--;
}
Response
resultResponse
=
crecordService
.
recordDetailNew
(
orderId
,
uid
);
String
exchangeText
=
MatcherString
.
getString
(
resultResponse
.
asString
(),
"\"exchangeStatusText\":\"(.*?)\","
,
1
);
logger
.
info
(
"exchangeText"
+
exchangeText
);
Assert
.
assertEquals
(
resultResponse
.
asString
().
contains
(
"兑换成功"
),
true
,
"兑换数据页面数据返回错误"
);
//按钮层校验
response
=
mobileService
.
appItemDetail
(
authorization
.
dafuwengLogin
(
uid
),
"185684"
);
Assert
.
assertEquals
(
response
.
asString
().
contains
(
"今日已兑换"
),
true
,
"页面数据返回错误"
);
// 第二次兑换接口层校验
response
=
virtualExchangeService
.
exchange
(
authorization
.
dafuwengLogin
(
uid
),
"185684"
,
"123"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"message"
).
contains
(
"今日已兑换"
),
true
,
"接口数据返回数据返回错误"
);
logger
.
info
(
"虚拟商品用户每日兑换限制测试只能兑换一次 成功"
);
}
catch
(
Exception
e
){
throw
new
Exception
(
"异常信息打印:"
+
e
);
}
finally
{
jdbc
.
update
(
"DELETE FROM credits_dev.consumer_limit_record_only WHERE app_item_id = '185684'"
);
jdbc
.
update
(
"DELETE FROM credits_dev.consumer_limit_record WHERE app_item_id = '185684'"
);
}
}
@Test
(
description
=
"虚拟商品用户永久兑换"
)
public
void
自有虚拟商品用户永久一次兑换
()
throws
Exception
{
try
{
logger
.
info
(
"自有虚拟商品用户永久一次兑换"
);
//商品详情页面
Response
response
=
mobileService
.
appItemDetail
(
authorization
.
dafuwengLogin
(
uid
),
"185738"
);
Map
<
String
,
String
>
map
=
authorization
.
dafuwengLogin
(
uid
,
true
);
response
.
prettyPrint
();
Assert
.
assertEquals
(
response
.
asString
().
contains
(
"马上兑换"
),
true
,
"页面数据返回错误"
);
logger
.
info
(
"校验 页面数据文本信息 成功"
);
//自有虚拟商品兑换
response
=
virtualExchangeService
.
exchange
(
authorization
.
dafuwengLogin
(
uid
),
"185738"
,
"123"
);
//获取orderId
String
orderId
=
response
.
jsonPath
().
getString
(
"orderId"
);
logger
.
info
(
"orderid:"
+
orderId
);
response
=
mobileService
.
orderAmbStatusQuery
(
uid
,
orderId
);
String
message
=
response
.
jsonPath
().
getString
(
"data.message"
);
int
i
=
10
;
//异步接口,直到兑换成功
while
(
i
>
0
&&
"兑换正在处理中..."
.
equals
(
message
)){
Thread
.
sleep
(
1000
);
response
=
mobileService
.
orderAmbStatusQuery
(
uid
,
orderId
);
response
.
prettyPrint
();
message
=
response
.
jsonPath
().
getString
(
"data.message"
);
i
--;
}
Response
resultResponse
=
crecordService
.
recordDetailNew
(
orderId
,
uid
);
String
exchangeText
=
MatcherString
.
getString
(
resultResponse
.
asString
(),
"\"exchangeStatusText\":\"(.*?)\","
,
1
);
logger
.
info
(
"exchangeText"
+
exchangeText
);
Assert
.
assertEquals
(
resultResponse
.
asString
().
contains
(
"兑换成功"
),
true
,
"兑换数据页面数据返回错误"
);
// 第二次兑换 按钮层校验
// response = mobileService.appItemDetail(authorization.dafuwengLogin(uid), "185684");
// response.prettyPrint();
// Assert.assertEquals(response.asString().contains("已兑换"),true,"页面数据返回错误");
// 第二次兑换接口层校验
response
=
virtualExchangeService
.
exchange
(
authorization
.
dafuwengLogin
(
uid
),
"185684"
,
"123"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"message"
).
contains
(
"今日已兑换"
),
true
,
"接口数据返回数据返回错误"
);
logger
.
info
(
"虚拟商品用户永久兑换 成功"
);
}
catch
(
Exception
e
){
throw
new
Exception
(
"异常信息打印:"
+
e
);
}
finally
{
jdbc
.
update
(
"DELETE FROM credits_dev.consumer_limit_record_only WHERE app_item_id = '185738'"
);
jdbc
.
update
(
"DELETE FROM credits_dev.consumer_limit_record WHERE app_item_id = '185738'"
);
}
}
//@Test(description = "虚拟商品自定义兑换按钮文案马上使用按钮")
public
void
虚拟商品自定义兑换按钮文案马上使用按钮
()
throws
Exception
{
logger
.
info
(
"虚拟商品马上使用按钮验证开始"
);
//创建虚拟商品的时候,有自定义兑换按钮文案的文案设置,将文案设置成马上使用
}
}
\ No newline at end of file
src/test/java/http/service/app/CrecordService.java
View file @
81775641
...
...
@@ -56,4 +56,5 @@ public class CrecordService {
return
response
;
}
}
src/test/java/http/service/app/LogService.java
0 → 100644
View file @
81775641
package
http
.
service
.
app
;
import
http.service.Authorization
;
import
io.restassured.response.Response
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Service
;
import
java.util.HashMap
;
import
java.util.Map
;
import
static
io
.
restassured
.
RestAssured
.
given
;
@Service
public
class
LogService
{
@Value
(
"${trade.host}"
)
private
String
tradeHost
;
@Autowired
Authorization
authorization
;
//优惠券使用按钮
public
Response
redirect
(
String
url
,
int
uid
){
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"url"
,
url
);
map
.
put
(
"dpm"
,
"2239.25.1.0"
);
map
.
put
(
"dcm"
,
"102.185571.0.0"
);
map
.
put
(
"couponcode"
,
"10000106"
);
Response
response
=
given
().
cookies
(
authorization
.
dafuwengLogin
(
uid
)).
params
(
map
).
get
(
"http://"
+
tradeHost
+
"/log/redirect"
);
return
response
;
}
}
src/test/java/http/service/app/MobileService.java
View file @
81775641
...
...
@@ -32,7 +32,7 @@ public class MobileService {
}
public
Response
appItemDetail
(
Map
cookies
,
String
itemId
){
/*
public Response appItemDetail(Map cookies,String itemId){
Map<String,String> map = new HashMap<>();
map.put("itemId",itemId);
map.put("dpm","1.5.183.5");
...
...
@@ -41,8 +41,27 @@ public class MobileService {
response.prettyPrint();
return response;
}
}*/
public
Response
appItemDetail
(
Map
cookies
,
String
appItemId
)
throws
Exception
{
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"appItemId"
,
appItemId
);
map
.
put
(
"dpm"
,
"1.5.183.5"
);
map
.
put
(
"dcm"
,
"102.181159.0.0"
);
logger
.
info
(
"请求商品详情页面"
);
Response
response
=
given
().
cookies
(
cookies
).
params
(
map
).
get
(
"http://"
+
goodsHost
+
"/mobile/appItemDetail"
);
try
{
Assert
.
assertEquals
(
String
.
valueOf
(
response
.
getStatusCode
()),
"200"
,
"/mobile/appItemDetail接口失败"
);
}
catch
(
Exception
e
)
{
throw
new
Exception
(
"/mobile/appItemDetail接口失败,返回信息:"
+
response
.
asString
());
}
catch
(
Error
er
)
{
throw
new
Exception
(
"/mobile/appItemDetail接口失败,返回信息:"
+
response
.
asString
());
}
return
response
;
}
// public Response orderStatusQuery(Cookies cookies,String orderId){
//
...
...
src/test/java/http/service/app/VirtualExchangeService.java
View file @
81775641
...
...
@@ -29,11 +29,9 @@ public class VirtualExchangeService {
logger
.
info
(
"请求/virtualExchange/exchange接口"
);
Response
response
=
given
().
contentType
(
"application/x-www-form-urlencoded;charset=UTF-8"
).
cookies
(
cookies
).
params
(
map
).
post
(
"http://"
+
goodsHost
+
"/virtualExchange/exchange"
);
//couponExchange
// response.prettyPrint();
try
{
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"success"
),
"true"
);
System
.
out
.
println
(
""
);
}
catch
(
Exception
e
){
throw
new
Exception
(
"/objectExchange/exchange接口返回异常,返回信息:"
+
response
.
asString
());
...
...
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