Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
X
xm-autotest-live
Overview
Overview
Details
Activity
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
xiamai-test
xm-autotest-live
Commits
8f1e680c
Commit
8f1e680c
authored
Apr 08, 2021
by
zhangying
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增10个case
parent
85164ec8
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
333 additions
and
6 deletions
+333
-6
src/main/java/com/live/cases/fileManage/commonFolder/TestMultiPartUpload.java
+1
-1
src/main/java/com/live/cases/fileManage/commonFolder/TestSameNameFile.java
+11
-4
src/main/java/com/live/cases/fileManage/myselfFolder/TestDelSelfFolder.java
+87
-0
src/main/java/com/live/cases/fileManage/myselfFolder/TestMoveFolder.java
+1
-1
src/main/java/com/live/cases/fileManage/myselfFolder/TestSameNameSelfFile.java
+59
-0
src/main/java/com/live/cases/fileManage/myselfFolder/TestSelfFolderList.java
+174
-0
No files found.
src/main/java/com/live/cases/fileManage/commonFolder/TestMultiPartUpload.java
View file @
8f1e680c
...
...
@@ -42,7 +42,7 @@ public class TestMultiPartUpload extends XMBaseTest {
bodyMap
.
put
(
"accessTypeEnum"
,
"PUBLIC"
);
bodyMap
.
put
(
"bizCode"
,
"UPLOAD_FOLDER"
);
bodyMap
.
put
(
"data"
,
contentMap
);
bodyMap
.
put
(
"instId"
,
"1235115978015883266"
);
bodyMap
.
put
(
"instId"
,
xmAppApi
.
getLoginInfo
().
getInstId
()
);
bodyMap
.
put
(
"resourceName"
,
"XWX8GXcwRaHmicrZ.pptx"
);
System
.
out
.
println
(
"bodyMap = "
+
bodyMap
);
...
...
src/main/java/com/live/cases/fileManage/commonFolder/TestSameNameFile.java
View file @
8f1e680c
...
...
@@ -5,6 +5,7 @@ import com.live.enums.ApiModele;
import
com.live.enums.RequestType
;
import
com.live.enums.Terminal
;
import
com.live.utils.XMBaseTest
;
import
com.live.xmutils.GetFolderData
;
import
org.testng.Assert
;
import
org.testng.annotations.BeforeMethod
;
import
org.testng.annotations.Test
;
...
...
@@ -29,13 +30,19 @@ public class TestSameNameFile extends XMBaseTest {
* 资料云盘-同名文件查询
*/
@Test
public
void
testSameNameFile
()
{
public
void
testSameNameFile
()
throws
InterruptedException
{
GetFolderData
getFolderData
=
new
GetFolderData
();
JSONObject
folder
=
getFolderData
.
saveFolder
();
//新增文件数据,以免存量数据不足导致运行报错
JSONObject
folderList
=
getFolderData
.
getCommonFolderList
();
System
.
out
.
println
(
"folderList =="
+
folderList
);
String
folderName
=
folderList
.
getJSONObject
(
"result"
).
getJSONArray
(
"records"
).
getJSONObject
(
0
).
getString
(
"folderName"
);
JSONObject
jsonObject
=
new
JSONObject
();
jsonObject
.
put
(
"disk"
,
"COMMON"
);
jsonObject
.
put
(
"folderType"
,
"FOLDER"
);
jsonObject
.
put
(
"instId"
,
"1235115978015883266"
);
jsonObject
.
put
(
"name"
,
"zy自动化测试文件夹1"
);
jsonObject
.
put
(
"instId"
,
xmAppApi
.
getLoginInfo
().
getInstId
()
);
jsonObject
.
put
(
"name"
,
folderName
);
System
.
out
.
println
(
"jsonObject ="
+
jsonObject
);
xmAppApi
.
doRequest
(
RequestType
.
JSON
,
params
,
jsonObject
.
toJSONString
(),
headers
);
...
...
@@ -43,7 +50,7 @@ public class TestSameNameFile extends XMBaseTest {
JSONObject
jsonBody
=
xmAppApi
.
getBodyInJSON
();
System
.
out
.
println
(
"jsonBody ="
+
jsonBody
);
Assert
.
assertEquals
(
jsonBody
.
getJSONObject
(
"result"
).
getString
(
"folderName"
),
"zy自动化测试文件夹1"
);
Assert
.
assertEquals
(
jsonBody
.
getJSONObject
(
"result"
).
getString
(
"folderName"
),
folderName
);
Assert
.
assertEquals
(
"true"
,
jsonBody
.
getString
(
"success"
));
Assert
.
assertEquals
(
"200"
,
jsonBody
.
getString
(
"code"
));
Assert
.
assertEquals
(
"操作成功!"
,
jsonBody
.
getString
(
"message"
));
...
...
src/main/java/com/live/cases/fileManage/myselfFolder/TestDelSelfFolder.java
0 → 100644
View file @
8f1e680c
package
com
.
live
.
cases
.
fileManage
.
myselfFolder
;
import
com.alibaba.fastjson.JSONObject
;
import
com.live.enums.ApiModele
;
import
com.live.enums.RequestType
;
import
com.live.enums.Terminal
;
import
com.live.utils.XMBaseTest
;
import
com.live.xmutils.GetFolderData
;
import
org.testng.Assert
;
import
org.testng.annotations.BeforeMethod
;
import
org.testng.annotations.Test
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
* @Description 删除公共文件列表的文件
* @author zhangying
*/
public
class
TestDelSelfFolder
extends
XMBaseTest
{
@BeforeMethod
public
void
beforeTest
(){
xmAppApi
.
setApiModule
(
ApiModele
.
CloudClass_File
)
.
setApiName
(
"API_delCommomFolder"
)
.
setLoginUser
(
"zhangy-b"
)
//张莹的机构里文件夹数据比较多,所以这里用她的测删除文件夹
.
setTerminal
(
Terminal
.
B
);
super
.
beforeTest
();
}
@Test
(
description
=
"删除单个文件"
)
public
void
testDelSelfFolder
()
throws
InterruptedException
{
GetFolderData
testCommonFolderList
=
new
GetFolderData
();
JSONObject
folderList
=
testCommonFolderList
.
getFolderList
();
String
id
=
folderList
.
getJSONObject
(
"result"
).
getJSONArray
(
"records"
).
getJSONObject
(
0
).
getString
(
"id"
);
System
.
out
.
println
(
"获取id"
+
id
);
JSONObject
jsonObject
=
new
JSONObject
();
List
StringList
=
new
ArrayList
();
StringList
.
add
(
id
);
jsonObject
.
put
(
"ids"
,
StringList
);
jsonObject
.
put
(
"instId"
,
"1300628703858597889"
);
System
.
out
.
println
(
"请求"
+
jsonObject
);
xmAppApi
.
doRequest
(
RequestType
.
JSON
,
params
,
jsonObject
.
toJSONString
(),
headers
).
assetsSuccess
(
true
);
JSONObject
responseRes
=
xmAppApi
.
getBodyInJSON
();
JSONObject
folderList1
=
testCommonFolderList
.
getCommonFolderList
();
String
id1
=
folderList1
.
getJSONObject
(
"result"
).
getJSONArray
(
"records"
).
getJSONObject
(
0
).
getString
(
"id"
);
System
.
out
.
println
(
"id1 == "
+
id1
);
Assert
.
assertEquals
(
"true"
,
responseRes
.
getString
(
"success"
));
Assert
.
assertEquals
(
"200"
,
responseRes
.
getString
(
"code"
));
Assert
.
assertNotEquals
(
id1
,
id
);
}
@Test
(
description
=
"批量删除多个文件"
)
public
void
testDelSelfFolder1
()
throws
InterruptedException
{
GetFolderData
testCommonFolderList
=
new
GetFolderData
();
JSONObject
folderList
=
testCommonFolderList
.
getFolderList
();
System
.
out
.
println
(
"folderList =="
+
folderList
);
String
folderId
=
folderList
.
getJSONObject
(
"result"
).
getJSONArray
(
"records"
).
getJSONObject
(
0
).
getString
(
"id"
);
String
folderId1
=
folderList
.
getJSONObject
(
"result"
).
getJSONArray
(
"records"
).
getJSONObject
(
1
).
getString
(
"id"
);
JSONObject
jsonObject
=
new
JSONObject
();
List
StringList
=
new
ArrayList
();
StringList
.
add
(
folderId
);
StringList
.
add
(
folderId1
);
jsonObject
.
put
(
"ids"
,
StringList
);
jsonObject
.
put
(
"instId"
,
"1300628703858597889"
);
System
.
out
.
println
(
"请求"
+
jsonObject
);
xmAppApi
.
doRequest
(
RequestType
.
JSON
,
params
,
jsonObject
.
toJSONString
(),
headers
).
assetsSuccess
(
true
);
JSONObject
responseRes
=
xmAppApi
.
getBodyInJSON
();
JSONObject
folderList1
=
testCommonFolderList
.
getCommonFolderList
();
String
id
=
folderList1
.
getJSONObject
(
"result"
).
getJSONArray
(
"records"
).
getJSONObject
(
0
).
getString
(
"id"
);
String
id1
=
folderList1
.
getJSONObject
(
"result"
).
getJSONArray
(
"records"
).
getJSONObject
(
0
).
getString
(
"id"
);
System
.
out
.
println
(
"id1 == "
+
id1
);
Assert
.
assertEquals
(
"true"
,
responseRes
.
getString
(
"success"
));
Assert
.
assertEquals
(
"200"
,
responseRes
.
getString
(
"code"
));
Assert
.
assertNotEquals
(
folderId
,
id
);
Assert
.
assertNotEquals
(
folderId1
,
id1
);
}
}
src/main/java/com/live/cases/fileManage/myselfFolder/TestMoveFolder.java
View file @
8f1e680c
...
...
@@ -35,8 +35,8 @@ public class TestMoveFolder extends XMBaseTest {
public
void
testMoveFolder
()
{
GetFolderData
getFolderData
=
new
GetFolderData
();
JSONObject
folderList
=
getFolderData
.
getFolderList
();
JSONObject
folder
=
getFolderData
.
saveMyselfFolder
();
//新增文件数据,以免存量数据不足导致运行报错
JSONObject
folderList
=
getFolderData
.
getFolderList
();
String
folderId
=
folderList
.
getJSONObject
(
"result"
).
getJSONArray
(
"records"
).
getJSONObject
(
0
).
getString
(
"id"
);
...
...
src/main/java/com/live/cases/fileManage/myselfFolder/TestSameNameSelfFile.java
0 → 100644
View file @
8f1e680c
package
com
.
live
.
cases
.
fileManage
.
myselfFolder
;
import
com.alibaba.fastjson.JSONObject
;
import
com.live.enums.ApiModele
;
import
com.live.enums.RequestType
;
import
com.live.enums.Terminal
;
import
com.live.utils.XMBaseTest
;
import
com.live.xmutils.GetFolderData
;
import
org.testng.Assert
;
import
org.testng.annotations.BeforeMethod
;
import
org.testng.annotations.Test
;
/**
* Created by zhangying on 2020/04/08
*/
public
class
TestSameNameSelfFile
extends
XMBaseTest
{
@BeforeMethod
public
void
beforeTest
()
{
xmAppApi
.
setApiModule
(
ApiModele
.
CloudClass_apollo
)
// API 所属模块 必传 读取配置文件config.properties配置的api地址
.
setApiName
(
"API_sameNameFile"
)
// API 名称 必传
.
setLoginUser
(
"zhangy-b"
)
// http 接口,测试账号 必传
.
setTerminal
(
Terminal
.
B
);
// 所属端位(B端,C端,M端等, 必传)
dal
.
setCase_owner
(
"张莹"
);
super
.
beforeTest
();
}
/**
* 资料云盘-同名文件查询
*/
@Test
public
void
testSameNameSelfFile
()
{
GetFolderData
getFolderData
=
new
GetFolderData
();
JSONObject
folder
=
getFolderData
.
saveMyselfFolder
();
//新增文件数据,以免存量数据不足导致运行报错
JSONObject
folderList
=
getFolderData
.
getFolderList
();
System
.
out
.
println
(
"folderList =="
+
folderList
);
String
folderName
=
folderList
.
getJSONObject
(
"result"
).
getJSONArray
(
"records"
).
getJSONObject
(
0
).
getString
(
"folderName"
);
JSONObject
jsonObject
=
new
JSONObject
();
jsonObject
.
put
(
"disk"
,
"MYSELF"
);
jsonObject
.
put
(
"folderType"
,
"FOLDER"
);
jsonObject
.
put
(
"instId"
,
xmAppApi
.
getLoginInfo
().
getInstId
());
jsonObject
.
put
(
"name"
,
folderName
);
System
.
out
.
println
(
"jsonObject ="
+
jsonObject
);
xmAppApi
.
doRequest
(
RequestType
.
JSON
,
params
,
jsonObject
.
toJSONString
(),
headers
);
System
.
out
.
println
(
xmAppApi
);
JSONObject
jsonBody
=
xmAppApi
.
getBodyInJSON
();
System
.
out
.
println
(
"jsonBody ="
+
jsonBody
);
Assert
.
assertEquals
(
jsonBody
.
getJSONObject
(
"result"
).
getString
(
"folderName"
),
folderName
);
Assert
.
assertEquals
(
"true"
,
jsonBody
.
getString
(
"success"
));
Assert
.
assertEquals
(
"200"
,
jsonBody
.
getString
(
"code"
));
Assert
.
assertEquals
(
"操作成功!"
,
jsonBody
.
getString
(
"message"
));
}
}
src/main/java/com/live/cases/fileManage/myselfFolder/TestSelfFolderList.java
0 → 100644
View file @
8f1e680c
package
com
.
live
.
cases
.
fileManage
.
myselfFolder
;
import
com.alibaba.fastjson.JSONObject
;
import
com.live.enums.ApiModele
;
import
com.live.enums.RequestType
;
import
com.live.enums.Terminal
;
import
com.live.utils.XMBaseTest
;
import
org.testng.Assert
;
import
org.testng.annotations.BeforeMethod
;
import
org.testng.annotations.Test
;
/**
* @Description 文件列表,公共文件
* @author zhangyumeng
*/
public
class
TestSelfFolderList
extends
XMBaseTest
{
@BeforeMethod
public
void
beforeTest
(){
xmAppApi
.
setApiModule
(
ApiModele
.
CloudClass_B
)
.
setApiName
(
"API_commonFolderList"
)
.
setLoginUser
(
"zhangy-b"
)
//张莹的账号下数据比较多
.
setTerminal
(
Terminal
.
B
);
dal
.
setCase_owner
(
"张莹/张雨朦"
);
super
.
beforeTest
();
}
@Test
(
description
=
"获取公共文件列表"
)
public
void
testSelfFolderList
(){
JSONObject
jsonObject
=
new
JSONObject
();
//jsonObject.put("bizAccountId","1323235986786807809");
jsonObject
.
put
(
"current"
,
1
);
jsonObject
.
put
(
"disk"
,
"COMMON"
);
jsonObject
.
put
(
"folderIdType"
,
"FOLDER"
);
jsonObject
.
put
(
"instId"
,
xmAppApi
.
getLoginInfo
().
getInstId
());
jsonObject
.
put
(
"searchName"
,
null
);
jsonObject
.
put
(
"size"
,
10
);
System
.
out
.
println
(
"请求"
+
jsonObject
);
xmAppApi
.
doRequest
(
RequestType
.
JSON
,
params
,
jsonObject
.
toJSONString
(),
headers
);
JSONObject
responseRes
=
xmAppApi
.
getBodyInJSON
();
Assert
.
assertEquals
(
"true"
,
responseRes
.
getString
(
"success"
));
}
@Test
(
description
=
"公共文件列表,按名称降序排序"
)
public
void
testSelfFolderList1
(){
JSONObject
jsonObject
=
new
JSONObject
();
jsonObject
.
put
(
"current"
,
1
);
jsonObject
.
put
(
"disk"
,
"COMMON"
);
jsonObject
.
put
(
"folderIdType"
,
"FOLDER"
);
jsonObject
.
put
(
"instId"
,
xmAppApi
.
getLoginInfo
().
getInstId
());
jsonObject
.
put
(
"searchName"
,
null
);
jsonObject
.
put
(
"size"
,
10
);
jsonObject
.
put
(
"sort"
,
"NAME_DESC"
);
jsonObject
.
put
(
"parentId"
,
null
);
System
.
out
.
println
(
"请求"
+
jsonObject
);
xmAppApi
.
doRequest
(
RequestType
.
JSON
,
params
,
jsonObject
.
toJSONString
(),
headers
);
JSONObject
responseRes
=
xmAppApi
.
getBodyInJSON
();
System
.
out
.
println
(
"responseRes =="
+
responseRes
);
Assert
.
assertEquals
(
"true"
,
responseRes
.
getString
(
"success"
));
Assert
.
assertNotNull
(
responseRes
.
getJSONObject
(
"result"
).
getString
(
"total"
));
}
@Test
(
description
=
"公共文件列表,按名称升序排序"
)
public
void
testSelfFolderList2
(){
JSONObject
jsonObject
=
new
JSONObject
();
jsonObject
.
put
(
"current"
,
1
);
jsonObject
.
put
(
"disk"
,
"COMMON"
);
jsonObject
.
put
(
"folderIdType"
,
"FOLDER"
);
jsonObject
.
put
(
"instId"
,
xmAppApi
.
getLoginInfo
().
getInstId
());
jsonObject
.
put
(
"searchName"
,
null
);
jsonObject
.
put
(
"size"
,
10
);
jsonObject
.
put
(
"sort"
,
"NAME_ASC"
);
jsonObject
.
put
(
"parentId"
,
null
);
System
.
out
.
println
(
"请求"
+
jsonObject
);
xmAppApi
.
doRequest
(
RequestType
.
JSON
,
params
,
jsonObject
.
toJSONString
(),
headers
);
JSONObject
responseRes
=
xmAppApi
.
getBodyInJSON
();
System
.
out
.
println
(
"responseRes =="
+
responseRes
);
Assert
.
assertEquals
(
"true"
,
responseRes
.
getString
(
"success"
));
Assert
.
assertNotNull
(
responseRes
.
getJSONObject
(
"result"
).
getString
(
"total"
));
}
@Test
(
description
=
"公共文件列表,按更新时间升序排序"
)
public
void
testSelfFolderList3
(){
JSONObject
jsonObject
=
new
JSONObject
();
jsonObject
.
put
(
"current"
,
1
);
jsonObject
.
put
(
"disk"
,
"COMMON"
);
jsonObject
.
put
(
"folderIdType"
,
"FOLDER"
);
jsonObject
.
put
(
"instId"
,
xmAppApi
.
getLoginInfo
().
getInstId
());
jsonObject
.
put
(
"searchName"
,
null
);
jsonObject
.
put
(
"size"
,
10
);
jsonObject
.
put
(
"sort"
,
"UPDATE_ASC"
);
jsonObject
.
put
(
"parentId"
,
null
);
System
.
out
.
println
(
"请求"
+
jsonObject
);
xmAppApi
.
doRequest
(
RequestType
.
JSON
,
params
,
jsonObject
.
toJSONString
(),
headers
);
JSONObject
responseRes
=
xmAppApi
.
getBodyInJSON
();
System
.
out
.
println
(
"responseRes =="
+
responseRes
);
Assert
.
assertEquals
(
"true"
,
responseRes
.
getString
(
"success"
));
Assert
.
assertNotNull
(
responseRes
.
getJSONObject
(
"result"
).
getString
(
"total"
));
}
@Test
(
description
=
"公共文件列表,按更新时间降序排序"
)
public
void
testSelfFolderList4
(){
JSONObject
jsonObject
=
new
JSONObject
();
jsonObject
.
put
(
"current"
,
1
);
jsonObject
.
put
(
"disk"
,
"COMMON"
);
jsonObject
.
put
(
"folderIdType"
,
"FOLDER"
);
jsonObject
.
put
(
"instId"
,
xmAppApi
.
getLoginInfo
().
getInstId
());
jsonObject
.
put
(
"searchName"
,
null
);
jsonObject
.
put
(
"size"
,
10
);
jsonObject
.
put
(
"sort"
,
"UPDATE_DESC"
);
jsonObject
.
put
(
"parentId"
,
null
);
System
.
out
.
println
(
"请求"
+
jsonObject
);
xmAppApi
.
doRequest
(
RequestType
.
JSON
,
params
,
jsonObject
.
toJSONString
(),
headers
);
JSONObject
responseRes
=
xmAppApi
.
getBodyInJSON
();
System
.
out
.
println
(
"responseRes =="
+
responseRes
);
Assert
.
assertEquals
(
"true"
,
responseRes
.
getString
(
"success"
));
Assert
.
assertNotNull
(
responseRes
.
getJSONObject
(
"result"
).
getString
(
"total"
));
}
@Test
(
description
=
"公共文件列表,按文件大小升序排序"
)
public
void
testSelfFolderList5
(){
JSONObject
jsonObject
=
new
JSONObject
();
jsonObject
.
put
(
"current"
,
1
);
jsonObject
.
put
(
"disk"
,
"COMMON"
);
jsonObject
.
put
(
"folderIdType"
,
"FOLDER"
);
jsonObject
.
put
(
"instId"
,
xmAppApi
.
getLoginInfo
().
getInstId
());
jsonObject
.
put
(
"searchName"
,
null
);
jsonObject
.
put
(
"size"
,
10
);
jsonObject
.
put
(
"sort"
,
"SIZE_ASC"
);
jsonObject
.
put
(
"parentId"
,
null
);
System
.
out
.
println
(
"请求"
+
jsonObject
);
xmAppApi
.
doRequest
(
RequestType
.
JSON
,
params
,
jsonObject
.
toJSONString
(),
headers
);
JSONObject
responseRes
=
xmAppApi
.
getBodyInJSON
();
System
.
out
.
println
(
"responseRes =="
+
responseRes
);
Assert
.
assertEquals
(
"true"
,
responseRes
.
getString
(
"success"
));
Assert
.
assertNotNull
(
responseRes
.
getJSONObject
(
"result"
).
getString
(
"total"
));
}
@Test
(
description
=
"公共文件列表,按文件大小降序排序"
)
public
void
testSelfFolderList6
(){
JSONObject
jsonObject
=
new
JSONObject
();
jsonObject
.
put
(
"current"
,
1
);
jsonObject
.
put
(
"disk"
,
"COMMON"
);
jsonObject
.
put
(
"folderIdType"
,
"FOLDER"
);
jsonObject
.
put
(
"instId"
,
xmAppApi
.
getLoginInfo
().
getInstId
());
jsonObject
.
put
(
"searchName"
,
null
);
jsonObject
.
put
(
"size"
,
10
);
jsonObject
.
put
(
"sort"
,
"SIZE_DESC"
);
jsonObject
.
put
(
"parentId"
,
null
);
System
.
out
.
println
(
"请求"
+
jsonObject
);
xmAppApi
.
doRequest
(
RequestType
.
JSON
,
params
,
jsonObject
.
toJSONString
(),
headers
);
JSONObject
responseRes
=
xmAppApi
.
getBodyInJSON
();
System
.
out
.
println
(
"responseRes =="
+
responseRes
);
Assert
.
assertEquals
(
"true"
,
responseRes
.
getString
(
"success"
));
Assert
.
assertNotNull
(
responseRes
.
getJSONObject
(
"result"
).
getString
(
"total"
));
}
}
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