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
b97c30d5
Commit
b97c30d5
authored
Dec 22, 2018
by
胡梦新
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'hmx' into develop
parents
66b83e56
7aca42b3
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
170 additions
and
12 deletions
+170
-12
设置_应用信息_DuibaTest.java
.../java/http/cases/SaasDeveloperTest/设置_应用信息_DuibaTest.java
+79
-12
ADeveloperService.java
src/test/java/http/service/Manager/ADeveloperService.java
+28
-0
UpdateAppInfoService.java
src/test/java/http/service/Saas/UpdateAppInfoService.java
+63
-0
No files found.
src/test/java/http/cases/SaasDeveloperTest/设置_应用信息_DuibaTest.java
View file @
b97c30d5
package
http
.
cases
.
SaasDeveloperTest
;
package
http
.
cases
.
SaasDeveloperTest
;
import
base.Config
;
import
base.Config
;
import
base.DuibaBase
;
import
http.service.Manager.ADeveloperService
;
import
http.service.Saas.UpdateAppInfoService
;
import
http.service.Saas.UpdateAppInfoService
;
import
base.DuibaLog
;
import
base.DuibaLog
;
import
io.restassured.response.Response
;
import
io.restassured.response.Response
;
import
org.apache.commons.exec.ExecuteException
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.test.context.ContextConfiguration
;
import
org.springframework.test.context.ContextConfiguration
;
import
org.springframework.test.context.testng.AbstractTestNGSpringContextTests
;
import
org.springframework.test.context.testng.AbstractTestNGSpringContextTests
;
import
org.testng.Assert
;
import
org.testng.Assert
;
import
org.testng.annotations.Test
;
import
org.testng.annotations.Test
;
@ContextConfiguration
(
classes
=
Config
.
class
)
public
class
设置
_
应用信息
_DuibaTest
extends
AbstractTestNGSpringContextTests
{
//@ContextConfiguration(classes = Config.class)
public
class
设置
_
应用信息
_DuibaTest
extends
DuibaBase
{
private
DuibaLog
logger
=
DuibaLog
.
getLogger
();
private
DuibaLog
logger
=
DuibaLog
.
getLogger
();
@Autowired
@Autowired
UpdateAppInfoService
updateAppInfoService
;
UpdateAppInfoService
updateAppInfoService
;
@Autowired
ADeveloperService
aDeveloperService
;
String
appId
=
"19515"
;
//设置--保存应用信息
//设置--保存应用信息
@Test
@Test
public
void
保存应用信息
()
throws
Exception
{
public
void
保存应用信息
()
throws
Exception
{
String
appId
=
"19515"
;
String
appId
=
"19515"
;
String
earnCreditsUrl
=
"https://www.baidu.com/s?ie=utf-8&f=8&rsv_bp=1&tn=baidu&wd=www.baidu.com"
;
String
earnCreditsUrl
=
"https://www.baidu.com/s?ie=utf-8&f=8&rsv_bp=1&tn=baidu&wd=www.baidu.com"
;
String
creditsDetailUrl
=
"https://www.baidu.com/s?ie=utf-8&f=8&rsv_bp=1&tn=baidu&wd=www.baidu.com"
;
String
creditsDetailUrl
=
"https://www.baidu.com/s?ie=utf-8&f=8&rsv_bp=1&tn=baidu&wd=www.baidu.com"
;
Response
response
=
updateAppInfoService
.
appInfo
(
appId
);
Response
response
=
updateAppInfoService
.
appInfo
(
appId
);
Boolean
isDecimalOpen
=
response
.
jsonPath
().
getBoolean
(
"data.isDecimalOpen"
);
Boolean
isDecimalOpen
=
response
.
jsonPath
().
getBoolean
(
"data.isDecimalOpen"
);
logger
.
info
(
"******"
+
isDecimalOpen
);
logger
.
info
(
"******"
+
isDecimalOpen
);
String
unitName
=
isDecimalOpen
?
"元"
:
"积分"
;
String
unitName
=
isDecimalOpen
?
"元"
:
"积分"
;
updateAppInfoService
.
UpdateAppInfo
(
appId
,
unitName
,
earnCreditsUrl
,
creditsDetailUrl
,
isDecimalOpen
);
updateAppInfoService
.
UpdateAppInfo
(
appId
,
unitName
,
earnCreditsUrl
,
creditsDetailUrl
,
isDecimalOpen
);
Thread
.
sleep
(
1000
);
Thread
.
sleep
(
1000
);
Response
response2
=
updateAppInfoService
.
appInfo
(
appId
);
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.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"
,
"校验积分明细链接失败"
);
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
(
"保存应用信息成功"
);
logger
.
info
(
"保存应用信息成功"
);
}
}
@Test
(
description
=
"// 查询员工信息——高级管理员信息"
)
public
void
a_
查询高级管理员信息
()
throws
Exception
{
Response
response1
=
aDeveloperService
.
developer
(
"109"
,
"text"
);
logger
.
info
(
"response1"
);
Response
response2
=
updateAppInfoService
.
selectEmployeeList
(
""
,
""
,
appId
);
logger
.
info
(
"response2"
);
String
mappname
=
response1
.
jsonPath
().
getString
(
"list[0].appName"
);
String
memail
=
response1
.
jsonPath
().
getString
(
"list[0].email"
);
String
mname
=
response1
.
jsonPath
().
getString
(
"list[0].name"
);
String
demail
=
response2
.
jsonPath
().
getString
(
"data.list[0].developerAccount"
);
String
dname
=
response2
.
jsonPath
().
getString
(
"data.list[0].nickName"
);
// 校验2个接口的信息是否一致
Assert
.
assertEquals
(
mappname
,
"(saas自动化)至尊版"
,
"校验应用名称失败"
);
Assert
.
assertEquals
(
memail
,
demail
,
"校验邮箱失败"
);
Assert
.
assertEquals
(
mname
,
dname
,
"校验高级管理员名称失败"
);
Assert
.
assertEquals
(
response2
.
jsonPath
().
getString
(
"data.list[0].roleName"
),
"高级管理员"
,
"校验角色名称失败"
);
logger
.
info
(
"校验高级管理员信息成功"
);
}
@Test
(
description
=
"//添加/编辑员工"
)
public
void
b_
添加员工
()
throws
Exception
{
Response
response
=
updateAppInfoService
.
selectAllRoles
(
appId
);
//查询角色接口,得到普通管理员的角色ID
String
roleId
=
response
.
jsonPath
().
getString
(
"data[1].id"
);
//添加一个注册过的开发者&普通管理员信息
updateAppInfoService
.
saveOrUpdate
(
"18258853242"
,
"hmx自动化测试"
,
roleId
,
"普通管理员"
,
appId
);
//刷新员工管理列表
updateAppInfoService
.
selectEmployeeList
(
""
,
"1"
,
appId
);
//校验是否添加成功
Assert
.
assertEquals
(
updateAppInfoService
.
selectEmployeeList
(
""
,
""
,
appId
).
jsonPath
().
getString
(
"data.list[1].developerAccount"
),
"18258853242"
,
"校验账号信息失败"
);
Assert
.
assertEquals
(
updateAppInfoService
.
selectEmployeeList
(
""
,
""
,
appId
).
jsonPath
().
getString
(
"data.list[1].nickName"
),
"hmx自动化测试"
,
"校验名称失败"
);
Assert
.
assertEquals
(
updateAppInfoService
.
selectEmployeeList
(
""
,
""
,
appId
).
jsonPath
().
getString
(
"data.list[1].roleName"
),
"普通管理员"
,
"校验角色名称失败"
);
logger
.
info
(
"校验普通管理员信息添加成功"
);
}
@Test
(
description
=
"兑吧账号精确搜索,姓名模糊搜索"
)
public
void
c_
搜索场景
()
throws
Exception
{
//通过邮箱号精确搜索
updateAppInfoService
.
selectEmployeeList
(
""
,
"wxs@duiba.com.cn"
,
appId
);
//通过手机号精确搜索
updateAppInfoService
.
selectEmployeeList
(
""
,
"18258853242"
,
appId
);
//姓名模糊搜索
updateAppInfoService
.
selectEmployeeList
(
""
,
"hmx"
,
appId
);
//通过角色名称搜索
updateAppInfoService
.
selectEmployeeList
(
"395"
,
""
,
appId
);
logger
.
info
(
"校验各种搜索成功"
);
}
}
}
src/test/java/http/service/Manager/ADeveloperService.java
View file @
b97c30d5
...
@@ -97,4 +97,32 @@ public class ADeveloperService {
...
@@ -97,4 +97,32 @@ public class ADeveloperService {
}
}
return
response
;
return
response
;
}
}
//管理后台-开发者维护-查询开发者账号详细信息
public
Response
developer
(
String
queryStrId
,
String
type
)
throws
Exception
{
String
url
=
"http://"
+
ManagerHost
+
"/newmanager/ADeveloper/developer"
;
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"queryStr"
,
""
);
map
.
put
(
"queryStrId"
,
queryStrId
);
map
.
put
(
"type"
,
type
);
map
.
put
(
"pageNo"
,
"1"
);
map
.
put
(
"pageSize"
,
"20"
);
logger
.
info
(
"url"
+
url
);
Response
response
=
given
().
contentType
(
"application/x-www-form-urlencoded;charset=UTF-8"
).
cookies
(
authorization
.
ssoLogin
()).
params
(
map
).
get
(
url
);
response
.
prettyPrint
();
try
{
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"success"
),
"true"
);
}
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/UpdateAppInfoService.java
View file @
b97c30d5
...
@@ -2,6 +2,8 @@ package http.service.Saas;
...
@@ -2,6 +2,8 @@ package http.service.Saas;
import
base.DuibaLog
;
import
base.DuibaLog
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
http.service.Authorization
;
import
http.service.Authorization
;
import
io.restassured.response.Response
;
import
io.restassured.response.Response
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
@@ -73,4 +75,65 @@ public class UpdateAppInfoService {
...
@@ -73,4 +75,65 @@ public class UpdateAppInfoService {
return
response
;
return
response
;
}
}
//查询员工管理高级管理员信息(模糊查询,没有传参数)
public
Response
selectEmployeeList
(
String
roleId
,
String
keyword
,
String
appId
)
throws
Exception
{
String
url
=
"http://"
+
hdHost
+
"/employee/selectEmployeeList"
;
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"roleId"
,
roleId
);
map
.
put
(
"rowId"
,
"1"
);
map
.
put
(
"keyword"
,
keyword
);
Response
response
=
given
().
contentType
(
"application/x-www-form-urlencoded;charset=UTF-8"
).
cookies
(
authorization
.
hdLoginSaas
(
appId
)).
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
selectAllRoles
(
String
appId
)
throws
Exception
{
String
url
=
"http://"
+
hdHost
+
"/employee/selectAllRoles"
;
Map
<
String
,
String
>
map
=
new
HashMap
<>();
Response
response
=
given
().
contentType
(
"application/x-www-form-urlencoded;charset=UTF-8"
).
cookies
(
authorization
.
hdLoginSaas
(
appId
)).
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
saveOrUpdate
(
String
developerAccount
,
String
nickName
,
String
roleId
,
String
roleName
,
String
appId
)
throws
Exception
{
String
url
=
"http://"
+
hdHost
+
"/employee/saveOrUpdate"
;
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"developerAccount"
,
developerAccount
);
map
.
put
(
"nickName"
,
nickName
);
map
.
put
(
"roleId"
,
roleId
);
map
.
put
(
"roleName"
,
roleName
);
JSONObject
jsonParam
=
JSONObject
.
parseObject
(
JSON
.
toJSONString
(
map
));
Response
response
=
given
().
contentType
(
"application/json;charset=UTF-8"
).
cookies
(
authorization
.
hdLoginSaas
(
appId
)).
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
;
}
}
}
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