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
6eeff78a
Commit
6eeff78a
authored
May 06, 2019
by
吕雯燕
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lv
parent
959a3921
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
134 additions
and
0 deletions
+134
-0
商品分组组件_DuibaTest.java
...st/java/http/cases/VisualEditorTest/商品分组组件_DuibaTest.java
+72
-0
ChwVisualEditorService.java
src/test/java/http/service/app/ChwVisualEditorService.java
+62
-0
No files found.
src/test/java/http/cases/VisualEditorTest/商品分组组件_DuibaTest.java
View file @
6eeff78a
...
...
@@ -4,6 +4,7 @@ import base.DuibaLog;
import
base.DuibaTestBase
;
import
http.cases.ExchangeTest.Database
;
import
http.service.hd.DevItemNewService
;
import
http.service.app.ChwVisualEditorService
;
import
io.restassured.response.Response
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.test.context.ContextConfiguration
;
...
...
@@ -28,6 +29,8 @@ public class 商品分组组件_DuibaTest extends DuibaTestBase {
DevItemNewService
devItemNewService
;
@Autowired
Authorization
authorization
;
@Autowired
ChwVisualEditorService
chwVisualEditorService
;
@DataProvider
public
Object
[][]
providerMethod
(
Method
method
)
{
...
...
@@ -44,6 +47,12 @@ public class 商品分组组件_DuibaTest extends DuibaTestBase {
new
Object
[]{
2
,
"2125"
,
"22542"
,
"商品分组-自有老商品"
},
//case2
};
}
if
(
method
.
getName
().
equals
(
"手机端商品分组组件新商品展示"
))
{
result
=
new
Object
[][]{
new
Object
[]{
1
,
"2102"
,
"商品分组-兑吧新商品"
},
//case1
new
Object
[]{
2
,
"2104"
,
"商品分组-自有新商品"
},
//case2
};
}
return
result
;
}
...
...
@@ -166,4 +175,67 @@ public class 商品分组组件_DuibaTest extends DuibaTestBase {
}
/**
* @param caseNum 用例编号
* @param classifyId 商品分组Id
* @param caseName 用例名称打印
* @throws Exception
*/
@Test
(
dataProvider
=
"providerMethod"
)
public
void
手机端商品分组组件新商品展示
(
int
caseNum
,
String
classifyId
,
String
caseName
)
throws
Exception
{
logger
.
info
(
"---"
+
caseName
+
"---"
);
Map
cookies
=
authorization
.
dafuwengLogin
(
7126
);
Response
response
=
chwVisualEditorService
.
itemsList
(
cookies
,
classifyId
);
response
.
prettyPrint
();
switch
(
caseNum
){
case
1
:
//手机端接口排序与前端不一致
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.list[0].title"
),
"【自动化勿动】兑吧新优惠券普通券码跳转"
,
"校验第一个商品title失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.list[0].titleDownTxt"
),
"100积分"
,
"校验第一个商品credits失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.list[1].title"
),
"【自动化勿动】兑吧卡密跳转按钮"
,
"校验第二个商品title失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.list[1].titleDownTxt"
),
"200积分"
,
"校验第二个商品credits失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.list[2].title"
),
"【自动化勿动】兑吧新实物"
,
"校验第三个商品title失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.list[2].titleDownTxt"
),
"300积分"
,
"校验第三个商品credits失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.list[3].title"
),
"支付宝充值"
,
"校验第四个商品title失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.list[3].titleDownTxt"
),
"10万积分"
,
"校验第四个商品credits失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.list[4].title"
),
"10元话费"
,
"校验第五个商品title失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.list[4].titleDownTxt"
),
"1000积分"
,
"校验第五个商品credits失败"
);
logger
.
info
(
"校验商品分组1-兑吧新商品成功"
);
break
;
case
2
:
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.list[0].title"
),
"【自动化勿动】自有新优惠券跳转链接"
,
"校验第一个商品title失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.list[0].titleDownTxt"
),
"100积分"
,
"校验第一个商品credits失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.list[1].title"
),
"【自动化勿动】自有新实物加钱购"
,
"校验第二个商品title失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.list[1].titleDownTxt"
),
"150积分 + 10.00元"
,
"校验第二个商品credits失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.list[2].title"
),
"【自动化勿动】自有充值商品"
,
"校验第三个商品title失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.list[2].titleDownTxt"
),
"300积分"
,
"校验第三个商品credits失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.list[3].title"
),
"【自动化勿动】自有卡密"
,
"校验第四个商品title失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.list[3].titleDownTxt"
),
"550积分"
,
"校验第四个商品credits失败"
);
logger
.
info
(
"校验商品分组2-自有新商品成功"
);
break
;
}
}
}
src/test/java/http/service/app/ChwVisualEditorService.java
0 → 100644
View file @
6eeff78a
package
http
.
service
.
app
;
import
base.DuibaLog
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
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
org.testng.Assert
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
static
io
.
restassured
.
RestAssured
.
given
;
@Service
public
class
ChwVisualEditorService
{
@Value
(
"${home.host}"
)
private
String
homeHost
;
private
DuibaLog
logger
=
DuibaLog
.
getLogger
();
@Autowired
Authorization
authorization
;
//手机端商品分组组件
public
Response
itemsList
(
Map
cookies
,
String
classifyId
)
throws
Exception
{
String
url
=
"http://"
+
homeHost
+
"/chw/visual-editor/items/list"
;
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"classifyId"
,
classifyId
);
map
.
put
(
"pageNo"
,
"1"
);
map
.
put
(
"pageSize"
,
"300"
);
map
.
put
(
"sort"
,
"custom"
);
logger
.
info
(
"请求/chw/visual-editor/items/list接口"
);
Response
response
=
given
().
contentType
(
"application/json; charset=UTF-8"
).
cookies
(
cookies
).
params
(
map
).
get
(
url
);
try
{
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"success"
),
"true"
);
}
catch
(
Exception
e
){
throw
new
Exception
(
"/chw/visual-editor/items/list接口返回异常,返回信息:"
+
response
.
asString
());
}
catch
(
Error
er
){
throw
new
Exception
(
"/chw/visual-editor/items/list接口返回异常,返回信息:"
+
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