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
4c417f96
Commit
4c417f96
authored
Nov 12, 2018
by
chenjianfang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
hmx
parent
3a12eb46
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
244 additions
and
13 deletions
+244
-13
商品管理操作_DuibaTest.java
...t/java/http/cases/SaasDeveloperTest/商品管理操作_DuibaTest.java
+77
-2
SpglczService.java
src/test/java/http/service/Saas/SpglczService.java
+167
-11
No files found.
src/test/java/http/cases/SaasDeveloperTest/商品管理操作_DuibaTest.java
View file @
4c417f96
...
@@ -82,10 +82,12 @@ public class 商品管理操作_DuibaTest extends AbstractTestNGSpringContextTes
...
@@ -82,10 +82,12 @@ public class 商品管理操作_DuibaTest extends AbstractTestNGSpringContextTes
logger
.
info
(
"校验title,belong成功"
);
logger
.
info
(
"校验title,belong成功"
);
//
获取到上架商品id
//
查看完存在后,再删除复制的app数据
String
ids3
=
response2
.
jsonPath
().
getString
(
"data.list[0].id"
);
String
ids3
=
response2
.
jsonPath
().
getString
(
"data.list[0].id"
);
logger
.
info
(
ids3
);
String
ids4
=
response2
.
jsonPath
().
getString
(
"data.list[1].id"
);
String
ids4
=
response2
.
jsonPath
().
getString
(
"data.list[1].id"
);
//先删除19515 app数据
logger
.
info
(
ids4
);
//先删除20979 app数据
czService
.
doBatchDel2
(
ids3
,
ids4
);
czService
.
doBatchDel2
(
ids3
,
ids4
);
...
@@ -126,10 +128,83 @@ public class 商品管理操作_DuibaTest extends AbstractTestNGSpringContextTes
...
@@ -126,10 +128,83 @@ public class 商品管理操作_DuibaTest extends AbstractTestNGSpringContextTes
// 获取到上架商品id
// 获取到上架商品id
String
ids
=
response
.
jsonPath
().
getString
(
"data.list[0].id"
);
String
ids
=
response
.
jsonPath
().
getString
(
"data.list[0].id"
);
String
ids2
=
response
.
jsonPath
().
getString
(
"data.list[1].id"
);
String
ids2
=
response
.
jsonPath
().
getString
(
"data.list[1].id"
);
//先删除19515 app数据
czService
.
doBatchDel
(
ids
,
ids2
);
}
}
@Test
(
description
=
"添加商品分组并把2个商品加入分组"
)
public
void
e_
添加分组
()
throws
Exception
{
String
data
=
PublicMethod
.
data
();
//添加商品分组
czService
.
editClassify
();
// 查询商品分组是否添加成功
czService
.
classify
();
//先添加2个商品,加入到商品分组中
developerVirtualService
.
doUpdateVirtual
(
"【自动化】加钱购自有虚拟商品"
+
data
,
"标识符100=10+1"
);
developerVirtualService
.
doUpdateVirtual
(
"【自动化】加钱购自有虚拟商品"
+
data
,
"标识符100=10+1"
);
//查询实物商品集合
Response
response
=
czService
.
appItems
();
// 获取到上架商品id
String
s1
=
response
.
jsonPath
().
getString
(
"data.list[0].id"
);
String
s2
=
response
.
jsonPath
().
getString
(
"data.list[1].id"
);
Response
response2
=
czService
.
classify
();
String
classifyId
=
response2
.
jsonPath
().
getString
(
"data.list[0].id"
);
czService
.
saveToClassify
(
classifyId
,
s1
,
s2
);
//查询商品分组集合,确认2个商品是否添加到分组中
Response
response3
=
czService
.
classify
();
//查看商品列表确认是否上架成功
Assert
.
assertEquals
(
response3
.
jsonPath
().
getString
(
"data.list[0].appItemNum"
),
"2"
,
"校验商品加入分组成功"
);
Assert
.
assertEquals
(
response3
.
jsonPath
().
getString
(
"data.list[0].name"
),
"【自动化】商品分组1"
,
"校验商品分组名称失败"
);
logger
.
info
(
"校验商品分组成功"
);
}
@Test
(
description
=
"移除分组"
)
public
void
f_
移除分组
()
throws
Exception
{
String
data
=
PublicMethod
.
data
();
Response
response
=
czService
.
classify
();
String
classifyId
=
response
.
jsonPath
().
getString
(
"data.list[0].id"
);
Response
response2
=
czService
.
appItems4
(
classifyId
);
String
appItemId
=
response2
.
jsonPath
().
getString
(
"data.list[0].id"
);
String
appItemId2
=
response2
.
jsonPath
().
getString
(
"data.list[1].id"
);
//移除分组
czService
.
removeClassifyAppItem
(
appItemId
,
classifyId
);
czService
.
removeClassifyAppItem
(
appItemId2
,
classifyId
);
Assert
.
assertEquals
(
czService
.
removeClassifyAppItem
(
appItemId
,
classifyId
).
jsonPath
().
getString
(
"data.message"
),
"移除成功"
,
"校验移除商品接口成功"
);
logger
.
info
(
"校验移除商品分组成功"
);
}
@Test
(
description
=
"删除分组"
)
public
void
g_
删除分组
()
throws
Exception
{
String
data
=
PublicMethod
.
data
();
String
classifyId
=
czService
.
classify
().
jsonPath
().
getString
(
"data.list[0].id"
);
czService
.
deleteClassify
(
classifyId
);
// 查询商品分组列表
Response
response
=
czService
.
classify
();
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.totalCount"
),
"0"
,
"校验商品分组删除接口失败"
);
logger
.
info
(
"校验商品分组删除接口成功"
);
}
}
}
src/test/java/http/service/Saas/SpglczService.java
View file @
4c417f96
...
@@ -30,19 +30,22 @@ public class SpglczService {
...
@@ -30,19 +30,22 @@ public class SpglczService {
private
DuibaLog
logger
=
DuibaLog
.
getLogger
();
private
DuibaLog
logger
=
DuibaLog
.
getLogger
();
//查询商品管理列表数据
//查询商品管理列表数据
:appid=19515
public
Response
appItems
()
throws
Exception
{
public
Response
appItems
()
throws
Exception
{
String
url
=
hdHost
+
"/devItem/appItems"
;
String
url
=
hdHost
+
"/devItem/appItems"
;
Map
<
String
,
String
>
map
=
new
HashMap
<>();
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"appId"
,
"19515"
);
map
.
put
(
"rowId"
,
"1"
);
map
.
put
(
"rowId"
,
"1"
);
map
.
put
(
"pageSize"
,
""
);
map
.
put
(
"itemType"
,
""
);
map
.
put
(
"itemType"
,
""
);
map
.
put
(
"status"
,
""
);
map
.
put
(
"itemName"
,
""
);
map
.
put
(
"belong"
,
""
);
map
.
put
(
"belong"
,
""
);
map
.
put
(
"status"
,
""
);
map
.
put
(
"priceType"
,
""
);
map
.
put
(
"priceType"
,
""
);
map
.
put
(
"itemName"
,
""
);
map
.
put
(
"appId"
,
"19515"
);
map
.
put
(
"classifyId"
,
""
);
logger
.
info
(
"请求查询商品url:"
+
url
);
logger
.
info
(
"请求查询商品url:"
+
url
);
Response
response
=
given
().
contentType
(
"application/x-www-form-urlencoded;charset=UTF-8"
).
cookies
(
authorization
.
hdLoginSaas
()).
params
(
map
).
post
(
"http://"
+
url
);
Response
response
=
given
().
contentType
(
"application/x-www-form-urlencoded;charset=UTF-8"
).
cookies
(
authorization
.
hdLoginSaas
()).
params
(
map
).
post
(
"http://"
+
url
);
response
.
prettyPrint
();
response
.
prettyPrint
();
...
@@ -62,14 +65,17 @@ public class SpglczService {
...
@@ -62,14 +65,17 @@ public class SpglczService {
String
url
=
hdHost
+
"/devItem/appItems"
;
String
url
=
hdHost
+
"/devItem/appItems"
;
Map
<
String
,
String
>
map
=
new
HashMap
<>();
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"appId"
,
"20979"
);
map
.
put
(
"rowId"
,
"1"
);
map
.
put
(
"rowId"
,
"1"
);
map
.
put
(
"pageSize"
,
""
);
map
.
put
(
"itemType"
,
""
);
map
.
put
(
"itemType"
,
""
);
map
.
put
(
"status"
,
""
);
map
.
put
(
"itemName"
,
""
);
map
.
put
(
"belong"
,
""
);
map
.
put
(
"belong"
,
""
);
map
.
put
(
"status"
,
""
);
map
.
put
(
"priceType"
,
""
);
map
.
put
(
"priceType"
,
""
);
map
.
put
(
"itemName"
,
""
);
map
.
put
(
"appId"
,
"20979"
);
map
.
put
(
"classifyId"
,
""
);
logger
.
info
(
"请求查询商品url:"
+
url
);
logger
.
info
(
"请求查询商品url:"
+
url
);
Response
response
=
given
().
contentType
(
"application/x-www-form-urlencoded;charset=UTF-8"
).
cookies
(
authorization
.
hdLoginSaas
()).
params
(
map
).
post
(
"http://"
+
url
);
Response
response
=
given
().
contentType
(
"application/x-www-form-urlencoded;charset=UTF-8"
).
cookies
(
authorization
.
hdLoginSaas
()).
params
(
map
).
post
(
"http://"
+
url
);
response
.
prettyPrint
();
response
.
prettyPrint
();
try
{
try
{
...
@@ -88,13 +94,18 @@ public class SpglczService {
...
@@ -88,13 +94,18 @@ public class SpglczService {
String
url
=
hdHost
+
"/devItem/appItems"
;
String
url
=
hdHost
+
"/devItem/appItems"
;
Map
<
String
,
String
>
map
=
new
HashMap
<>();
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"appId"
,
"19515"
);
map
.
put
(
"rowId"
,
"1"
);
map
.
put
(
"rowId"
,
"1"
);
map
.
put
(
"pageSize"
,
""
);
map
.
put
(
"itemType"
,
""
);
map
.
put
(
"itemType"
,
""
);
map
.
put
(
"status"
,
""
);
map
.
put
(
"itemName"
,
"【SaaS-自动化测试】"
);
map
.
put
(
"belong"
,
"duiba"
);
map
.
put
(
"belong"
,
"duiba"
);
map
.
put
(
"status"
,
""
);
map
.
put
(
"priceType"
,
""
);
map
.
put
(
"priceType"
,
""
);
map
.
put
(
"itemName"
,
"【SaaS-自动化测试】"
);
map
.
put
(
"appId"
,
"19515"
);
map
.
put
(
"classifyId"
,
""
);
logger
.
info
(
"请求查询兑吧具体商品url:"
+
url
);
logger
.
info
(
"请求查询兑吧具体商品url:"
+
url
);
Response
response
=
given
().
contentType
(
"application/x-www-form-urlencoded;charset=UTF-8"
).
cookies
(
authorization
.
hdLoginSaas
()).
params
(
map
).
post
(
"http://"
+
url
);
Response
response
=
given
().
contentType
(
"application/x-www-form-urlencoded;charset=UTF-8"
).
cookies
(
authorization
.
hdLoginSaas
()).
params
(
map
).
post
(
"http://"
+
url
);
response
.
prettyPrint
();
response
.
prettyPrint
();
...
@@ -168,7 +179,7 @@ public class SpglczService {
...
@@ -168,7 +179,7 @@ public class SpglczService {
}
}
//appid=20979 的批量删除接口
//
查询复制的
appid=20979 的批量删除接口
public
Response
doBatchDel2
(
String
ids3
,
String
ids4
)
throws
Exception
{
public
Response
doBatchDel2
(
String
ids3
,
String
ids4
)
throws
Exception
{
String
url
=
hdHost
+
"/devItem/doBatchDel"
;
String
url
=
hdHost
+
"/devItem/doBatchDel"
;
Map
<
String
,
String
>
map
=
new
HashMap
<>();
Map
<
String
,
String
>
map
=
new
HashMap
<>();
...
@@ -188,6 +199,151 @@ public class SpglczService {
...
@@ -188,6 +199,151 @@ public class SpglczService {
//添加商品分组
public
Response
editClassify
()
throws
Exception
{
String
url
=
hdHost
+
"/devItem/editClassify"
;
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"appId"
,
"19515"
);
map
.
put
(
"id"
,
""
);
map
.
put
(
"name"
,
"【自动化】商品分组1"
);
map
.
put
(
"classifyImageSwitch"
,
"false"
);
map
.
put
(
"image"
,
""
);
map
.
put
(
"classifyImage"
,
""
);
Response
response
=
given
().
contentType
(
"application/x-www-form-urlencoded;charset=UTF-8"
).
cookies
(
authorization
.
hdLoginSaas
()).
params
(
map
).
post
(
"http://"
+
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
classify
()
throws
Exception
{
String
url
=
hdHost
+
"/devItem/classify"
;
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"rowId"
,
"1"
);
map
.
put
(
"pageSize"
,
"20"
);
map
.
put
(
"appId"
,
"19515"
);
Response
response
=
given
().
contentType
(
"application/x-www-form-urlencoded;charset=UTF-8"
).
cookies
(
authorization
.
hdLoginSaas
()).
params
(
map
).
post
(
"http://"
+
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
saveToClassify
(
String
classifyId
,
String
s1
,
String
s2
)
throws
Exception
{
String
url
=
hdHost
+
"/devItem/saveToClassify"
;
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"appId"
,
"19515"
);
map
.
put
(
"classifyId"
,
classifyId
);
map
.
put
(
"idArray"
,
s1
+
","
+
s2
);
Response
response
=
given
().
contentType
(
"application/x-www-form-urlencoded;charset=UTF-8"
).
cookies
(
authorization
.
hdLoginSaas
()).
params
(
map
).
post
(
"http://"
+
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
appItems4
(
String
classifyId
)
throws
Exception
{
String
url
=
hdHost
+
"/devItem/appItems"
;
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"rowId"
,
"1"
);
map
.
put
(
"pageSize"
,
"10"
);
map
.
put
(
"itemType"
,
""
);
map
.
put
(
"belong"
,
""
);
map
.
put
(
"status"
,
""
);
map
.
put
(
"priceType"
,
""
);
map
.
put
(
"itemName"
,
""
);
map
.
put
(
"appId"
,
"19515"
);
map
.
put
(
"classifyId"
,
classifyId
);
logger
.
info
(
"请求通过商品分组名称查询具体商品url:"
+
url
);
Response
response
=
given
().
contentType
(
"application/x-www-form-urlencoded;charset=UTF-8"
).
cookies
(
authorization
.
hdLoginSaas
()).
params
(
map
).
post
(
"http://"
+
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
removeClassifyAppItem
(
String
appItemId
,
String
classifyId
)
throws
Exception
{
String
url
=
hdHost
+
"/devItem/removeClassifyAppItem"
;
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"appItemId"
,
appItemId
);
map
.
put
(
"appId"
,
"19515"
);
map
.
put
(
"classifyId"
,
classifyId
);
logger
.
info
(
"请求通过商品分组名称查询具体商品url:"
+
url
);
Response
response
=
given
().
contentType
(
"application/x-www-form-urlencoded;charset=UTF-8"
).
cookies
(
authorization
.
hdLoginSaas
()).
params
(
map
).
post
(
"http://"
+
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
deleteClassify
(
String
classifyId
)
throws
Exception
{
String
url
=
hdHost
+
"/devItem/deleteClassify"
;
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"appId"
,
"19515"
);
map
.
put
(
"classifyId"
,
classifyId
);
logger
.
info
(
"删除商品分组url:"
+
url
);
Response
response
=
given
().
contentType
(
"application/x-www-form-urlencoded;charset=UTF-8"
).
cookies
(
authorization
.
hdLoginSaas
()).
params
(
map
).
post
(
"http://"
+
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
;
}
}
}
\ No newline at end of file
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