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
8fb108e1
Commit
8fb108e1
authored
Nov 22, 2018
by
赵然
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop'
parents
664cd062
ae63d464
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
1325 additions
and
6 deletions
+1325
-6
CustomActivity_DuibaTest.java
...p/cases/DefinedActivityTest/CustomActivity_DuibaTest.java
+1
-1
优惠券_兑换异常测试_ExchangeTest.java
...java/http/cases/ExchangeTest/优惠券_兑换异常测试_ExchangeTest.java
+2
-1
虚拟商品_兑换异常测试_ExchangeTest.java
...ava/http/cases/ExchangeTest/虚拟商品_兑换异常测试_ExchangeTest.java
+531
-0
优惠券测试_DuibaTest.java
...test/java/http/cases/NewActivityTest/优惠券测试_DuibaTest.java
+1
-1
谢谢参与测试_DuibaTest.java
...est/java/http/cases/NewActivityTest/谢谢参与测试_DuibaTest.java
+1
-0
修改兑吧商品.java
src/test/java/http/cases/SaasDeveloperTest/修改兑吧商品.java
+79
-0
补给站.java
src/test/java/http/cases/SaasDeveloperTest/补给站.java
+86
-0
种红包配置校验_AccessTest.java
src/test/java/http/cases/WalletTest/种红包配置校验_AccessTest.java
+54
-3
DeveloperBJZ.java
src/test/java/http/service/Saas/DeveloperBJZ.java
+182
-0
DoUpdateAppItemService.java
src/test/java/http/service/Saas/DoUpdateAppItemService.java
+366
-0
VirtualExchangeService.java
src/test/java/http/service/app/VirtualExchangeService.java
+22
-0
No files found.
src/test/java/http/cases/DefinedActivityTest/CustomActivity_DuibaTest.java
View file @
8fb108e1
...
...
@@ -95,7 +95,7 @@ public class CustomActivity_DuibaTest extends DuibaTestBase {
String
androidDL
=
MatcherString
.
getString
(
ManagerResponse
.
asString
(),
"androidurl: '(.*?)',"
,
1
);
String
iOSDL
=
MatcherString
.
getString
(
ManagerResponse
.
asString
(),
"iosurl: '(.*?)',"
,
1
);
String
usebtn
=
MatcherString
.
getString
(
ManagerResponse
.
asString
(),
"usebtn: '(.*?)',"
,
1
);
String
actLinkEx
=
"//activity.m.duibatest.com.cn/crecord/recordDetailNew
/
"
;
String
actLinkEx
=
"//activity.m.duibatest.com.cn/crecord/recordDetailNew"
;
String
linkUrl
=
MatcherString
.
getString
(
LinkResponse
.
asString
(),
"target=\"_blank\" href=\"(.*?)\">"
,
1
);
//进行接口测试传参
...
...
src/test/java/http/cases/ExchangeTest/优惠券_兑换
流程测试pyl
_ExchangeTest.java
→
src/test/java/http/cases/ExchangeTest/优惠券_兑换
异常测试
_ExchangeTest.java
View file @
8fb108e1
...
...
@@ -23,7 +23,8 @@ import static io.restassured.RestAssured.given;
* Created by panyuli on 2018/07/06.
*/
public
class
优惠券
_
兑换流程测试
pyl_ExchangeTest
extends
CheckTemplet
{
public
class
优惠券
_
兑换异常测试
_ExchangeTest
extends
CheckTemplet
{
@Autowired
private
MobileService
mobileService
;
...
...
src/test/java/http/cases/ExchangeTest/虚拟商品_兑换异常测试_ExchangeTest.java
0 → 100644
View file @
8fb108e1
package
http
.
cases
.
ExchangeTest
;
import
base.DuibaLog
;
import
base.DuibaTestBase
;
import
com.alibaba.fastjson.JSONObject
;
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
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
CheckTemplet
{
@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
(
"自有虚拟商品积分不足"
);
int
uid
=
3086
;
//商品详情页面
Response
response
=
mobileService
.
appItemDetail
(
authorization
.
dafuwengLogin
(
uid
),
"185534"
);
response
.
prettyPrint
();
Assert
.
assertEquals
(
response
.
asString
().
contains
(
"不足,去赚"
),
true
,
"页面数据返回错误"
);
logger
.
info
(
"校验 页面数据文本信息 成功"
);
//自有虚拟商品兑换
response
=
virtualExchangeService
.
exchange2
(
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
(
"自有虚拟商品库存不足"
);
//活动详情页
Response
response
=
mobileService
.
appItemDetail
(
authorization
.
dafuwengLogin
(
uid
),
"185535"
);
response
.
prettyPrint
();
String
exchangeText
=
MatcherString
.
getString
(
response
.
asString
(),
"\"exchangeText\":\"(.*?)\","
,
1
);
logger
.
info
(
"exchangeText"
+
exchangeText
);
Assert
.
assertEquals
(
exchangeText
,
"已兑完"
,
"页面数据返回错误"
);
logger
.
info
(
"校验 页面数据文本信息 成功"
);
response
=
virtualExchangeService
.
exchange2
(
authorization
.
dafuwengLogin
(
uid
),
"185535"
,
"123"
);
response
.
prettyPrint
();
//获取orderId
String
orderId
=
response
.
jsonPath
().
getString
(
"orderId"
);
String
message
=
response
.
jsonPath
().
getString
(
"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
--;
}
// message.
logger
.
info
(
"message"
+
message
);
Assert
.
assertEquals
(
message
,
"今日已兑完,明天再来哦(14)"
,
"页面数据message返回错误"
);
logger
.
info
(
"自有虚拟商品库存不足完成"
);
}
// @Test(description = "虚拟商品用户每日兑换限制测试只能兑换一次" )
public
void
自有虚拟商品用户每日兑换限制测试只能兑换一次
()
throws
Exception
{
try
{
logger
.
info
(
"虚拟商品用户每日兑换限制测试只能兑换一次"
);
//商品详情页面
Response
response
=
mobileService
.
appItemDetail
(
authorization
.
dafuwengLogin
(
uid
),
"185684"
);
response
.
prettyPrint
();
String
exchangeText
=
MatcherString
.
getString
(
response
.
asString
(),
"\"exchangeText\":\"(.*?)\","
,
1
);
logger
.
info
(
"exchangeText"
+
exchangeText
);
Assert
.
assertEquals
(
exchangeText
,
"马上兑换"
,
"页面数据返回错误"
);
logger
.
info
(
"校验 页面数据文本信息 成功"
);
//自有虚拟商品兑换
response
=
virtualExchangeService
.
exchange2
(
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
);
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
();
Thread
.
sleep
(
3000
);
//exchangeText = MatcherString.getString(response.asString(), "\"exchangeStatusText\":\"(.*?)\",", 1);
//logger.info("exchangeText" + exchangeText);
Assert
.
assertEquals
(
response
.
asString
().
contains
(
"今日已兑换"
),
true
,
"页面数据返回错误"
);
Assert
.
assertEquals
(
exchangeText
,
"今日已兑换"
,
"页面数据返回错误"
);
// 第二次兑换接口层校验
response
=
virtualExchangeService
.
exchange
(
authorization
.
dafuwengLogin
(
uid
),
"185684"
,
"123"
);
response
.
prettyPrint
();
orderId
=
response
.
jsonPath
().
getString
(
"orderId"
);
logger
.
info
(
"orderid:"
+
orderId
);
response
=
mobileService
.
orderAmbStatusQuery
(
uid
,
orderId
);
message
=
response
.
jsonPath
().
getString
(
"data.message"
);
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
.
prettyPrint
();
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"message"
),
"今日已兑换"
,
"接口数据返回数据返回错误"
);
logger
.
info
(
"虚拟商品用户每日兑换限制测试只能兑换一次 成功"
);
}
catch
(
Exception
e
)
{
e
.
toString
();
}
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
自有虚拟商品用户永久一次兑换
OK
()
throws
Exception
{
try
{
logger
.
info
(
"自有虚拟商品用户永久一次兑换"
);
//商品详情页面
Response
response
=
mobileService
.
appItemDetail
(
authorization
.
dafuwengLogin
(
uid
),
"185738"
);
Map
<
String
,
String
>
map
=
authorization
.
dafuwengLogin
(
uid
,
true
);
response
.
prettyPrint
();
String
exchangeText
=
MatcherString
.
getString
(
response
.
asString
(),
"\"exchangeText\":(.*?),"
,
1
);
logger
.
info
(
"exchangeText:"
+
exchangeText
);
Assert
.
assertEquals
(
exchangeText
,
"\"马上兑换\""
,
"页面数据返回错误"
);
// 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
);
exchangeText
=
MatcherString
.
getString
(
resultResponse
.
asString
(),
"\"exchangeStatusText\":\"(.*?)\","
,
1
);
logger
.
info
(
"exchangeText"
+
exchangeText
);
Assert
.
assertEquals
(
exchangeText
,
"兑换成功"
,
"页面数据返回错误"
);
//Assert.assertEquals(resultResponse.asString().contains("兑换成功"),true,"兑换数据页面数据返回错误");
// 第二次兑换 按钮层校验
response
=
mobileService
.
appItemDetail
(
authorization
.
dafuwengLogin
(
uid
),
"185684"
);
exchangeText
=
MatcherString
.
getString
(
response
.
asString
(),
"\"exchangeText\":(.*?),"
,
1
);
logger
.
info
(
"exchangeTex第二次:"
+
exchangeText
);
response
.
prettyPrint
();
Assert
.
assertEquals
(
exchangeText
,
"\"今日已兑换\""
,
"页面数据返回错误"
);
// 第二次兑换接口层校验
response
=
virtualExchangeService
.
exchange
(
authorization
.
dafuwengLogin
(
uid
),
"185684"
,
"123"
);
response
.
prettyPrint
();
orderId
=
response
.
jsonPath
().
getString
(
"orderId"
);
logger
.
info
(
"orderid:"
+
orderId
);
response
=
mobileService
.
orderAmbStatusQuery
(
uid
,
orderId
);
message
=
response
.
jsonPath
().
getString
(
"data.message"
);
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
.
prettyPrint
();
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"message"
).
contains
(
"今日已兑换"
),
true
,
"接口数据返回数据返回错误"
);
logger
.
info
(
"虚拟商品用户永久兑换 成功"
);
String
error
=
"error"
;
}
catch
(
Exception
e
)
{
e
.
toString
();
logger
.
info
(
e
.
toString
());
Assert
.
assertEquals
(
e
.
toString
().
contains
(
"今日已兑换"
),
true
,
"接口数据返回数据返回错误"
);
}
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
(
"虚拟商品马上使用按钮验证开始"
);
//创建虚拟商品的时候,有自定义兑换按钮文案的文案设置,将文案设置成马上使用
//商品详情页面
Response
response
=
mobileService
.
appItemDetail
(
authorization
.
dafuwengLogin
(
uid
),
"186447"
);
String
exchangeText
=
MatcherString
.
getString
(
response
.
asString
(),
"\"exchangeText\":(.*?),"
,
1
);
response
.
prettyPrint
();
logger
.
info
(
"exchangeText:"
+
exchangeText
);
Assert
.
assertEquals
(
exchangeText
,
"\"马上使用\""
,
"页面数据返回错误"
);
logger
.
info
(
"校验 页面数据文本信息 成功"
);
//自有虚拟商品兑换
response
=
virtualExchangeService
.
exchange2
(
authorization
.
dafuwengLogin
(
uid
),
"186447"
,
"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
);
resultResponse
.
prettyPrint
();
exchangeText
=
MatcherString
.
getString
(
resultResponse
.
asString
(),
"\"exchangeStatusText\":\"(.*?)\","
,
1
);
//异步接口,直到兑换成功
int
n
=
10
;
while
(
n
>
0
&&
"处理中"
.
equals
(
exchangeText
))
{
Thread
.
sleep
(
1000
);
resultResponse
=
crecordService
.
recordDetailNew
(
orderId
,
uid
);
resultResponse
.
prettyPrint
();
exchangeText
=
MatcherString
.
getString
(
resultResponse
.
asString
(),
"\"exchangeStatusText\":\"(.*?)\","
,
1
);
n
--;
}
logger
.
info
(
"exchangeText"
+
exchangeText
);
Assert
.
assertEquals
(
resultResponse
.
asString
().
contains
(
"兑换成功"
),
true
,
"兑换数据页面数据返回错误"
);
logger
.
info
(
"虚拟商品马上使用按钮验证结束"
);
}
@Test
(
description
=
"【自动化】虚拟商品日期兑换时间未到"
)
public
void
虚拟商品日期兑换时间未到
()
throws
Exception
{
try
{
logger
.
info
(
"【自动化】虚拟商品日期兑换时间未到开始验证"
);
//创建虚拟商品的时候,有自定义兑换按钮文案的文案设置,将文案设置成马上使用
//商品详情页面
Response
response
=
mobileService
.
appItemDetail
(
authorization
.
dafuwengLogin
(
uid
),
"186617"
);
response
.
prettyPrint
();
String
exchangeText
=
MatcherString
.
getString
(
response
.
asString
(),
"\"exchangeText\":(.*?),"
,
1
);
logger
.
info
(
"exchangeText:"
+
exchangeText
);
Assert
.
assertEquals
(
exchangeText
,
"\"即将开始\""
,
"页面数据返回错误"
);
logger
.
info
(
"校验 页面数据文本信息 成功"
);
//自有虚拟商品兑换
response
=
virtualExchangeService
.
exchange
(
authorization
.
dafuwengLogin
(
uid
),
"186617"
,
"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
);
exchangeText
=
MatcherString
.
getString
(
resultResponse
.
asString
(),
"\"exchangeStatusText\":\"(.*?)\","
,
1
);
logger
.
info
(
"exchangeText"
+
exchangeText
);
message
=
response
.
jsonPath
().
getString
(
"data.message"
);
logger
.
info
(
"message"
+
message
);
Assert
.
assertEquals
(
message
,(
"请在限定时间内兑换哦(13)"
),
"接口数据返回数据返回错误"
);
logger
.
info
(
"【自动化】虚拟商品日期兑换时间未到开始结束"
);
}
catch
(
Exception
e
)
{
e
.
toString
();
logger
.
info
(
e
.
toString
());
}
}
@Test
(
description
=
"【自动化】虚拟商品日期兑换时间已经结束"
)
public
void
虚拟商品日期兑换时间已经结束
()
throws
Exception
{
try
{
logger
.
info
(
"【自动化】虚拟商品日期兑换时间已经结束验证"
);
//创建虚拟商品的时候,有自定义兑换按钮文案的文案设置,将文案设置成马上使用
//商品详情页面
Response
response
=
mobileService
.
appItemDetail
(
authorization
.
dafuwengLogin
(
uid
),
"186619"
);
response
.
prettyPrint
();
String
exchangeText
=
MatcherString
.
getString
(
response
.
asString
(),
"\"exchangeText\":(.*?),"
,
1
);
logger
.
info
(
"exchangeText:"
+
exchangeText
);
Assert
.
assertEquals
(
exchangeText
,
"\"已结束\""
,
"页面数据返回错误"
);
logger
.
info
(
"校验 页面数据文本信息 成功"
);
//自有虚拟商品兑换
response
=
virtualExchangeService
.
exchange2
(
authorization
.
dafuwengLogin
(
uid
),
"186617"
,
"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
);
exchangeText
=
MatcherString
.
getString
(
resultResponse
.
asString
(),
"\"exchangeStatusText\":\"(.*?)\","
,
1
);
logger
.
info
(
"exchangeText"
+
exchangeText
);
message
=
response
.
jsonPath
().
getString
(
"data.message"
);
logger
.
info
(
"message"
+
message
);
Assert
.
assertEquals
(
message
,(
"请在限定时间内兑换哦(13)"
),
"接口数据返回数据返回错误"
);
logger
.
info
(
"【自动化】虚拟商品日期兑换时间已经结束验证完成"
);
}
catch
(
Exception
e
)
{
e
.
toString
();
logger
.
info
(
e
.
toString
());
}
}
@Test
(
description
=
"【自动化】虚拟商品兑换需输入账号-未输入账号-验证"
)
public
void
虚拟商品兑换需要输入账号未输入账号信息验证
()
throws
Exception
{
try
{
logger
.
info
(
"【自动化】虚拟商品兑换需要输入账号-未输入账号-验证"
);
//创建虚拟商品的时候,有自定义兑换按钮文案的文案设置,将文案设置成马上使用
//商品详情页面
Response
response
=
mobileService
.
appItemDetail
(
authorization
.
dafuwengLogin
(
uid
),
"186620"
);
response
.
prettyPrint
();
String
exchangeText
=
MatcherString
.
getString
(
response
.
asString
(),
"\"exchangeText\":(.*?),"
,
1
);
logger
.
info
(
"exchangeText(马上兑换):"
+
exchangeText
);
Assert
.
assertEquals
(
exchangeText
,
"\"马上兑换\""
,
"页面数据返回错误"
);
Assert
.
assertEquals
(
response
.
asString
().
contains
(
"充值账号"
),
true
,
"页面数据返回错误"
);
logger
.
info
(
"校验 页面数据文本信息 成功"
);
//自有虚拟商品兑换
response
=
virtualExchangeService
.
exchange2
(
authorization
.
dafuwengLogin
(
uid
),
"186620"
,
"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
);
exchangeText
=
MatcherString
.
getString
(
resultResponse
.
asString
(),
"\"exchangeStatusText\":\"(.*?)\","
,
1
);
logger
.
info
(
"exchangeText"
+
exchangeText
);
message
=
response
.
jsonPath
().
getString
(
"data.message"
);
logger
.
info
(
"message"
+
message
);
Assert
.
assertEquals
(
message
,(
"请输入账号"
),
"接口数据返回数据返回错误"
);
logger
.
info
(
"自动化】虚拟商品兑换需要输入账号-未输入账号-完成"
);
}
catch
(
Exception
e
)
{
e
.
toString
();
logger
.
info
(
e
.
toString
());
}
}
@Test
(
description
=
"自动化】虚拟商品日期兑换时间进行中"
)
public
void
虚拟商品日期兑换时间进行中
()
throws
Exception
{
logger
.
info
(
"【自动化】虚拟商品日期兑换时间进行中开始验证"
);
//创建虚拟商品的时候,有自定义兑换按钮文案的文案设置,将文案设置成马上使用
//商品详情页面
Response
response
=
mobileService
.
appItemDetail
(
authorization
.
dafuwengLogin
(
uid
),
"186618"
);
response
.
prettyPrint
();
String
exchangeText
=
MatcherString
.
getString
(
response
.
asString
(),
"\"exchangeText\":(.*?),"
,
1
);
logger
.
info
(
"exchangeText:"
+
exchangeText
);
Assert
.
assertEquals
(
exchangeText
,
"\"马上兑换\""
,
"页面数据返回错误"
);
logger
.
info
(
"校验 页面数据文本信息 成功"
);
//自有虚拟商品兑换
response
=
virtualExchangeService
.
exchange2
(
authorization
.
dafuwengLogin
(
uid
),
"186618"
,
"123"
);
//获取orderId
String
orderId
=
response
.
jsonPath
().
getString
(
"orderId"
);
logger
.
info
(
"orderid:"
+
orderId
);
response
=
mobileService
.
orderAmbStatusQuery
(
uid
,
orderId
);
String
message
=
response
.
jsonPath
().
getString
(
"data.message"
);
logger
.
info
(
"message"
+
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
);
resultResponse
.
prettyPrint
();
exchangeText
=
MatcherString
.
getString
(
resultResponse
.
asString
(),
"\"exchangeStatusText\":\"(.*?)\","
,
1
);
//异步接口,直到兑换成功
int
n
=
10
;
while
(
n
>
0
&&
"处理中"
.
equals
(
exchangeText
))
{
Thread
.
sleep
(
1000
);
resultResponse
=
crecordService
.
recordDetailNew
(
orderId
,
uid
);
resultResponse
.
prettyPrint
();
exchangeText
=
MatcherString
.
getString
(
resultResponse
.
asString
(),
"\"exchangeStatusText\":\"(.*?)\","
,
1
);
n
--;
}
logger
.
info
(
"exchangeText"
+
exchangeText
);
Assert
.
assertEquals
(
exchangeText
,
"兑换成功"
,
"页面数据返回错误"
);
logger
.
info
(
"【自动化】虚拟商品日期兑换时间进行中开始结束"
);
}
// @Test(description = "【自动化】虚拟商品兑换需输入账号-已输入账号,兑换验证-验证")
public
void
虚拟商品兑换需要输入账号已输入账号兑换验证信息验证
()
throws
Exception
{
try
{
logger
.
info
(
"虚拟商品兑换需要输入账号已输入账号兑换验证信息验证"
);
//创建虚拟商品的时候,有自定义兑换按钮文案的文案设置,将文案设置成马上使用
//商品详情页面
Response
response
=
mobileService
.
appItemDetail
(
authorization
.
dafuwengLogin
(
uid
),
"186620"
);
Map
<
String
,
String
>
map
=
authorization
.
dafuwengLogin
(
uid
,
true
);
response
.
prettyPrint
();
//,"exchangeText":"马上兑换",
String
exchangeText
=
MatcherString
.
getString
(
response
.
asString
(),
"\"exchangeText\":(.*?),"
,
1
);
logger
.
info
(
"exchangeText(马上兑换):"
+
exchangeText
);
Assert
.
assertEquals
(
exchangeText
,
"\"马上兑换\""
,
"页面数据返回错误"
);
Assert
.
assertEquals
(
response
.
asString
().
contains
(
"充值账号"
),
true
,
"页面数据返回错误"
);
logger
.
info
(
"校验 页面数据文本信息 成功"
);
//自有虚拟商品兑换
response
=
virtualExchangeService
.
exchange
(
authorization
.
dafuwengLogin
(
uid
),
"186620"
,
"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
);
exchangeText
=
MatcherString
.
getString
(
resultResponse
.
asString
(),
"\"exchangeStatusText\":\"(.*?)\","
,
1
);
logger
.
info
(
"exchangeText"
+
exchangeText
);
}
catch
(
Exception
e
)
{
e
.
toString
();
logger
.
info
(
e
.
toString
());
logger
.
info
(
"【自动化】虚拟商品日期兑换时间已经结束验证完成"
);
}
}
@Test
(
description
=
"自动下架时间,下架后无法兑换"
)
public
void
自动下架时间下架后无法兑换
()
throws
Exception
{
logger
.
info
(
"自动下架时间,下架后无法兑换开始"
);
//创建虚拟商品的时候,有自定义兑换按钮文案的文案设置,将文案设置成马上使用
//商品详情页面
Response
response
=
mobileService
.
appItemDetail
(
authorization
.
dafuwengLogin
(
uid
),
"186459"
);
response
.
prettyPrint
();
String
exchangeText
=
MatcherString
.
getString
(
response
.
asString
(),
"\"exchangeText\":(.*?),"
,
1
);
logger
.
info
(
"exchangeText:"
+
exchangeText
);
Assert
.
assertEquals
(
exchangeText
,
"\"已下架\""
,
"页面数据返回错误"
);
logger
.
info
(
"校验 页面数据文本信息 成功"
);
//自有虚拟商品兑换
response
=
virtualExchangeService
.
exchange2
(
authorization
.
dafuwengLogin
(
uid
),
"186459"
,
"123"
);
String
message
=
response
.
jsonPath
().
getString
(
"message"
);
logger
.
info
(
"message"
+
message
);
Assert
.
assertEquals
(
message
,(
"商品已下架,挑选其他吧(8)"
),
"接口数据返回数据返回错误"
);
logger
.
info
(
"自动下架时间下架后无法兑换()完成"
);
}
}
src/test/java/http/cases/NewActivityTest/优惠券测试_DuibaTest.java
View file @
8fb108e1
...
...
@@ -54,7 +54,7 @@ public class 优惠券测试_DuibaTest extends AbstractTestNGSpringContextTests
String
androidDL
=
MatcherString
.
getString
(
ManagerResponse
.
asString
(),
"androidurl: '(.*?)',"
,
1
);
String
iOSDL
=
MatcherString
.
getString
(
ManagerResponse
.
asString
(),
"iosurl: '(.*?)',"
,
1
);
String
actusebtn
=
MatcherString
.
getString
(
ManagerResponse
.
asString
(),
"usebtn: '(.*?)',"
,
1
);
String
actLinkEx
=
"//activity.m.duibatest.com.cn/crecord/recordDetailNew
/
"
;
String
actLinkEx
=
"//activity.m.duibatest.com.cn/crecord/recordDetailNew"
;
String
linkUrl
=
MatcherString
.
getString
(
LinkResponse
.
asString
(),
"target=\"_blank\" href=\"(.*?)\">"
,
1
);
//获取管理员后台优惠券库存
...
...
src/test/java/http/cases/NewActivityTest/谢谢参与测试_DuibaTest.java
View file @
8fb108e1
...
...
@@ -32,6 +32,7 @@ public class 谢谢参与测试_DuibaTest extends DuibaTestBase {
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"lottery.type"
),
"thanks"
,
"校验类型失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"lottery.id"
).
isEmpty
(),
false
,
"校验id失败"
);
Assert
.
assertNotNull
(
response
.
jsonPath
().
getString
(
"lottery.id"
),
"校验id失败"
);
//校验返回字段
Assert
.
assertEquals
(
response
.
asString
().
contains
(
"id"
),
true
,
"校验id失败"
);
logger
.
info
(
"校验type,id成功"
);
...
...
src/test/java/http/cases/SaasDeveloperTest/修改兑吧商品.java
0 → 100644
View file @
8fb108e1
package
http
.
cases
.
SaasDeveloperTest
;
import
base.Config
;
import
base.DuibaTestBase
;
import
base.DuibaLog
;
import
http.service.Saas.DeveloperCouponService
;
import
http.service.Saas.DeveloperObjectService
;
import
http.service.Saas.DoUpdateAppItemService
;
import
io.restassured.response.Response
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.test.context.ContextConfiguration
;
import
org.springframework.test.context.testng.AbstractTestNGSpringContextTests
;
import
org.testng.Assert
;
import
org.testng.annotations.Test
;
@ContextConfiguration
(
classes
=
Config
.
class
)
public
class
修改兑吧商品
extends
DuibaTestBase
{
@Autowired
DoUpdateAppItemService
doUpdateAppItemService
;
@Autowired
DeveloperObjectService
developerObjectService
;
private
DuibaLog
logger
=
DuibaLog
.
getLogger
();
//修改兑吧实物
@Test
public
void
a_
修改兑吧实物
()
throws
Exception
{
String
appId
=
"19515"
;
String
rowId
=
"1"
;
String
itemTyp
=
""
;
String
status
=
""
;
String
itemName
=
"【SaaS-自动化测试】实物勿动"
;
String
belong
=
""
;
String
priceType
=
""
;
//查询商品,获取商品ID
Response
response
=
doUpdateAppItemService
.
appItems
(
appId
,
rowId
,
itemTyp
,
status
,
itemName
,
belong
,
priceType
);
//获取商品ID
String
appItemId
=
String
.
valueOf
(
response
.
jsonPath
().
getString
(
"data.list[0].id"
));
String
title
=
String
.
valueOf
(
response
.
jsonPath
().
getString
(
"data.list[0].title"
));
String
type
=
String
.
valueOf
(
response
.
jsonPath
().
getString
(
"data.list[0].type"
));
// logger.info("获取appitermid=="+appItemId+"title=="+title+"type=="+type);
//编辑
Response
response2
=
developerObjectService
.
editAppItem2
(
appItemId
);
//保存
doUpdateAppItemService
.
doUpdateAppItem
(
appId
,
appItemId
,
title
,
"38"
,
type
,
"31654"
);
Assert
.
assertEquals
(
response2
.
jsonPath
().
getString
(
"data.title"
),
"【SaaS-自动化测试】实物勿动"
,
"校验兑吧商品标题失败"
);
Assert
.
assertEquals
(
response2
.
jsonPath
().
getString
(
"data.credits"
),
"38"
,
"校验兑吧商品失败"
);
logger
.
info
(
"校验title,belong成功"
);
}
//修改兑吧优惠券
@Test
public
void
b_
修改兑吧优惠券
()
throws
Exception
{
String
appId
=
"19515"
;
String
rowId
=
"1"
;
String
itemTyp
=
""
;
String
status
=
""
;
String
itemName
=
"【SaaS-自动化测试】优惠券勿动"
;
String
belong
=
""
;
String
priceType
=
""
;
Response
response
=
doUpdateAppItemService
.
appItems
(
appId
,
rowId
,
itemTyp
,
status
,
itemName
,
belong
,
priceType
);
//获取商品ID
String
appItemId
=
String
.
valueOf
(
response
.
jsonPath
().
getString
(
"data.list[0].id"
));
String
title
=
String
.
valueOf
(
response
.
jsonPath
().
getString
(
"data.list[0].title"
));
String
type
=
String
.
valueOf
(
response
.
jsonPath
().
getString
(
"data.list[0].type"
));
// logger.info("获取appitermid=="+appItemId+"title=="+title+"type=="+type);
//编辑
doUpdateAppItemService
.
doUpdateAppItem
(
appId
,
appItemId
,
title
,
"10"
,
"coupon"
,
"31658"
);
Response
response2
=
developerObjectService
.
editAppItem2
(
appItemId
);
Assert
.
assertEquals
(
response2
.
jsonPath
().
getString
(
"data.title"
),
"【SaaS-自动化测试】优惠券勿动"
,
"校验兑吧优惠券商品标题失败"
);
Assert
.
assertEquals
(
response2
.
jsonPath
().
getString
(
"data.credits"
),
"10"
,
"校验兑吧优惠券商品失败"
);
logger
.
info
(
"校验title,belong成功"
);
}
}
src/test/java/http/cases/SaasDeveloperTest/补给站.java
0 → 100644
View file @
8fb108e1
package
http
.
cases
.
SaasDeveloperTest
;
import
base.Config
;
import
base.DuibaTestBase
;
import
http.service.Saas.DeveloperBJZ
;
import
base.DuibaLog
;
import
http.service.Saas.DeveloperObjectService
;
import
io.restassured.response.Response
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.test.context.ContextConfiguration
;
import
org.springframework.test.context.testng.AbstractTestNGSpringContextTests
;
import
org.testng.Assert
;
import
org.testng.annotations.Test
;
@ContextConfiguration
(
classes
=
Config
.
class
)
public
class
补给站
extends
DuibaTestBase
{
@Autowired
DeveloperBJZ
developerBJZ
;
@Autowired
DeveloperObjectService
developerObjectService
;
private
DuibaLog
logger
=
DuibaLog
.
getLogger
();
String
appId
=
"19515"
;
//添加、上架至尊版实物
@Test
public
void
a_
添加至尊版实物
()
throws
Exception
{
//查询列表,获取ID
Response
response
=
developerBJZ
.
item
(
"2"
);
String
id
=
String
.
valueOf
(
response
.
jsonPath
().
getString
(
"data.list[0].id"
));
String
title
=
String
.
valueOf
(
response
.
jsonPath
().
getString
(
"data.list[0].title"
));
//添加
developerBJZ
.
ajaxAddRepo
(
appId
,
id
);
//上架
developerBJZ
.
ajaxDirectUp
(
appId
,
id
);
//查询商品列表,验证商品是否上架成功
Response
response2
=
developerObjectService
.
appItems
(
appId
,
title
);
String
appItemId
=
String
.
valueOf
(
response2
.
jsonPath
().
getString
(
"data.list[0].id"
));
Assert
.
assertEquals
(
response2
.
jsonPath
().
getString
(
"data.list[0].title"
),
"测试至尊享版-实物3"
,
"校验实物标题失败"
);
Assert
.
assertEquals
(
response2
.
jsonPath
().
getString
(
"data.list[0].status"
),
"1"
,
"校验实物状态失败"
);
Assert
.
assertEquals
(
response2
.
jsonPath
().
getString
(
"data.list[0].type"
),
"object"
,
"校验实物类型失败"
);
logger
.
info
(
"校验title,status成功"
);
//删除添加的商品
developerObjectService
.
ajaxDel
(
appItemId
);
}
//添加、上架优惠券
@Test
public
void
b_
添加至尊版优惠券
()
throws
Exception
{
//查询列表,获取ID
Response
response
=
developerBJZ
.
coupons
(
appId
,
"2"
);
String
id
=
String
.
valueOf
(
response
.
jsonPath
().
getString
(
"data.list[0].id"
));
String
title
=
String
.
valueOf
(
response
.
jsonPath
().
getString
(
"data.list[0].title"
));
//添加
developerBJZ
.
ajaxAddRepo
(
appId
,
id
);
//上架
developerBJZ
.
ajaxDirectUp
(
appId
,
id
);
//查询商品列表,验证商品是否上架成功
Response
response2
=
developerObjectService
.
appItems
(
appId
,
title
);
String
appItemId
=
String
.
valueOf
(
response2
.
jsonPath
().
getString
(
"data.list[0].id"
));
Assert
.
assertEquals
(
response2
.
jsonPath
().
getString
(
"data.list[0].title"
),
"测试至尊享版-优惠券"
,
"校验优惠券标题名称失败"
);
Assert
.
assertEquals
(
response2
.
jsonPath
().
getString
(
"data.list[0].status"
),
"1"
,
"校验优惠券状态失败"
);
Assert
.
assertEquals
(
response2
.
jsonPath
().
getString
(
"data.list[0].type"
),
"coupon"
,
"校验优惠券类型失败"
);
logger
.
info
(
"校验title,status成功"
);
//删除添加的商品
developerObjectService
.
ajaxDel
(
appItemId
);
}
//添加活动
@Test
public
void
c_
添加活动
()
throws
Exception
{
//查询热门活动-活动列表,获取商品ID
Response
response
=
developerBJZ
.
saasActivitys
(
"3"
);
String
goodItemId
=
String
.
valueOf
(
response
.
jsonPath
().
getString
(
"data.saasActivitys[0].id"
));
//获取商品ID,进入商品订购页面,获取SKU
Response
response2
=
developerBJZ
.
itemOrderDetail
(
goodItemId
);
String
skuId
=
String
.
valueOf
(
response2
.
jsonPath
().
getString
(
"data.goodsItemSku[0].skuId"
));
//点击订购,传入SKU创建订单
logger
.
info
(
"kuid==="
+
skuId
);
Response
response3
=
developerBJZ
.
createAutomationOrderNew
(
skuId
);
String
orderid
=
String
.
valueOf
(
response3
.
jsonPath
().
getString
(
"data"
));
logger
.
info
(
"kuid==="
+
orderid
);
//下单购买
Response
response4
=
developerBJZ
.
orderAccountPay
(
orderid
);
}
}
src/test/java/http/cases/WalletTest/种红包配置校验_AccessTest.java
View file @
8fb108e1
...
...
@@ -30,9 +30,10 @@ public class 种红包配置校验_AccessTest extends DuibaTestBase{
//指定用户
private
static
int
uid
=
4689
;
private
static
int
uid2
=
4552
;
private
static
int
uid3
=
3590
;
private
static
int
uid4
=
4386
;
@Test
public
void
出券开关校验
_
开
()
throws
Exception
{
public
void
出券
衰减
开关校验
_
开
()
throws
Exception
{
//dafuweng登陆获取cookies
Map
cookies
=
authorization
.
dafuwengLogin
(
uid
);
//校验种红包配置
...
...
@@ -58,11 +59,12 @@ public class 种红包配置校验_AccessTest extends DuibaTestBase{
logger
.
info
(
"种红包的红包配置接口校验正确"
);
}
@Test
public
void
出券开关校验
_
关
()
throws
Exception
{
public
void
出券
衰减
开关校验
_
关
()
throws
Exception
{
//dafuweng登陆获取cookies
Map
cookies
=
authorization
.
dafuwengLogin
(
uid2
);
//校验种红包配置
...
...
@@ -81,4 +83,53 @@ public class 种红包配置校验_AccessTest extends DuibaTestBase{
logger
.
info
(
"种红包的红包配置接口校验正确"
);
}
@Test
public
void
流量策略打开校验
()
throws
Exception
{
//dafuweng登陆获取cookies
Map
cookies
=
authorization
.
dafuwengLogin
(
uid3
);
//校验种红包配置
Response
response
=
seedRedPacketService
.
getExtConfig
(
cookies
);
response
.
prettyPrint
();
String
adPositions
=
response
.
jsonPath
().
getString
(
"data.adPositions"
);
String
adSwitch
=
response
.
jsonPath
().
getString
(
"data.adSwitch"
);
String
decrBeginTime
=
response
.
jsonPath
().
getString
(
"data.decrBeginTime"
);
String
decrSwitch
=
response
.
jsonPath
().
getString
(
"data.decrSwitch"
);
Assert
.
assertNull
(
adPositions
,
"发券位置校验异常"
);
Assert
.
assertEquals
(
adSwitch
,
"false"
,
"种红包开关校验异常"
);
Assert
.
assertEquals
(
decrSwitch
,
"false"
,
"种红包衰减开关校验异常"
);
Assert
.
assertNull
(
decrBeginTime
,
"衰减时间校验异常"
);
logger
.
info
(
"种红包的红包配置接口校验正确"
);
}
@Test
public
void
衰减红包校验
()
throws
Exception
{
//dafuweng登陆获取cookies
Map
cookies
=
authorization
.
dafuwengLogin
(
uid4
);
//调用种植seed
Response
response
=
seedRedPacketService
.
seed
(
cookies
,
"1"
,
"424"
,
"1"
);
//种子号
String
orderId
=
response
.
jsonPath
().
getString
(
"data.orderNum"
);
Assert
.
assertNotNull
(
orderId
,
"订单号为空"
);
logger
.
info
(
"红包订单为:"
+
orderId
);
//红包衰减
Thread
.
sleep
(
65000
);
//获取种植结果状态getOrderStatus,异步接口,while循环,status为2处理完成,1处理中
response
=
seedRedPacketService
.
getOrderStatus
(
cookies
,
orderId
);
String
status
=
response
.
jsonPath
().
getString
(
"data"
);
int
i
=
5
;
while
(
i
>
0
&&
status
.
equals
(
"1"
)){
response
=
seedRedPacketService
.
getOrderStatus
(
cookies
,
orderId
);
status
=
response
.
jsonPath
().
getString
(
"data"
);
i
--;
}
//获取种植获得金额
response
=
seedRedPacketService
.
reap
(
cookies
,
"1"
,
orderId
);
response
.
prettyPrint
();
String
isDecr
=
response
.
jsonPath
().
getString
(
"data.isDecr"
);
Assert
.
assertEquals
(
isDecr
,
"true"
,
"红包衰减标识校验失败"
);
}
}
src/test/java/http/service/Saas/DeveloperBJZ.java
0 → 100644
View file @
8fb108e1
package
http
.
service
.
Saas
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
http.service.Authorization
;
import
base.DuibaLog
;
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
org.testng.Assert
;
import
java.util.HashMap
;
import
java.util.Map
;
import
static
io
.
restassured
.
RestAssured
.
given
;
/**
* 补给站
*/
@Service
public
class
DeveloperBJZ
{
@Value
(
"${hdserver.host}"
)
String
hdHost
;
@Autowired
Authorization
authorization
;
private
DuibaLog
logger
=
DuibaLog
.
getLogger
();
//优质好货--查询至尊版特权TAB
public
Response
item
(
String
type
)
throws
Exception
{
String
url
=
"http://"
+
hdHost
+
"/saasitem/items"
;
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"type"
,
type
);
map
.
put
(
"rowId"
,
"1"
);
map
.
put
(
"itemName"
,
""
);
map
.
put
(
"max"
,
"20"
);
// logger.info("********"+url);
Response
response
=
given
().
contentType
(
"application/x-www-form-urlencoded;charset=UTF-8"
).
cookies
(
authorization
.
hdLoginSaas
()).
params
(
map
).
get
(
url
);
// response.prettyPrint();
try
{
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"desc"
),
"成功"
);
}
catch
(
Exception
e
){
throw
new
Exception
(
"创建接口1失败,返回信息:"
+
response
.
asString
());
}
catch
(
Error
er
){
throw
new
Exception
(
"创建接口2失败,返回信息:"
+
response
.
asString
());
}
return
response
;
}
//至尊特权添加商品
public
Response
ajaxAddRepo
(
String
appId
,
String
itemId
)
throws
Exception
{
String
url
=
"http://"
+
hdHost
+
"/devRepo/ajaxAddRepo"
;
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"appId"
,
appId
);
map
.
put
(
"itemId"
,
itemId
);
Response
response
=
given
().
contentType
(
"application/x-www-form-urlencoded;charset=UTF-8"
).
cookies
(
authorization
.
hdLoginSaas
()).
params
(
map
).
post
(
url
);
// response.prettyPrint();
try
{
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"desc"
),
"成功"
);
}
catch
(
Exception
e
){
throw
new
Exception
(
"创建接口1失败,返回信息:"
+
response
.
asString
());
}
catch
(
Error
er
){
throw
new
Exception
(
"创建接口2失败,返回信息:"
+
response
.
asString
());
}
return
response
;
}
//至尊特权上架商品
public
Response
ajaxDirectUp
(
String
appId
,
String
itemIds
)
throws
Exception
{
String
url
=
"http://"
+
hdHost
+
"/devRepo/ajaxDirectUp"
;
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"appId"
,
appId
);
map
.
put
(
"itemIds"
,
itemIds
);
Response
response
=
given
().
contentType
(
"application/x-www-form-urlencoded;charset=UTF-8"
).
cookies
(
authorization
.
hdLoginSaas
()).
params
(
map
).
post
(
url
);
response
.
prettyPrint
();
try
{
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"desc"
),
"直接上架成功"
);
}
catch
(
Exception
e
){
throw
new
Exception
(
"创建接口1失败,返回信息:"
+
response
.
asString
());
}
catch
(
Error
er
){
throw
new
Exception
(
"创建接口2失败,返回信息:"
+
response
.
asString
());
}
return
response
;
}
//大牌好券--查询至尊版特权TAB
public
Response
coupons
(
String
appId
,
String
type
)
throws
Exception
{
String
url
=
"http://"
+
hdHost
+
"/saasitem/coupons"
;
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"appId"
,
appId
);
map
.
put
(
"type"
,
type
);
map
.
put
(
"rowId"
,
"1"
);
map
.
put
(
"subType"
,
""
);
map
.
put
(
"max"
,
"12"
);
// logger.info("********"+url);
Response
response
=
given
().
contentType
(
"application/x-www-form-urlencoded;charset=UTF-8"
).
cookies
(
authorization
.
hdLoginSaas
()).
params
(
map
).
get
(
url
);
// response.prettyPrint();
try
{
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"desc"
),
"成功"
);
}
catch
(
Exception
e
){
throw
new
Exception
(
"创建接口1失败,返回信息:"
+
response
.
asString
());
}
catch
(
Error
er
){
throw
new
Exception
(
"创建接口2失败,返回信息:"
+
response
.
asString
());
}
return
response
;
}
//热门活动--查询活动
public
Response
saasActivitys
(
String
categoryId
)
throws
Exception
{
String
url
=
"http://"
+
hdHost
+
"/saasitem/saasActivitys"
;
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"attrIds"
,
""
);
map
.
put
(
"rowId"
,
"1"
);
map
.
put
(
"max"
,
"25"
);
map
.
put
(
"categoryId"
,
categoryId
);
logger
.
info
(
"********"
+
url
);
//json 格式转成form表单
JSONObject
jsonParam
=
JSONObject
.
parseObject
(
JSON
.
toJSONString
(
map
));
Response
response
=
given
().
contentType
(
"application/json;charset=UTF-8"
).
cookies
(
authorization
.
hdLoginSaas
(
"19515"
)).
body
(
jsonParam
).
post
(
url
);
// response.prettyPrint();
try
{
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"desc"
),
"成功"
);
}
catch
(
Exception
e
){
throw
new
Exception
(
"创建接口1失败,返回信息:"
+
response
.
asString
());
}
catch
(
Error
er
){
throw
new
Exception
(
"创建接口2失败,返回信息:"
+
response
.
asString
());
}
return
response
;
}
//选中活动
public
Response
itemOrderDetail
(
String
goodItemId
)
throws
Exception
{
String
url
=
"http://"
+
hdHost
+
"/saasitem/itemOrderDetail"
;
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"goodItemId"
,
goodItemId
);
// logger.info("********"+url);
Response
response
=
given
().
contentType
(
"application/x-www-form-urlencoded;charset=UTF-8"
).
cookies
(
authorization
.
hdLoginSaas
()).
params
(
map
).
get
(
url
);
// response.prettyPrint();
try
{
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"desc"
),
"成功"
);
}
catch
(
Exception
e
){
throw
new
Exception
(
"创建接口1失败,返回信息:"
+
response
.
asString
());
}
catch
(
Error
er
){
throw
new
Exception
(
"创建接口2失败,返回信息:"
+
response
.
asString
());
}
return
response
;
}
//订购活动--创建订单
public
Response
createAutomationOrderNew
(
String
skuId
)
throws
Exception
{
String
url
=
"http://"
+
hdHost
+
"/saas/createAutomationOrderNew"
;
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"skuId"
,
skuId
);
// logger.info("********"+url);
Response
response
=
given
().
contentType
(
"application/x-www-form-urlencoded;charset=UTF-8"
).
cookies
(
authorization
.
hdLoginSaas
(
"19515"
)).
params
(
map
).
post
(
url
);
// response.prettyPrint();
try
{
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"desc"
),
"成功"
);
}
catch
(
Exception
e
){
throw
new
Exception
(
"创建接口1失败,返回信息:"
+
response
.
asString
());
}
catch
(
Error
er
){
throw
new
Exception
(
"创建接口2失败,返回信息:"
+
response
.
asString
());
}
return
response
;
}
//订购--账户余额付款
public
Response
orderAccountPay
(
String
orderId
)
throws
Exception
{
String
url
=
"http://"
+
hdHost
+
"/saas/orderAccountPay"
;
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"orderId"
,
orderId
);
// logger.info("********"+url);
Response
response
=
given
().
contentType
(
"application/x-www-form-urlencoded;charset=UTF-8"
).
cookies
(
authorization
.
hdLoginSaas
()).
params
(
map
).
get
(
url
);
// response.prettyPrint();
try
{
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"desc"
),
"成功"
);
}
catch
(
Exception
e
){
throw
new
Exception
(
"创建接口1失败,返回信息:"
+
response
.
asString
());
}
catch
(
Error
er
){
throw
new
Exception
(
"创建接口2失败,返回信息:"
+
response
.
asString
());
}
return
response
;
}
}
src/test/java/http/service/Saas/DoUpdateAppItemService.java
0 → 100644
View file @
8fb108e1
package
http
.
service
.
Saas
;
import
http.service.Authorization
;
import
base.DuibaLog
;
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
org.testng.Assert
;
import
java.util.HashMap
;
import
java.util.Map
;
import
static
io
.
restassured
.
RestAssured
.
given
;
@Service
public
class
DoUpdateAppItemService
{
@Value
(
"${hdserver.host}"
)
String
hdHost
;
@Autowired
Authorization
authorization
;
private
DuibaLog
logger
=
DuibaLog
.
getLogger
();
//保存应用
public
Response
doUpdateAppItem
(
String
appId
,
String
appItemId
,
String
title
,
String
credits
,
String
type
,
String
itemId
)
throws
Exception
{
String
url
=
"http://"
+
hdHost
+
"/devItem/doUpdateAppItem"
;
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"appId"
,
appId
);
map
.
put
(
"appItemId"
,
appItemId
);
map
.
put
(
"title"
,
title
);
map
.
put
(
"unitStatus"
,
"0"
);
map
.
put
(
"levelLimit"
,
"false"
);
map
.
put
(
"levelLimitType"
,
"select"
);
map
.
put
(
"levelselect"
,
""
);
map
.
put
(
"levelcheckbox"
,
""
);
map
.
put
(
"facePrice"
,
"888"
);
map
.
put
(
"credits"
,
credits
);
map
.
put
(
"indexHidden"
,
"false"
);
map
.
put
(
"autoOffDate"
,
""
);
map
.
put
(
"customTagText"
,
""
);
map
.
put
(
"customTagColor"
,
"#fe4a21"
);
map
.
put
(
"isOwner"
,
""
);
map
.
put
(
"autoOffDateFlag"
,
"false"
);
map
.
put
(
"startDay"
,
""
);
map
.
put
(
"endDay"
,
""
);
map
.
put
(
"EThours"
,
""
);
map
.
put
(
"ETminute"
,
""
);
map
.
put
(
"SThours"
,
""
);
map
.
put
(
"STminute"
,
""
);
map
.
put
(
"label"
,
""
);
map
.
put
(
"imageJson"
,
"{\"bannerImgNew\":\"//yun.dui88.com/images/201809/v188j55fit.jpg\"}"
);
map
.
put
(
"bannerImgNew"
,
"//yun.dui88.com/images/201809/v188j55fit.jpg"
);
map
.
put
(
"smallImgNew"
,
""
);
map
.
put
(
"imageJsonMap"
,
"{\"bannerImgNew\":\"//yun.dui88.com/images/201809/v188j55fit.jpg\"}"
);
map
.
put
(
"itemId"
,
itemId
);
map
.
put
(
"subtitle"
,
""
);
map
.
put
(
"description"
,
""
);
map
.
put
(
"alertMessage"
,
""
);
map
.
put
(
"exchangeTipTemplate"
,
""
);
map
.
put
(
"largeImgVal"
,
""
);
map
.
put
(
"smallImgVal"
,
""
);
map
.
put
(
""
,
"//yun.dui88.com/images/201809/lf9dta624h.jpg"
);
map
.
put
(
"logoVal"
,
"//yun.dui88.com/images/201809/bzvkv5fvoa.jpg"
);
map
.
put
(
"bannerVal"
,
""
);
map
.
put
(
"limitType"
,
"forever"
);
map
.
put
(
"ambCredits"
,
""
);
map
.
put
(
"salePrice"
,
0
);
map
.
put
(
"remaining"
,
""
);
map
.
put
(
"limitCount"
,
""
);
map
.
put
(
"vipLimitType"
,
""
);
map
.
put
(
"devAudit"
,
""
);
map
.
put
(
"switchChangePlace"
,
""
);
map
.
put
(
"limitEverydayQuantity"
,
""
);
map
.
put
(
"limitDate"
,
""
);
map
.
put
(
"limitTimeBetween"
,
""
);
map
.
put
(
"exchangeLimit"
,
""
);
map
.
put
(
"customTag"
,
""
);
map
.
put
(
"vipgradeList"
,
""
);
map
.
put
(
"vipError"
,
"true"
);
map
.
put
(
"viplimit"
,
"false"
);
map
.
put
(
"canSetVipLimit"
,
"true"
);
map
.
put
(
"switchAccount"
,
""
);
map
.
put
(
"gearType"
,
""
);
map
.
put
(
"aloneGearTag"
,
""
);
map
.
put
(
"hiddenMultiGear"
,
""
);
map
.
put
(
"priceDegreeMap"
,
""
);
map
.
put
(
"token"
,
""
);
map
.
put
(
"appItemExtraDto"
,
""
);
map
.
put
(
"islimit"
,
"false"
);
map
.
put
(
"thumbnail"
,
" //yun.dui88.com/images/201809/lf9dta624h.jpg"
);
map
.
put
(
"dayLimitCount"
,
""
);
map
.
put
(
"minCredits"
,
"200"
);
map
.
put
(
"needUserName"
,
""
);
map
.
put
(
"actualPrice"
,
"100"
);
map
.
put
(
"batchStartDate"
,
""
);
map
.
put
(
"batchEndDate"
,
""
);
map
.
put
(
"dayLimitCountFlag"
,
"false"
);
map
.
put
(
"limitDateFlag"
,
"false"
);
map
.
put
(
"limitTimeBetweenFlag"
,
"false"
);
map
.
put
(
"isAccountBoundFlag"
,
"false"
);
map
.
put
(
"productPrice"
,
""
);
map
.
put
(
"marketPrice"
,
""
);
map
.
put
(
"type"
,
type
);
map
.
put
(
"creditsRate"
,
""
);
map
.
put
(
"bizCredits"
,
""
);
map
.
put
(
"buttonText"
,
""
);
map
.
put
(
"isSeries"
,
""
);
map
.
put
(
"supportBalanceDeduct"
,
""
);
map
.
put
(
"attributeList"
,
""
);
map
.
put
(
"seckillLimit"
,
"false"
);
map
.
put
(
"accountPrompt"
,
""
);
map
.
put
(
"axpressTemplateList"
,
""
);
map
.
put
(
"preRemaining"
,
""
);
Response
response
=
given
().
contentType
(
"application/x-www-form-urlencoded;charset=UTF-8"
).
cookies
(
authorization
.
hdLoginSaas
()).
params
(
map
).
post
(
url
);
// response.prettyPrint();
try
{
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"desc"
),
"成功"
);
}
catch
(
Exception
e
){
throw
new
Exception
(
"创建接口失败,返回信息:"
+
response
.
asString
());
}
catch
(
Error
er
){
throw
new
Exception
(
"创建接口失败,返回信息:"
+
response
.
asString
());
}
return
response
;
}
//查询列表
public
Response
appItems
(
String
appId
,
String
rowId
,
String
itemType
,
String
status
,
String
itemName
,
String
belong
,
String
priceType
)
throws
Exception
{
String
url
=
"http://"
+
hdHost
+
"/devItem/appItems"
;
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"appId"
,
appId
);
map
.
put
(
"rowId"
,
rowId
);
map
.
put
(
"itemType"
,
itemType
);
map
.
put
(
"status"
,
status
);
map
.
put
(
"itemName"
,
itemName
);
map
.
put
(
"belong"
,
belong
);
map
.
put
(
"priceType"
,
priceType
);
// logger.info("======="+url);
Response
response
=
given
().
contentType
(
"application/x-www-form-urlencoded;charset=UTF-8"
).
cookies
(
authorization
.
hdLoginSaas
()).
params
(
map
).
post
(
url
);
try
{
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"success"
),
"true"
,
"/devItem/appItems接口失败"
);
}
catch
(
Exception
e
){
throw
new
Exception
(
"/devItem/appItems接口失败,返回信息:"
+
response
.
asString
());
}
catch
(
Error
er
){
throw
new
Exception
(
"/devItem/appItems接口失败,返回信息:"
+
response
.
asString
());
}
return
response
;
}
//修改话费
public
Response
doUpdateAppItemHuafei
(
String
appId
,
String
appItemId
,
String
title
,
String
credits
,
String
itemId
,
String
type
)
throws
Exception
{
String
url
=
"http://"
+
hdHost
+
"/devItem/doUpdateAppItem"
;
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"appId"
,
appId
);
map
.
put
(
"appItemId"
,
appItemId
);
map
.
put
(
"title"
,
title
);
map
.
put
(
"description"
,
" <p>2元手机话费直充,全国通用,全网通用,快速到"
);
map
.
put
(
"facePrice"
,
"2"
);
map
.
put
(
"ambCredits"
,
""
);
map
.
put
(
"credits"
,
credits
);
map
.
put
(
"salePrice"
,
0
);
map
.
put
(
"remaining"
,
""
);
map
.
put
(
"unitStatus"
,
"0"
);
map
.
put
(
"showValue"
,
"false"
);
map
.
put
(
"holder"
,
"每个用户最多可兑换的次数,不填则不做限制"
);
map
.
put
(
"limitCount"
,
""
);
map
.
put
(
"limitType"
,
"forever"
);
map
.
put
(
"autoOffDate"
,
""
);
map
.
put
(
"levelLimit"
,
"false"
);
map
.
put
(
"levelLimitType"
,
"select"
);
map
.
put
(
"levelselect"
,
0
);
map
.
put
(
"levelcheckbox"
,
""
);
map
.
put
(
"exchangeLimit"
,
""
);
map
.
put
(
"limitTimeBetweenFlag"
,
"false"
);
map
.
put
(
"dayLimitCount"
,
""
);
map
.
put
(
"startDay"
,
""
);
map
.
put
(
"endDay"
,
""
);
map
.
put
(
"EThours"
,
""
);
map
.
put
(
"ETminute"
,
""
);
map
.
put
(
"SThours"
,
""
);
map
.
put
(
"STminute"
,
""
);
map
.
put
(
"customTagText"
,
""
);
map
.
put
(
"customTagColor"
,
"#fe4a21"
);
map
.
put
(
"aloneGearTag"
,
""
);
map
.
put
(
"gearType"
,
""
);
map
.
put
(
"hiddenMultiGear"
,
""
);
map
.
put
(
"needUserName"
,
""
);
map
.
put
(
"accountPrompt"
,
""
);
map
.
put
(
"indexHidden"
,
"false"
);
map
.
put
(
"isOwner"
,
""
);
map
.
put
(
"label"
,
""
);
map
.
put
(
"isImport"
,
"false"
);
map
.
put
(
"supportBalanceDeduct"
,
0
);
map
.
put
(
"imageJson"
,
"{\"smallImgNew\":\"\",\"bannerImgNew\":\"\"}"
);
map
.
put
(
"bannerImgNew"
,
""
);
map
.
put
(
"smallImgNew"
,
""
);
map
.
put
(
"imageJsonMap"
,
" {\"smallImgNew\":\"\",\"bannerImgNew\":\"\"}"
);
map
.
put
(
"itemId"
,
itemId
);
map
.
put
(
"subtitle"
,
""
);
map
.
put
(
"alertMessage"
,
""
);
map
.
put
(
"exchangeTipTemplate"
,
""
);
map
.
put
(
"largeImgVal"
,
"//yun.duiba.com.cn/developer/img/phonebilldingzhi2/telephone_charger_details.jpg"
);
map
.
put
(
"smallImgVal"
,
"//yun.duiba.com.cn/developer/img/phonebilldingzhi2/telephone_charge_breviary.jpg"
);
map
.
put
(
"logoVal"
,
"//yun.duiba.com.cn/developer/img/phonebilldingzhi1/telephone_charge_logo.png"
);
map
.
put
(
"bannerVal"
,
"/yun.duiba.com.cn/developer/img/phonebilldingzhi2/telephone_charge_banner.jpg"
);
map
.
put
(
"vipLimitType"
,
""
);
map
.
put
(
"devAudit"
,
""
);
map
.
put
(
"switchChangePlace"
,
""
);
map
.
put
(
"limitEverydayQuantity"
,
""
);
map
.
put
(
"limitDate"
,
""
);
map
.
put
(
"limitTimeBetween"
,
""
);
map
.
put
(
"customTag"
,
""
);
map
.
put
(
"vipgradeList"
,
""
);
map
.
put
(
"vipError"
,
"true"
);
map
.
put
(
"viplimit"
,
"false"
);
map
.
put
(
"canSetVipLimit"
,
"true"
);
map
.
put
(
"switchAccount"
,
""
);
map
.
put
(
"priceDegreeMap"
,
""
);
map
.
put
(
"token"
,
""
);
map
.
put
(
"appItemExtraDto"
,
""
);
map
.
put
(
"islimit"
,
"false"
);
map
.
put
(
"thumbnail"
,
"//yun.duiba.com.cn/developer/img/phonebilldingzhi2/telephone_charge_breviary.jpg"
);
map
.
put
(
"minCredits"
,
"200"
);
map
.
put
(
"actualPrice"
,
"200"
);
map
.
put
(
"batchStartDate"
,
""
);
map
.
put
(
"batchEndDate"
,
""
);
map
.
put
(
"dayLimitCountFlag"
,
"false"
);
map
.
put
(
"limitDateFlag"
,
"false"
);
map
.
put
(
"autoOffDateFlag"
,
"false"
);
map
.
put
(
"isAccountBoundFlag"
,
"false"
);
map
.
put
(
"productPrice"
,
"<a class=\"kouTab\" href=\"/docs/phonePrice\" target=\"_blank\">费率表</a>"
);
map
.
put
(
"marketPrice"
,
"200"
);
map
.
put
(
"type"
,
type
);
map
.
put
(
"creditsRate"
,
"100"
);
map
.
put
(
"bizCredits"
,
""
);
map
.
put
(
"buttonText"
,
""
);
map
.
put
(
"isSeries"
,
""
);
map
.
put
(
"attributeList"
,
""
);
map
.
put
(
"seckillLimit"
,
"false"
);
map
.
put
(
"accountPrompt"
,
""
);
map
.
put
(
"axpressTemplateList"
,
""
);
map
.
put
(
"preRemaining"
,
""
);
Response
response
=
given
().
contentType
(
"application/x-www-form-urlencoded;charset=UTF-8"
).
cookies
(
authorization
.
hdLoginSaas
()).
params
(
map
).
post
(
url
);
// response.prettyPrint();
try
{
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"desc"
),
"成功"
);
}
catch
(
Exception
e
){
throw
new
Exception
(
"创建接口失败,返回信息:"
+
response
.
asString
());
}
catch
(
Error
er
){
throw
new
Exception
(
"创建接口失败,返回信息:"
+
response
.
asString
());
}
return
response
;
}
//修改支付宝
public
Response
doUpdateAppItemZhifubao
(
String
appId
,
String
appItemId
,
String
title
,
String
credits
,
String
itemId
,
String
type
)
throws
Exception
{
String
url
=
"http://"
+
hdHost
+
"/devItem/doUpdateAppItem"
;
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"appId"
,
appId
);
map
.
put
(
"priceDegreeMap"
,
""
);
map
.
put
(
"appItemId"
,
appItemId
);
map
.
put
(
"title"
,
title
);
map
.
put
(
"description"
,
" <p>2元手机话费直充,全国通用,全网通用,快速到"
);
map
.
put
(
"facePrice"
,
"2"
);
map
.
put
(
"ambCredits"
,
""
);
map
.
put
(
"credits"
,
credits
);
map
.
put
(
"salePrice"
,
0
);
map
.
put
(
"remaining"
,
""
);
map
.
put
(
"unitStatus"
,
"0"
);
map
.
put
(
"showValue"
,
"false"
);
map
.
put
(
"holder"
,
"每个用户最多可兑换的次数,不填则不做限制"
);
map
.
put
(
"limitCount"
,
""
);
map
.
put
(
"limitType"
,
"forever"
);
map
.
put
(
"autoOffDate"
,
""
);
map
.
put
(
"levelLimit"
,
"false"
);
map
.
put
(
"levelLimitType"
,
"select"
);
map
.
put
(
"levelselect"
,
0
);
map
.
put
(
"levelcheckbox"
,
""
);
map
.
put
(
"exchangeLimit"
,
""
);
map
.
put
(
"limitTimeBetweenFlag"
,
"false"
);
map
.
put
(
"dayLimitCount"
,
""
);
map
.
put
(
"startDay"
,
""
);
map
.
put
(
"endDay"
,
""
);
map
.
put
(
"EThours"
,
""
);
map
.
put
(
"ETminute"
,
""
);
map
.
put
(
"SThours"
,
""
);
map
.
put
(
"STminute"
,
""
);
map
.
put
(
"customTagText"
,
""
);
map
.
put
(
"customTagColor"
,
"#fe4a21"
);
map
.
put
(
"aloneGearTag"
,
""
);
map
.
put
(
"gearType"
,
""
);
map
.
put
(
"hiddenMultiGear"
,
""
);
map
.
put
(
"needUserName"
,
""
);
map
.
put
(
"accountPrompt"
,
""
);
map
.
put
(
"indexHidden"
,
"false"
);
map
.
put
(
"isOwner"
,
""
);
map
.
put
(
"label"
,
""
);
map
.
put
(
"isImport"
,
"false"
);
map
.
put
(
"supportBalanceDeduct"
,
0
);
map
.
put
(
"imageJson"
,
"{\"smallImgNew\":\"\",\"bannerImgNew\":\"\"}"
);
map
.
put
(
"bannerImgNew"
,
""
);
map
.
put
(
"smallImgNew"
,
""
);
map
.
put
(
"imageJsonMap"
,
" {\"smallImgNew\":\"\",\"bannerImgNew\":\"\"}"
);
map
.
put
(
"itemId"
,
itemId
);
map
.
put
(
"subtitle"
,
""
);
map
.
put
(
"alertMessage"
,
""
);
map
.
put
(
"exchangeTipTemplate"
,
""
);
map
.
put
(
"largeImgVal"
,
"//yun.duiba.com.cn/developer/img/phonebilldingzhi2/telephone_charger_details.jpg"
);
map
.
put
(
"smallImgVal"
,
"//yun.duiba.com.cn/developer/img/phonebilldingzhi2/telephone_charge_breviary.jpg"
);
map
.
put
(
"logoVal"
,
"//yun.duiba.com.cn/developer/img/phonebilldingzhi1/telephone_charge_logo.png"
);
map
.
put
(
"bannerVal"
,
"/yun.duiba.com.cn/developer/img/phonebilldingzhi2/telephone_charge_banner.jpg"
);
map
.
put
(
"vipLimitType"
,
""
);
map
.
put
(
"devAudit"
,
""
);
map
.
put
(
"switchChangePlace"
,
""
);
map
.
put
(
"limitEverydayQuantity"
,
""
);
map
.
put
(
"limitDate"
,
""
);
map
.
put
(
"limitTimeBetween"
,
""
);
map
.
put
(
"customTag"
,
""
);
map
.
put
(
"vipgradeList"
,
""
);
map
.
put
(
"vipError"
,
"true"
);
map
.
put
(
"viplimit"
,
"false"
);
map
.
put
(
"canSetVipLimit"
,
"true"
);
map
.
put
(
"switchAccount"
,
""
);
map
.
put
(
"priceDegreeMap"
,
""
);
map
.
put
(
"token"
,
""
);
map
.
put
(
"appItemExtraDto"
,
""
);
map
.
put
(
"islimit"
,
"false"
);
map
.
put
(
"thumbnail"
,
"//yun.duiba.com.cn/developer/img/phonebilldingzhi2/telephone_charge_breviary.jpg"
);
map
.
put
(
"minCredits"
,
"200"
);
map
.
put
(
"actualPrice"
,
"200"
);
map
.
put
(
"batchStartDate"
,
""
);
map
.
put
(
"batchEndDate"
,
""
);
map
.
put
(
"dayLimitCountFlag"
,
"false"
);
map
.
put
(
"limitDateFlag"
,
"false"
);
map
.
put
(
"autoOffDateFlag"
,
"false"
);
map
.
put
(
"isAccountBoundFlag"
,
"false"
);
map
.
put
(
"productPrice"
,
"<a class=\"kouTab\" href=\"/docs/phonePrice\" target=\"_blank\">费率表</a>"
);
map
.
put
(
"marketPrice"
,
"200"
);
map
.
put
(
"type"
,
type
);
map
.
put
(
"creditsRate"
,
"100"
);
map
.
put
(
"bizCredits"
,
""
);
map
.
put
(
"buttonText"
,
""
);
map
.
put
(
"isSeries"
,
""
);
map
.
put
(
"attributeList"
,
""
);
map
.
put
(
"seckillLimit"
,
"false"
);
map
.
put
(
"accountPrompt"
,
""
);
map
.
put
(
"axpressTemplateList"
,
""
);
map
.
put
(
"preRemaining"
,
""
);
Response
response
=
given
().
contentType
(
"application/x-www-form-urlencoded;charset=UTF-8"
).
cookies
(
authorization
.
hdLoginSaas
()).
params
(
map
).
post
(
url
);
// response.prettyPrint();
try
{
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"desc"
),
"成功"
);
}
catch
(
Exception
e
){
throw
new
Exception
(
"创建接口失败,返回信息:"
+
response
.
asString
());
}
catch
(
Error
er
){
throw
new
Exception
(
"创建接口失败,返回信息:"
+
response
.
asString
());
}
return
response
;
}
//修改手机流量
}
src/test/java/http/service/app/VirtualExchangeService.java
View file @
8fb108e1
...
...
@@ -42,4 +42,26 @@ public class VirtualExchangeService {
return
response
;
}
public
Response
exchange2
(
Map
cookies
,
String
appItemId
,
String
degreeId
)
throws
Exception
{
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"appItemId"
,
appItemId
);
map
.
put
(
"degreeId"
,
degreeId
);
map
.
put
(
"token"
,
"xz9eyi"
);
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
try
{
Assert
.
assertEquals
(
String
.
valueOf
(
response
.
getStatusCode
()),
"200"
,
"/objectExchange/exchange接口返回异常"
);
}
catch
(
Exception
e
){
throw
new
Exception
(
"/objectExchange/exchange接口返回异常,返回信息:"
+
response
.
asString
());
}
catch
(
Error
er
){
throw
new
Exception
(
"/objectExchange/exchange接口返回异常,返回信息:"
+
response
.
asString
());
}
return
response
;
}
}
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