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
8e25c0e0
Commit
8e25c0e0
authored
Apr 17, 2019
by
吕雯燕
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'duiba_wenyan'
parents
4508ecf9
8a426bac
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
194 additions
and
1 deletion
+194
-1
商品分组组件_DuibaTest.java
...st/java/http/cases/VisualEditorTest/商品分组组件_DuibaTest.java
+166
-0
Authorization.java
src/test/java/http/service/Authorization.java
+1
-1
DevItemNewService.java
src/test/java/http/service/hd/DevItemNewService.java
+27
-0
No files found.
src/test/java/http/cases/VisualEditorTest/商品分组组件_DuibaTest.java
0 → 100644
View file @
8e25c0e0
package
http
.
cases
.
VisualEditorTest
;
import
base.Config
;
import
base.DuibaLog
;
import
base.DuibaTestBase
;
import
http.cases.ExchangeTest.Database
;
import
http.service.hd.DevItemNewService
;
import
io.restassured.response.Response
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.test.context.ContextConfiguration
;
import
org.testng.Assert
;
import
org.testng.annotations.DataProvider
;
import
org.testng.annotations.Test
;
import
utils.PublicMethod
;
import
java.lang.reflect.Method
;
import
java.util.Map
;
import
http.service.Authorization
;
/**
* created by lvwenyan 2019/4/17
*/
public
class
商品分组组件
_DuibaTest
extends
DuibaTestBase
{
@Autowired
DevItemNewService
devItemNewService
;
@Autowired
Authorization
authorization
;
@DataProvider
public
Object
[][]
providerMethod
(
Method
method
)
{
Object
[][]
result
=
null
;
if
(
method
.
getName
().
equals
(
"后台商品分组组件新商品展示"
))
{
result
=
new
Object
[][]{
new
Object
[]{
1
,
"2102"
,
"22561"
,
"商品分组-兑吧新商品"
},
//case1
new
Object
[]{
2
,
"2104"
,
"22561"
,
"商品分组-自有新商品"
},
//case2
};
}
if
(
method
.
getName
().
equals
(
"后台商品分组组件老商品展示"
))
{
result
=
new
Object
[][]{
new
Object
[]{
1
,
"2124"
,
"22542"
,
"商品分组-兑吧老商品"
},
//case1
new
Object
[]{
2
,
"2125"
,
"22542"
,
"商品分组-自有老商品"
},
//case2
};
}
return
result
;
}
/**
* @param caseNum 用例编号
* @param classifyId 商品分组Id
* @param appId appId
* @param caseName 用例名称打印
* @throws Exception
*/
@Test
(
dataProvider
=
"providerMethod"
)
public
void
后台商品分组组件新商品展示
(
int
caseNum
,
String
classifyId
,
String
appId
,
String
caseName
)
throws
Exception
{
logger
.
info
(
"---"
+
caseName
+
"---"
);
Map
cookies
=
authorization
.
hdLoginCommonNew
(
"15855555555"
);
Response
response
=
devItemNewService
.
appItems
(
cookies
,
classifyId
,
appId
);
response
.
prettyPrint
();
switch
(
caseNum
){
case
1
:
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.rows[0].title"
),
"10元话费"
,
"校验第一个商品title失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.rows[0].customCredits"
),
"1000"
,
"校验第一个商品credits失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.rows[1].title"
),
"支付宝充值"
,
"校验第二个商品title失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.rows[1].customCredits"
),
"100000"
,
"校验第二个商品credits失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.rows[2].title"
),
"【自动化勿动】兑吧新实物"
,
"校验第三个商品title失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.rows[2].customCredits"
),
"300"
,
"校验第三个商品credits失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.rows[3].title"
),
"【自动化勿动】兑吧卡密跳转按钮"
,
"校验第四个商品title失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.rows[3].customCredits"
),
"200"
,
"校验第四个商品credits失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.rows[4].title"
),
"【自动化勿动】兑吧新优惠券普通券码跳转"
,
"校验第五个商品title失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.rows[4].customCredits"
),
"100"
,
"校验第五个商品credits失败"
);
logger
.
info
(
"校验商品分组1-兑吧商品成功"
);
break
;
case
2
:
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.rows[0].title"
),
"【自动化勿动】自有卡密"
,
"校验第一个商品title失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.rows[0].customCredits"
),
"550"
,
"校验第一个商品credits失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.rows[1].title"
),
"【自动化勿动】自有充值商品"
,
"校验第二个商品title失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.rows[1].customCredits"
),
"300"
,
"校验第二个商品credits失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.rows[2].title"
),
"【自动化勿动】自有新实物加钱购"
,
"校验第三个商品title失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.rows[2].customCredits"
),
"150"
,
"校验第三个商品credits失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.rows[3].title"
),
"【自动化勿动】自有新优惠券跳转链接"
,
"校验第四个商品title失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.rows[3].customCredits"
),
"100"
,
"校验第四个商品credits失败"
);
logger
.
info
(
"校验商品分组2-自有商品成功"
);
break
;
}
}
/**
* @param caseNum 用例编号
* @param classifyId 商品分组Id
* @param appId appId
* @param caseName 用例名称打印
* @throws Exception
*/
@Test
(
dataProvider
=
"providerMethod"
)
public
void
后台商品分组组件老商品展示
(
int
caseNum
,
String
classifyId
,
String
appId
,
String
caseName
)
throws
Exception
{
logger
.
info
(
"---"
+
caseName
+
"---"
);
Map
cookies
=
authorization
.
hdLoginCommonNew
(
"15833333333"
);
Response
response
=
devItemNewService
.
appItems
(
cookies
,
classifyId
,
appId
);
response
.
prettyPrint
();
switch
(
caseNum
){
case
1
:
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.rows[0].title"
),
"【勿动】兑吧优惠券共享库存测试"
,
"校验第一个商品title失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.rows[0].customCredits"
),
"20"
,
"校验第一个商品credits失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.rows[1].title"
),
"【自动化勿动】兑吧实物日期兑换限制进行中"
,
"校验第二个商品title失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.rows[1].customCredits"
),
"100"
,
"校验第二个商品credits失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.rows[2].title"
),
"5元话费"
,
"校验第三个商品title失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.rows[2].customCredits"
),
"500"
,
"校验第三个商品credits失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.rows[3].title"
),
"支付宝充值"
,
"校验第四个商品title失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.rows[3].customCredits"
),
"1000"
,
"校验第四个商品credits失败"
);
logger
.
info
(
"校验商品分组1-兑吧商品成功"
);
break
;
case
2
:
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.rows[0].title"
),
"【自动化勿动】自有虚拟商品"
,
"校验第一个商品title失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.rows[0].customCredits"
),
"1000"
,
"校验第一个商品credits失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.rows[1].title"
),
"【自动化勿动】自有实物"
,
"校验第二个商品title失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.rows[1].customCredits"
),
"200"
,
"校验第二个商品credits失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.rows[2].title"
),
"【自动化勿动】自有优惠券"
,
"校验第三个商品title失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.rows[2].customCredits"
),
"100"
,
"校验第三个商品credits失败"
);
logger
.
info
(
"校验商品分组2-自有商品成功"
);
break
;
}
}
}
src/test/java/http/service/Authorization.java
View file @
8e25c0e0
...
@@ -384,7 +384,7 @@ public class Authorization {
...
@@ -384,7 +384,7 @@ public class Authorization {
paras
.
put
(
"isAutoLogin"
,
"true"
);
paras
.
put
(
"isAutoLogin"
,
"true"
);
paras
.
put
(
"validate"
,
"22"
);
paras
.
put
(
"validate"
,
"22"
);
Response
response
=
given
().
cookies
(
cookies
).
params
(
paras
).
post
(
url
);
Response
response
=
given
().
cookies
(
cookies
).
params
(
paras
).
post
(
url
);
response
.
prettyPrint
();
//
response.prettyPrint();
hdCookies
=
new
HashMap
<>(
response
.
getCookies
());
hdCookies
=
new
HashMap
<>(
response
.
getCookies
());
if
(
hdCookies
!=
null
&&
hdCookies
.
size
()!=
0
){
if
(
hdCookies
!=
null
&&
hdCookies
.
size
()!=
0
){
hdCookies
.
remove
(
"csrf_token"
);
hdCookies
.
remove
(
"csrf_token"
);
...
...
src/test/java/http/service/hd/DevItemNewService.java
View file @
8e25c0e0
...
@@ -98,6 +98,33 @@ public class DevItemNewService {
...
@@ -98,6 +98,33 @@ public class DevItemNewService {
}
}
//商品分组组件
public
Response
appItems
(
Map
cookies
,
String
classifyId
,
String
appId
)
throws
Exception
{
String
url
=
hdserverHost
+
"/devItemNew/appItems"
;
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"classifyId"
,
classifyId
);
map
.
put
(
"status"
,
"on"
);
map
.
put
(
"pageSize"
,
"100"
);
map
.
put
(
"appId"
,
appId
);
map
.
put
(
"pageNo"
,
"1"
);
logger
.
info
(
"请求商品分组组件接口:"
+
"/devItemNew/appItems"
);
Response
response
=
given
().
contentType
(
"application/json;charset=UTF-8"
).
cookies
(
cookies
).
params
(
map
).
get
(
"http://"
+
url
);
try
{
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"success"
),
"true"
);
}
catch
(
Exception
e
){
throw
new
Exception
(
"/devItemNew/appItems接口返回异常,返回信息:"
+
response
.
asString
());
}
catch
(
Error
er
){
throw
new
Exception
(
"/devItemNew/appItems接口返回异常,返回信息:"
+
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