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
b21ac13c
Commit
b21ac13c
authored
Dec 06, 2018
by
胡梦新
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
hmx
parent
d46e72b7
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
36 additions
and
40 deletions
+36
-40
补给站.java
src/test/java/http/cases/SaasDeveloperTest/补给站.java
+31
-35
设置_应用信息_DuibaTest.java
.../java/http/cases/SaasDeveloperTest/设置_应用信息_DuibaTest.java
+1
-1
DeveloperBJZ.java
src/test/java/http/service/Saas/DeveloperBJZ.java
+4
-4
No files found.
src/test/java/http/cases/SaasDeveloperTest/补给站.java
View file @
b21ac13c
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
{
public
class
补给站
extends
AbstractTestNGSpringContextTests
{
@Autowired
DeveloperBJZ
developerBJZ
;
@Autowired
DeveloperObjectService
developerObjectService
;
private
DuibaLog
logger
=
DuibaLog
.
getLogger
();
//至尊版app
...
...
@@ -26,44 +23,42 @@ public class 补给站 extends DuibaTestBase {
String
appId2
=
"21695"
;
//至尊版app添加、上架至尊版实物
@Test
@Test
(
description
=
"至尊版app添加、上架至尊版实物"
)
public
void
a_
添加至尊版实物
()
throws
Exception
{
//查询列表,获取ID
Response
response
=
developerBJZ
.
items
(
"2"
,
appId
);
String
itemId
=
String
.
valueOf
(
response
.
jsonPath
().
getString
(
"data.list[0].id"
));
String
itemIds
=
String
.
valueOf
(
response
.
jsonPath
().
getString
(
"data.list[0].id"
));
String
appItemId
=
String
.
valueOf
(
response
.
jsonPath
().
getString
(
"data.list[0].title"
));
String
itemName
=
String
.
valueOf
(
response
.
jsonPath
().
getString
(
"data.list[0].title"
));
//添加
developerBJZ
.
ajaxAddRepo
(
appId
,
itemId
);
//上架
developerBJZ
.
ajaxDirectUp
(
appId
,
itemIds
);
//查询商品列表,验证商品是否上架成功
Response
response2
=
developerBJZ
.
appItems
(
appId
,
appItemId
);
Response
response2
=
developerBJZ
.
appItems
(
appId
,
itemName
);
String
appItemId2
=
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
(
"校验
id,
title,status,type成功"
);
logger
.
info
(
"校验title,status,type成功"
);
//删除添加的商品
developerBJZ
.
ajaxDel
(
appId
,
appItemId2
);
}
//旗舰版app添加、上架至尊版实物:异常场景,提示不能上架
@Test
@Test
(
description
=
"旗舰版app添加、上架至尊版实物:异常场景,提示不能上架"
)
public
void
b_
旗舰版添加至尊版实物
()
throws
Exception
{
//查询列表,获取ID
Response
response
=
developerBJZ
.
items
(
"2"
,
appId2
);
String
id
=
String
.
valueOf
(
response
.
jsonPath
().
getString
(
"data.list[0].id"
));
String
id
=
String
.
valueOf
(
response
.
jsonPath
().
getString
(
"data.list[0].id"
));
//上架
Response
response2
=
developerBJZ
.
ajaxDirectUp2
(
appId2
,
id
);
//接口提示,至尊版专享,不能上架
Assert
.
assertEquals
(
response2
.
jsonPath
().
getString
(
"desc"
),
"至尊版专享"
,
"校验接口上架失败"
);
}
//优质好货搜索功能
@Test
@Test
(
description
=
"优质好货搜索功能"
)
public
void
c_
实物搜索
()
throws
Exception
{
// 根据具体的名称搜索出实物
developerBJZ
.
items2
(
"2"
,
appId
);
...
...
@@ -73,30 +68,31 @@ public class 补给站 extends DuibaTestBase {
}
//添加、上架优惠券
@Test
@Test
(
description
=
"//添加、上架优惠券"
)
public
void
d_
添加至尊版优惠券
()
throws
Exception
{
//查询列表,获取ID
Response
response
=
developerBJZ
.
coupons
(
appId
,
"2"
);
String
id
=
String
.
valueOf
(
response
.
jsonPath
().
getString
(
"data.list[0].id"
));
String
appItemId
=
String
.
valueOf
(
response
.
jsonPath
().
getString
(
"data.list[0].title"
));
String
itemId
=
String
.
valueOf
(
response
.
jsonPath
().
getString
(
"data.list[0].id"
));
String
itemIds
=
String
.
valueOf
(
response
.
jsonPath
().
getString
(
"data.list[0].id"
));
String
itemName
=
String
.
valueOf
(
response
.
jsonPath
().
getString
(
"data.list[0].title"
));
//添加
developerBJZ
.
ajaxAddRepo
(
appId
,
id
);
developerBJZ
.
ajaxAddRepo
(
appId
,
i
temI
d
);
//上架
developerBJZ
.
ajaxDirectUp
(
appId
,
i
d
);
developerBJZ
.
ajaxDirectUp
(
appId
,
i
temIds
);
//查询商品列表,验证商品是否上架成功
Response
response2
=
developerBJZ
.
appItems
(
appId
,
appItemId
);
Response
response2
=
developerBJZ
.
appItems
(
appId
,
itemName
);
String
appItemId2
=
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
(
"校验
id,
title,status,type成功"
);
logger
.
info
(
"校验title,status,type成功"
);
//删除添加的优惠券
developerBJZ
.
ajaxDel
(
appId
,
appItemId2
);
}
//旗舰版app添加、上架至尊版优惠券:异常场景,提示不能上架
@Test
@Test
(
description
=
"//旗舰版app添加、上架至尊版优惠券:异常场景,提示不能上架"
)
public
void
e_
旗舰版添加至尊版优惠券
()
throws
Exception
{
//查询列表,获取ID
Response
response
=
developerBJZ
.
coupons
(
appId2
,
"2"
);
...
...
@@ -107,27 +103,27 @@ public class 补给站 extends DuibaTestBase {
Assert
.
assertEquals
(
response2
.
jsonPath
().
getString
(
"desc"
),
"至尊版专享"
,
"校验接口上架失败"
);
}
@Test
@Test
(
description
=
"//添加直冲类"
)
public
void
f_
添加直冲类
()
throws
Exception
{
Response
response
1
=
developerBJZ
.
directCharges
(
appId
);
String
itemId
=
String
.
valueOf
(
response
1
.
jsonPath
().
getString
(
"data.list[1].id"
));
String
appItemId
=
String
.
valueOf
(
response1
.
jsonPath
().
getString
(
"data.list[1].title"
));
Response
response
=
developerBJZ
.
directCharges
(
appId
);
String
itemId
=
String
.
valueOf
(
response
.
jsonPath
().
getString
(
"data.list[1].id"
));
String
itemName
=
String
.
valueOf
(
response
.
jsonPath
().
getString
(
"data.list[1].title"
));
//添加直冲类
developerBJZ
.
ajaxAddRepo
(
appId
,
itemId
);
//查询商品列表,验证商品是否添加成功
Response
response2
=
developerBJZ
.
appItems
(
appId
,
appItemId
);
String
appItemId2
=
String
.
valueOf
(
response2
.
jsonPath
().
getString
(
"data.list[0].id"
));
Response
response2
=
developerBJZ
.
appItems
(
appId
,
itemName
);
String
appItemId2
=
String
.
valueOf
(
response2
.
jsonPath
().
getString
(
"data.list[0].id"
));
Assert
.
assertEquals
(
response2
.
jsonPath
().
getString
(
"data.list[0].title"
),
"Q币充值"
,
"校验标题名称失败"
);
Assert
.
assertEquals
(
response2
.
jsonPath
().
getString
(
"data.list[0].status"
),
"0"
,
"校验状态失败"
);
Assert
.
assertEquals
(
response2
.
jsonPath
().
getString
(
"data.list[0].type"
),
"qb"
,
"校验
优惠券
类型失败"
);
Assert
.
assertEquals
(
response2
.
jsonPath
().
getString
(
"data.list[0].type"
),
"qb"
,
"校验类型失败"
);
logger
.
info
(
"校验title,status,type成功"
);
//删除添加的直冲类
developerBJZ
.
ajaxDel
(
appId
,
appItemId2
);
}
//添加活动
@Test
@Test
(
description
=
"//添加活动"
)
public
void
g_
添加活动
()
throws
Exception
{
//查询热门活动-活动列表,获取商品ID
Response
response
=
developerBJZ
.
saasActivitys
(
"3"
,
appId
);
...
...
@@ -151,8 +147,8 @@ public class 补给站 extends DuibaTestBase {
}
//添加签到活动
@Test
@Test
(
description
=
"//添加签到活动"
)
public
void
h_
添加签到活动
()
throws
Exception
{
//查询热门活动-活动列表,获取商品ID
Response
response
=
developerBJZ
.
saasActivitys
(
"2"
,
appId
);
...
...
src/test/java/http/cases/SaasDeveloperTest/设置_应用信息_DuibaTest.java
View file @
b21ac13c
...
...
@@ -32,7 +32,7 @@ public class 设置_应用信息_DuibaTest extends AbstractTestNGSpringContextTe
updateAppInfoService
.
UpdateAppInfo
(
appId
,
unitName
,
earnCreditsUrl
,
creditsDetailUrl
,
isDecimalOpen
);
Response
response2
=
updateAppInfoService
.
appInfo
(
appId
);
Assert
.
assertEquals
(
response2
.
jsonPath
().
getString
(
"data.name"
),
"(saas
)接口自动化应用
"
,
"校验应用名称失败"
);
Assert
.
assertEquals
(
response2
.
jsonPath
().
getString
(
"data.name"
),
"(saas
自动化)至尊版
"
,
"校验应用名称失败"
);
Assert
.
assertEquals
(
response2
.
jsonPath
().
getString
(
"data.earnCreditsLetter"
),
"积分文案&2"
,
"校验积分文案失败"
);
Assert
.
assertEquals
(
response2
.
jsonPath
().
getString
(
"data.creditsDetailUrl"
),
"https://www.baidu.com/s?ie=utf-8&f=8&rsv_bp=1&tn=baidu&wd=www.baidu.com"
,
"校验积分明细链接失败"
);
logger
.
info
(
"保存应用信息成功"
);
...
...
src/test/java/http/service/Saas/DeveloperBJZ.java
View file @
b21ac13c
...
...
@@ -29,9 +29,9 @@ public class DeveloperBJZ {
private
DuibaLog
logger
=
DuibaLog
.
getLogger
();
//优质好货--查询至尊版特权TAB
public
Response
items
(
String
type
,
String
appId
)
throws
Exception
{
public
Response
items
(
String
type
,
String
appId
)
throws
Exception
{
String
url
=
"http://"
+
hdHost
+
"/saasitem/items"
;
Map
<
String
,
String
>
map
=
new
HashMap
<>();
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"type"
,
type
);
map
.
put
(
"rowId"
,
"1"
);
map
.
put
(
"itemName"
,
""
);
...
...
@@ -126,8 +126,8 @@ public class DeveloperBJZ {
//旗舰版app上架:至尊特权商品
public
Response
ajaxDirectUp2
(
String
appId2
,
String
itemIds
)
throws
Exception
{
String
url
=
"http://"
+
hdHost
+
"/devRepo/ajaxDirectUp"
;
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"appId"
,
appId2
);
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"appId"
,
appId2
);
map
.
put
(
"itemIds"
,
itemIds
);
Response
response
=
given
().
contentType
(
"application/x-www-form-urlencoded;charset=UTF-8"
).
cookies
(
authorization
.
hdLoginSaas
(
appId2
)).
params
(
map
).
post
(
url
);
response
.
prettyPrint
();
...
...
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