Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
oto
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
龚小红
oto
Commits
c6329439
Commit
c6329439
authored
Oct 20, 2021
by
xiamengchen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
企业后台-框架版需求覆盖
parent
c6ba731f
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
55 additions
and
30 deletions
+55
-30
Auth.java
src/test/java/com/kjj/bean/corp/Auth.java
+1
-1
ManageCorp.java
src/test/java/com/kjj/cases/live/Corp/ManageCorp.java
+43
-24
BasicConfig.java
src/test/java/com/kjj/config/BasicConfig.java
+6
-5
liveTestNG.xml
src/test/liveTestNG.xml
+5
-0
No files found.
src/test/java/com/kjj/bean/corp/Auth.java
View file @
c6329439
...
@@ -5,6 +5,6 @@ import lombok.Data;
...
@@ -5,6 +5,6 @@ import lombok.Data;
@Data
@Data
public
class
Auth
{
public
class
Auth
{
private
String
authName
;
private
String
authName
;
private
l
ong
id
;
private
L
ong
id
;
private
int
totalCount
;
private
int
totalCount
;
}
}
src/test/java/com/kjj/cases/live/Corp/ManageCorp.java
View file @
c6329439
...
@@ -8,6 +8,7 @@ import com.kjj.cases.admin.Authorization;
...
@@ -8,6 +8,7 @@ import com.kjj.cases.admin.Authorization;
import
com.kjj.config.BasicConfig
;
import
com.kjj.config.BasicConfig
;
import
com.kjj.utils.BaseUtils
;
import
com.kjj.utils.BaseUtils
;
import
com.kjj.utils.JsonUtil
;
import
com.kjj.utils.JsonUtil
;
import
com.kjj.utils.ThreadSleepUtils
;
import
io.restassured.response.Response
;
import
io.restassured.response.Response
;
import
org.testng.Assert
;
import
org.testng.Assert
;
import
org.testng.annotations.BeforeClass
;
import
org.testng.annotations.BeforeClass
;
...
@@ -18,10 +19,11 @@ import java.util.*;
...
@@ -18,10 +19,11 @@ import java.util.*;
public
class
ManageCorp
implements
Authorization
{
public
class
ManageCorp
implements
Authorization
{
private
static
final
String
initCompanyName
=
"自动化企业"
;
private
static
final
String
initCompanyName
=
"自动化企业"
;
private
static
String
companyName
;
private
static
String
companyName
;
private
static
String
companyNameOfTimeStamp
;
public
static
long
companyId
;
public
static
long
companyId
;
private
static
final
String
authName
=
"权限等级1"
;
private
static
final
String
authName
=
"权限等级1"
;
public
static
long
authId
;
public
static
long
authId
;
private
static
List
<
Long
>
authToDelete
;
private
static
List
<
Long
>
authToDelete
=
new
ArrayList
<>()
;
private
static
final
String
pageUrl
=
"https://kjj-mng.duibatest.com.cn/#/enterprise/list"
;
private
static
final
String
pageUrl
=
"https://kjj-mng.duibatest.com.cn/#/enterprise/list"
;
private
static
long
pageId
;
private
static
long
pageId
;
private
static
final
String
pageName
=
"自动化页面1"
;
private
static
final
String
pageName
=
"自动化页面1"
;
...
@@ -67,7 +69,12 @@ public class ManageCorp implements Authorization {
...
@@ -67,7 +69,12 @@ public class ManageCorp implements Authorization {
@Test
(
description
=
"编辑企业信息"
,
priority
=
3
)
@Test
(
description
=
"编辑企业信息"
,
priority
=
3
)
public
void
编辑企业信息
()
{
public
void
编辑企业信息
()
{
companyName
=
"企业"
+
new
Date
().
getTime
();
/**
* 以时间戳的不同来使公司名称不重复
*/
// 给companyNameOfTimeStamp变量赋值
getCurrentTimeStamp
();
companyName
=
"自动化企业"
+
companyNameOfTimeStamp
;
Map
<
String
,
Object
>
editCorpPar
=
new
HashMap
<>();
Map
<
String
,
Object
>
editCorpPar
=
new
HashMap
<>();
editCorpPar
.
put
(
"companyName"
,
companyName
);
editCorpPar
.
put
(
"companyName"
,
companyName
);
editCorpPar
.
put
(
"id"
,
companyId
);
editCorpPar
.
put
(
"id"
,
companyId
);
...
@@ -83,8 +90,11 @@ public class ManageCorp implements Authorization {
...
@@ -83,8 +90,11 @@ public class ManageCorp implements Authorization {
@Test
(
description
=
"按照名称搜索企业"
,
priority
=
4
)
@Test
(
description
=
"按照名称搜索企业"
,
priority
=
4
)
public
void
按照名称搜索企业
()
{
public
void
按照名称搜索企业
()
{
// sleep 2秒
// 等待企业信息的变更生效
ThreadSleepUtils
.
sleep
(
2000
);
Map
<
String
,
Object
>
searchCorpPar
=
new
HashMap
<>();
Map
<
String
,
Object
>
searchCorpPar
=
new
HashMap
<>();
searchCorpPar
.
put
(
"companyName"
,
companyName
);
searchCorpPar
.
put
(
"companyName"
,
companyName
OfTimeStamp
);
Response
searchCorpRes
=
network
.
getResponse
(
searchCorpPar
,
BasicConfig
.
MANAGER_corp_searchCorp
);
Response
searchCorpRes
=
network
.
getResponse
(
searchCorpPar
,
BasicConfig
.
MANAGER_corp_searchCorp
);
try
{
try
{
List
<
Map
<
String
,
Object
>>
searchResults
=
searchCorpRes
.
jsonPath
().
getList
(
"data"
);
List
<
Map
<
String
,
Object
>>
searchResults
=
searchCorpRes
.
jsonPath
().
getList
(
"data"
);
...
@@ -92,28 +102,14 @@ public class ManageCorp implements Authorization {
...
@@ -92,28 +102,14 @@ public class ManageCorp implements Authorization {
Assert
.
fail
(
network
.
message
(
searchCorpPar
,
BasicConfig
.
MANAGER_corp_searchCorp
,
"搜索结果数量错误"
,
searchCorpRes
.
body
().
asString
()));
Assert
.
fail
(
network
.
message
(
searchCorpPar
,
BasicConfig
.
MANAGER_corp_searchCorp
,
"搜索结果数量错误"
,
searchCorpRes
.
body
().
asString
()));
}
}
Map
<
String
,
Object
>
searchResult
=
searchResults
.
get
(
0
);
Map
<
String
,
Object
>
searchResult
=
searchResults
.
get
(
0
);
Assert
.
assertEquals
((
long
)
searchResult
.
get
(
"id"
),
companyId
,
network
.
message
(
searchCorpPar
,
BasicConfig
.
MANAGER_corp_searchCorp
,
"搜索结果错误"
,
searchCorpRes
.
body
().
asString
()));
System
.
out
.
println
(
searchResult
);
Assert
.
assertEquals
(
searchResult
.
get
(
"id"
),
(
int
)
companyId
,
network
.
message
(
searchCorpPar
,
BasicConfig
.
MANAGER_corp_searchCorp
,
"搜索结果错误"
,
searchCorpRes
.
body
().
asString
()));
}
catch
(
NullPointerException
e
){
}
catch
(
NullPointerException
e
){
e
.
printStackTrace
();
e
.
printStackTrace
();
Assert
.
fail
(
network
.
message
(
searchCorpPar
,
BasicConfig
.
MANAGER_corp_searchCorp
,
"获取数据失败"
,
searchCorpRes
.
body
().
asString
()));
Assert
.
fail
(
network
.
message
(
searchCorpPar
,
BasicConfig
.
MANAGER_corp_searchCorp
,
"获取数据失败"
,
searchCorpRes
.
body
().
asString
()));
}
}
}
}
@Test
(
description
=
"企业名称唯一不可重复"
,
priority
=
5
)
public
void
企业名称唯一不可重复
()
{
Map
<
String
,
Object
>
saveCorpPar
=
new
HashMap
<>();
saveCorpPar
.
put
(
"companyName"
,
companyName
);
Response
saveCorpRes
=
network
.
postResponse
(
saveCorpPar
,
BasicConfig
.
MANAGER_corp_saveCorp
);
try
{
boolean
success
=
saveCorpRes
.
jsonPath
().
getBoolean
(
"success"
);
Assert
.
assertFalse
(
success
,
network
.
message
(
saveCorpPar
,
BasicConfig
.
MANAGER_corp_saveCorp
,
"添加重复名称的企业成功"
,
saveCorpRes
.
body
().
asString
()));
System
.
out
.
println
(
saveCorpRes
.
body
().
asString
());
}
catch
(
NullPointerException
e
){
e
.
printStackTrace
();
Assert
.
fail
(
network
.
message
(
saveCorpPar
,
BasicConfig
.
MANAGER_corp_saveCorp
,
"获取数据失败"
,
saveCorpRes
.
body
().
asString
()));
}
}
// 权限管理
// 权限管理
@Test
(
description
=
"新增权限等级"
,
priority
=
6
)
@Test
(
description
=
"新增权限等级"
,
priority
=
6
)
public
void
新增权限等级
(){
public
void
新增权限等级
(){
...
@@ -152,6 +148,7 @@ public class ManageCorp implements Authorization {
...
@@ -152,6 +148,7 @@ public class ManageCorp implements Authorization {
e
.
printStackTrace
();
e
.
printStackTrace
();
Assert
.
fail
(
network
.
message
(
authListsPar
,
BasicConfig
.
MANAGER_corp_authLists
,
"获取数据失败"
,
authListsRes
.
body
().
asString
()));
Assert
.
fail
(
network
.
message
(
authListsPar
,
BasicConfig
.
MANAGER_corp_authLists
,
"获取数据失败"
,
authListsRes
.
body
().
asString
()));
}
}
}
}
@Test
(
description
=
"删除权限等级"
,
priority
=
8
)
@Test
(
description
=
"删除权限等级"
,
priority
=
8
)
...
@@ -253,6 +250,7 @@ public class ManageCorp implements Authorization {
...
@@ -253,6 +250,7 @@ public class ManageCorp implements Authorization {
addStaffPar
.
put
(
"staffName"
,
"员工1"
);
addStaffPar
.
put
(
"staffName"
,
"员工1"
);
addStaffPar
.
put
(
"staffPhone"
,
staffPhone
);
addStaffPar
.
put
(
"staffPhone"
,
staffPhone
);
addStaffPar
.
put
(
"authId"
,
authId
);
addStaffPar
.
put
(
"authId"
,
authId
);
addStaffPar
.
put
(
"companyId"
,
companyId
);
Response
addStaffRes
=
network
.
postResponse
(
addStaffPar
,
BasicConfig
.
MANAGER_corp_saveStaff
);
Response
addStaffRes
=
network
.
postResponse
(
addStaffPar
,
BasicConfig
.
MANAGER_corp_saveStaff
);
try
{
try
{
boolean
data
=
addStaffRes
.
jsonPath
().
getBoolean
(
"data"
);
boolean
data
=
addStaffRes
.
jsonPath
().
getBoolean
(
"data"
);
...
@@ -292,6 +290,7 @@ public class ManageCorp implements Authorization {
...
@@ -292,6 +290,7 @@ public class ManageCorp implements Authorization {
addStaffPar
.
put
(
"staffPhone"
,
staffPhone
);
addStaffPar
.
put
(
"staffPhone"
,
staffPhone
);
addStaffPar
.
put
(
"authId"
,
authId
);
addStaffPar
.
put
(
"authId"
,
authId
);
addStaffPar
.
put
(
"id"
,
staffId
);
addStaffPar
.
put
(
"id"
,
staffId
);
addStaffPar
.
put
(
"companyId"
,
companyId
);
Response
addStaffRes
=
network
.
postResponse
(
addStaffPar
,
BasicConfig
.
MANAGER_corp_saveStaff
);
Response
addStaffRes
=
network
.
postResponse
(
addStaffPar
,
BasicConfig
.
MANAGER_corp_saveStaff
);
try
{
try
{
boolean
data
=
addStaffRes
.
jsonPath
().
getBoolean
(
"data"
);
boolean
data
=
addStaffRes
.
jsonPath
().
getBoolean
(
"data"
);
...
@@ -302,21 +301,41 @@ public class ManageCorp implements Authorization {
...
@@ -302,21 +301,41 @@ public class ManageCorp implements Authorization {
}
}
}
}
@Test
(
description
=
"同一公司员工手机号不可重复"
,
priority
=
18
)
@Test
(
description
=
"判断员工手机号是否已存在"
,
priority
=
18
)
public
void
统一公司员工手机号不可重复
()
{
public
void
判断员工手机号是否已存在
()
{
Map
<
String
,
Object
>
phoneExistPar
=
new
HashMap
<>();
phoneExistPar
.
put
(
"companyId"
,
companyId
);
phoneExistPar
.
put
(
"phone"
,
staffPhone
);
Response
phoneExistRes
=
network
.
getResponse
(
phoneExistPar
,
BasicConfig
.
MANAGER_corp_phoneExist
);
try
{
boolean
data
=
phoneExistRes
.
jsonPath
().
getBoolean
(
"data"
);
Assert
.
assertTrue
(
data
,
network
.
message
(
phoneExistPar
,
BasicConfig
.
MANAGER_corp_phoneExist
,
"未校验到号码已重复"
,
phoneExistRes
.
body
().
asString
()));
}
catch
(
NullPointerException
e
){
e
.
printStackTrace
();
Assert
.
fail
(
network
.
message
(
phoneExistPar
,
BasicConfig
.
MANAGER_corp_phoneExist
,
"获取数据失败"
,
phoneExistRes
.
body
().
asString
()));
}
}
@Test
(
description
=
"同一公司员工手机号不可重复"
,
priority
=
19
)
public
void
同一公司员工手机号不可重复
()
{
Map
<
String
,
Object
>
addStaffPar
=
new
HashMap
<>();
Map
<
String
,
Object
>
addStaffPar
=
new
HashMap
<>();
addStaffPar
.
put
(
"staffName"
,
"员工2"
);
addStaffPar
.
put
(
"staffName"
,
"员工2"
);
addStaffPar
.
put
(
"staffPhone"
,
staffPhone
);
addStaffPar
.
put
(
"staffPhone"
,
staffPhone
);
addStaffPar
.
put
(
"authId"
,
authId
);
addStaffPar
.
put
(
"authId"
,
authId
);
addStaffPar
.
put
(
"companyId"
,
companyId
);
Response
addStaffRes
=
network
.
postResponse
(
addStaffPar
,
BasicConfig
.
MANAGER_corp_saveStaff
);
Response
addStaffRes
=
network
.
postResponse
(
addStaffPar
,
BasicConfig
.
MANAGER_corp_saveStaff
);
try
{
try
{
boolean
success
=
addStaffRes
.
jsonPath
().
getBoolean
(
"success"
);
boolean
success
=
addStaffRes
.
jsonPath
().
getBoolean
(
"success"
);
Assert
.
assertFalse
(
success
,
network
.
message
(
addStaffPar
,
BasicConfig
.
MANAGER_corp_saveStaff
,
"统一手机号重复注册员工成功"
,
addStaffRes
.
body
().
asString
()));
Assert
.
assertFalse
(
success
,
network
.
message
(
addStaffPar
,
BasicConfig
.
MANAGER_corp_saveStaff
,
"同一手机号重复注册员工成功"
,
addStaffRes
.
body
().
asString
()));
System
.
out
.
println
(
addStaffRes
.
body
().
asString
());
}
catch
(
NullPointerException
e
){
}
catch
(
NullPointerException
e
){
e
.
printStackTrace
();
e
.
printStackTrace
();
Assert
.
fail
(
network
.
message
(
addStaffPar
,
BasicConfig
.
MANAGER_corp_saveStaff
,
"获取数据失败"
,
addStaffRes
.
body
().
asString
()));
Assert
.
fail
(
network
.
message
(
addStaffPar
,
BasicConfig
.
MANAGER_corp_saveStaff
,
"获取数据失败"
,
addStaffRes
.
body
().
asString
()));
}
}
}
}
public
void
getCurrentTimeStamp
()
{
// 将companyNameOfTimeStamp赋值操作单独封装成一个方法
// 保证在多次使用该变量时他的值不会发生变化
companyNameOfTimeStamp
=
String
.
valueOf
(
new
Date
().
getTime
());
}
}
}
src/test/java/com/kjj/config/BasicConfig.java
View file @
c6329439
...
@@ -1157,14 +1157,15 @@ public class BasicConfig {
...
@@ -1157,14 +1157,15 @@ public class BasicConfig {
public
static
final
String
MANAGER_liveList
=
MANAGER_HOST
+
"/kjy/manager/live/list"
;
public
static
final
String
MANAGER_liveList
=
MANAGER_HOST
+
"/kjy/manager/live/list"
;
// 企业后台
// 企业后台
public
static
final
String
MANAGER_corp_saveCorp
=
MANAGER_HOST
+
"/kjy/manager/
enterprise
/company/saveOrUpdate"
;
public
static
final
String
MANAGER_corp_saveCorp
=
MANAGER_HOST
+
"/kjy/manager/
corp
/company/saveOrUpdate"
;
public
static
final
String
MANAGER_corp_CorpLists
=
MANAGER_HOST
+
"/kjy/manager/corp/company/selectList"
;
public
static
final
String
MANAGER_corp_CorpLists
=
MANAGER_HOST
+
"/kjy/manager/corp/company/selectList"
;
public
static
final
String
MANAGER_corp_searchCorp
=
MANAGER_HOST
+
"/kjy/manager/corp/company/search"
;
public
static
final
String
MANAGER_corp_searchCorp
=
MANAGER_HOST
+
"/kjy/manager/corp/company/search"
;
public
static
final
String
MANAGER_corp_saveAuth
=
MANAGER_HOST
+
"/kjy/manager/
enterprise
/company/auth/saveOrUpdate"
;
public
static
final
String
MANAGER_corp_saveAuth
=
MANAGER_HOST
+
"/kjy/manager/
corp
/company/auth/saveOrUpdate"
;
public
static
final
String
MANAGER_corp_authLists
=
MANAGER_HOST
+
"/kjy/manager/
enterprise
/company/auth/selectList"
;
public
static
final
String
MANAGER_corp_authLists
=
MANAGER_HOST
+
"/kjy/manager/
corp
/company/auth/selectList"
;
public
static
final
String
MANAGER_corp_deleteAuthById
=
MANAGER_HOST
+
"/kjy/manager/corp/company/auth/deleteById"
;
public
static
final
String
MANAGER_corp_deleteAuthById
=
MANAGER_HOST
+
"/kjy/manager/corp/company/auth/deleteById"
;
public
static
final
String
MANAGER_corp_savePage
=
MANAGER_HOST
+
"/kjy/manager/corp/company/page/saveOrUpdate"
;
public
static
final
String
MANAGER_corp_savePage
=
MANAGER_HOST
+
"/kjy/manager/corp/company/page/saveOrUpdate"
;
public
static
final
String
MANAGER_corp_pageLists
=
MANAGER_HOST
+
"/kjy/manager/corp/company/page/selectList"
;
public
static
final
String
MANAGER_corp_pageLists
=
MANAGER_HOST
+
"/kjy/manager/corp/company/page/selectList"
;
public
static
final
String
MANAGER_corp_saveStaff
=
MANAGER_HOST
+
"/kjy/manager/enterprise/company/staff/saveOrUpdate"
;
public
static
final
String
MANAGER_corp_saveStaff
=
MANAGER_HOST
+
"/kjy/manager/corp/company/staff/saveOrUpdate"
;
public
static
final
String
MANAGER_corp_staffList
=
MANAGER_HOST
+
"/kjy/manager/enterprise/company/staff/selectList"
;
public
static
final
String
MANAGER_corp_staffList
=
MANAGER_HOST
+
"/kjy/manager/corp/company/staff/selectList"
;
public
static
final
String
MANAGER_corp_phoneExist
=
MANAGER_HOST
+
"/kjy/manager/corp/company/staff/phoneExist"
;
}
}
src/test/liveTestNG.xml
View file @
c6329439
...
@@ -271,5 +271,10 @@
...
@@ -271,5 +271,10 @@
<class
name=
"com.kjj.cases.live.treasure.GoldenEgg"
/>
<class
name=
"com.kjj.cases.live.treasure.GoldenEgg"
/>
</classes>
</classes>
</test>
</test>
<test
preserve-order=
"true"
name=
"企业后台后台配置"
>
<classes>
<class
name=
"com.kjj.cases.live.Corp.ManageCorp"
/>
</classes>
</test>
</suite>
</suite>
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