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
a5ebc163
Commit
a5ebc163
authored
Jan 30, 2021
by
zhangying
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
创建和删除乐器陪练课
parent
7166251a
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
262 additions
and
2 deletions
+262
-2
src/main/java/com/live/cases/apollo/TestCreateOnlyOneClassLive.java
+66
-0
src/main/java/com/live/cases/apollo/TestDelOnlyOneClassLive.java
+71
-0
src/main/java/com/live/xmutils/GetOnlyOneClassLiveListData.java
+41
-0
src/main/java/com/live/xmutils/GetOnlyOneCourseData.java
+72
-0
src/main/resources/apicase/apollo.json
+12
-2
No files found.
src/main/java/com/live/cases/apollo/TestCreateOnlyOneClassLive.java
0 → 100644
View file @
a5ebc163
package
com
.
live
.
cases
.
apollo
;
import
com.alibaba.fastjson.JSONObject
;
import
com.live.enums.ApiModele
;
import
com.live.enums.RequestType
;
import
com.live.enums.Terminal
;
import
com.live.utils.RandomStringUtil
;
import
com.live.utils.XMBaseTest
;
import
com.live.xmutils.GetOnlyOneClassLiveListData
;
import
org.testng.Assert
;
import
org.testng.annotations.BeforeMethod
;
import
org.testng.annotations.Test
;
/**
* Created by zhangying on 2021/1/30
*/
public
class
TestCreateOnlyOneClassLive
extends
XMBaseTest
{
@BeforeMethod
public
void
beforeTest
()
{
xmAppApi
.
setApiModule
(
ApiModele
.
CloudClass_apollo
)
// API 所属模块 必传 读取配置文件config.properties配置的api地址
.
setApiName
(
"API_createCourse"
)
// API 名称 必传
.
setLoginUser
(
"zhangy-b"
)
// http 接口,测试账号 必传
.
setTerminal
(
Terminal
.
B
);
// 所属端位(B端,C端,M端等, 必传)
super
.
beforeTest
();
System
.
out
.
println
(
xmAppApi
);
}
/**
* 测试创建乐器陪练课
*/
@Test
public
void
testGetOnlyOneClassLiveList
()
{
JSONObject
onlyOneClassLive
=
new
JSONObject
();
String
courseName
=
RandomStringUtil
.
randomNumber
(
14
,
"live_course_"
);
onlyOneClassLive
.
put
(
"courseName"
,
courseName
);
onlyOneClassLive
.
put
(
"teacherId"
,
xmAppApi
.
getLoginInfo
().
getTid
());
onlyOneClassLive
.
put
(
"startTime"
,
System
.
currentTimeMillis
()
+
60
*
1000
);
onlyOneClassLive
.
put
(
"endTime"
,
System
.
currentTimeMillis
()
+
60
*
60
*
1000
);
onlyOneClassLive
.
put
(
"needRecord"
,
"YES"
);
onlyOneClassLive
.
put
(
"liveType"
,
"SMALL_CLASS_ONLY_ONE"
);
onlyOneClassLive
.
put
(
"consumeHourNum"
,
1
);
onlyOneClassLive
.
put
(
"consumeClassTime"
,
"1"
);
onlyOneClassLive
.
put
(
"autoSendReport"
,
"AUTO"
);
onlyOneClassLive
.
put
(
"consumeClassTime"
,
"30"
);
onlyOneClassLive
.
put
(
"consumeClassTime"
,
"30"
);
onlyOneClassLive
.
put
(
"whetherRecord"
,
"YES"
);
xmAppApi
.
doRequest
(
RequestType
.
JSON
,
params
,
onlyOneClassLive
.
toJSONString
(),
headers
);
System
.
out
.
println
(
xmAppApi
);
JSONObject
jsonBody
=
xmAppApi
.
getBodyInJSON
();
GetOnlyOneClassLiveListData
getOnlyOneClassLiveListData
=
new
GetOnlyOneClassLiveListData
();
JSONObject
liveList
=
getOnlyOneClassLiveListData
.
getOnlyOneClassLiveList
()
;
JSONObject
liveCourse
=
liveList
.
getJSONObject
(
"result"
).
getJSONArray
(
"records"
).
getJSONObject
(
0
);
String
courseName1
=
(
String
)
liveCourse
.
get
(
"courseName"
);
System
.
out
.
println
(
"courseName ="
+
courseName
);
Assert
.
assertEquals
(
"true"
,
jsonBody
.
getString
(
"success"
));
Assert
.
assertEquals
(
"操作成功!"
,
jsonBody
.
getString
(
"message"
));
Assert
.
assertEquals
(
courseName
,
courseName1
);
}
}
src/main/java/com/live/cases/apollo/TestDelOnlyOneClassLive.java
0 → 100644
View file @
a5ebc163
package
com
.
live
.
cases
.
apollo
;
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.GetOnlyOneClassLiveListData
;
import
com.live.xmutils.GetOnlyOneCourseData
;
import
org.testng.Assert
;
import
org.testng.annotations.BeforeMethod
;
import
org.testng.annotations.Test
;
/**
* Created by zhangying on 2021/1/30
*/
public
class
TestDelOnlyOneClassLive
extends
XMBaseTest
{
@BeforeMethod
public
void
beforeTest
()
{
xmAppApi
.
setApiModule
(
ApiModele
.
CloudClass_apollo
)
// API 所属模块 必传 读取配置文件config.properties配置的api地址
.
setApiName
(
"API_delCourse"
)
// API 名称 必传
.
setLoginUser
(
"zhangy-b"
)
// http 接口,测试账号 必传
.
setTerminal
(
Terminal
.
B
);
// 所属端位(B端,C端,M端等, 必传)
super
.
beforeTest
();
System
.
out
.
println
(
xmAppApi
);
}
/**
* 测试删除乐器陪练课
*/
@Test
public
void
testDelOnlyOneClassLive
()
{
GetOnlyOneCourseData
getOnlyOneCourseData
=
new
GetOnlyOneCourseData
();
JSONObject
onlyOneClassCourse
=
getOnlyOneCourseData
.
getOnlyOneCourseList
();
JSONObject
liveCourse
=
onlyOneClassCourse
.
getJSONObject
(
"result"
).
getJSONArray
(
"records"
).
getJSONObject
(
0
);
String
liveCourseId
=
(
String
)
liveCourse
.
get
(
"liveCourseId"
);
if
(
liveCourseId
==
null
){
onlyOneClassCourse
=
getOnlyOneCourseData
.
creatOnlyOneCourse
();
liveCourseId
=
(
String
)
onlyOneClassCourse
.
get
(
"liveCourseId"
);
}
System
.
out
.
println
(
"liveCourseId ="
+
liveCourseId
);
GetOnlyOneClassLiveListData
getOnlyOneClassLiveListData
=
new
GetOnlyOneClassLiveListData
();
JSONObject
liveList
=
getOnlyOneClassLiveListData
.
getOnlyOneClassLiveList
()
;
JSONObject
liveCourseData
=
liveList
.
getJSONObject
(
"result"
).
getJSONArray
(
"records"
).
getJSONObject
(
0
);
String
courseName
=
(
String
)
liveCourseData
.
get
(
"courseName"
);
System
.
out
.
println
(
"courseName ="
+
courseName
);
JSONObject
jsonObject
=
new
JSONObject
();
jsonObject
.
put
(
"liveCourseId"
,
liveCourseId
);
xmAppApi
.
doRequest
(
RequestType
.
JSON
,
params
,
jsonObject
.
toJSONString
(),
headers
);
JSONObject
jsonBody
=
xmAppApi
.
getBodyInJSON
();
JSONObject
liveList1
=
getOnlyOneClassLiveListData
.
getOnlyOneClassLiveList
()
;
JSONObject
liveCourseData1
=
liveList1
.
getJSONObject
(
"result"
).
getJSONArray
(
"records"
).
getJSONObject
(
0
);
String
courseName1
=
(
String
)
liveCourseData1
.
get
(
"courseName"
);
System
.
out
.
println
(
"courseName ="
+
courseName
);
Assert
.
assertEquals
(
"true"
,
jsonBody
.
getString
(
"success"
));
Assert
.
assertEquals
(
"操作成功!"
,
jsonBody
.
getString
(
"message"
));
Assert
.
assertNotEquals
(
courseName
,
courseName1
);
}
}
src/main/java/com/live/xmutils/GetOnlyOneClassLiveListData.java
0 → 100644
View file @
a5ebc163
package
com
.
live
.
xmutils
;
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
;
/**
* Created by zhangying on 2021/1/28
*/
public
class
GetOnlyOneClassLiveListData
extends
XMBaseTest
{
/**
* 测试乐器陪练课列表
*/
public
JSONObject
getOnlyOneClassLiveList
()
{
dataApi
.
setApiModule
(
ApiModele
.
CloudClass_apollo
)
// API 所属模块 必传 读取配置文件config.properties配置的api地址
.
setApiName
(
"API_getOnlyOneClassLiveList"
)
// API 名称 必传
.
setLoginUser
(
"zhangy-b"
)
// http 接口,测试账号 必传
.
setTerminal
(
Terminal
.
B
);
// 所属端位(B端,C端,M端等, 必传)
super
.
beforeDataRequest
();
JSONObject
jsonObject
=
new
JSONObject
();
jsonObject
.
put
(
"instId"
,
"1235115978015883266"
);
jsonObject
.
put
(
"current"
,
"1"
);
jsonObject
.
put
(
"size"
,
"10"
);
dataApi
.
doRequest
(
RequestType
.
JSON
,
params
,
jsonObject
.
toJSONString
(),
headers
);
System
.
out
.
println
(
dataApi
);
JSONObject
jsonBody
=
dataApi
.
getBodyInJSON
();
return
jsonBody
;
}
}
src/main/java/com/live/xmutils/GetOnlyOneCourseData.java
0 → 100644
View file @
a5ebc163
package
com
.
live
.
xmutils
;
import
com.alibaba.fastjson.JSONObject
;
import
com.live.enums.ApiModele
;
import
com.live.enums.RequestType
;
import
com.live.enums.Terminal
;
import
com.live.utils.RandomStringUtil
;
import
com.live.utils.XMBaseTest
;
import
java.util.HashMap
;
import
java.util.Map
;
public
class
GetOnlyOneCourseData
extends
XMBaseTest
{
public
JSONObject
getOnlyOneCourseList
()
{
dataApi
.
setApiModule
(
ApiModele
.
CloudClass_apollo
)
// API 所属模块 必传 读取配置文件config.properties配置的api地址
.
setApiName
(
"API_getOnlyOneClassLiveList"
)
// API 名称 必传
.
setLoginUser
(
"zhangy-b"
)
// http 接口,测试账号 必传
.
setTerminal
(
Terminal
.
B
);
// 所属端位(B端,C端,M端等, 必传)
super
.
beforeDataRequest
();
Map
bodyMap
=
new
HashMap
();
bodyMap
.
put
(
"current"
,
1
);
bodyMap
.
put
(
"instId"
,
"1235115978015883266"
);
bodyMap
.
put
(
"size"
,
10
);
String
bodydata
=
JSONObject
.
toJSONString
(
bodyMap
);
dataApi
.
doRequest
(
RequestType
.
JSON
,
params
,
bodydata
,
dataheadrs
);
JSONObject
liveCourseList
=
dataApi
.
getBodyInJSON
();
return
liveCourseList
;
}
public
JSONObject
creatOnlyOneCourse
()
{
dataApi
.
setApiModule
(
ApiModele
.
CloudClass_apollo
)
.
setApiName
(
"API_createCourse"
)
.
setLoginUser
(
"zhangy-b"
)
.
setTerminal
(
Terminal
.
B
);
super
.
beforeDataRequest
();
dataApi
.
doRequest
(
RequestType
.
JSON
,
params
,
buildCreateLargeClassLiveParam
().
toJSONString
(),
dataheadrs
);
JSONObject
liveCourse
=
dataApi
.
getBodyInJSON
();
return
liveCourse
;
}
//组装乐器陪练直播新增的数据
public
JSONObject
buildCreateLargeClassLiveParam
()
{
JSONObject
onlyOneClassLive
=
new
JSONObject
();
onlyOneClassLive
.
put
(
"courseName"
,
RandomStringUtil
.
randomNumber
(
14
,
"onlyOne_course_"
));
onlyOneClassLive
.
put
(
"teacherId"
,
xmAppApi
.
getLoginInfo
().
getTid
());
onlyOneClassLive
.
put
(
"startTime"
,
System
.
currentTimeMillis
()
+
60
*
1000
);
onlyOneClassLive
.
put
(
"endTime"
,
System
.
currentTimeMillis
()
+
30
*
60
*
1000
);
onlyOneClassLive
.
put
(
"needRecord"
,
"YES"
);
onlyOneClassLive
.
put
(
"liveType"
,
"SMALL_CLASS_ONLY_ONE"
);
onlyOneClassLive
.
put
(
"consumeHourNum"
,
1
);
onlyOneClassLive
.
put
(
"consumeClassTime"
,
"1"
);
onlyOneClassLive
.
put
(
"autoSendReport"
,
"AUTO"
);
onlyOneClassLive
.
put
(
"consumeClassTime"
,
"30"
);
onlyOneClassLive
.
put
(
"consumeClassTime"
,
"30"
);
onlyOneClassLive
.
put
(
"whetherRecord"
,
"YES"
);
return
onlyOneClassLive
;
}
}
src/main/resources/apicase/apollo.json
View file @
a5ebc163
...
...
@@ -91,6 +91,17 @@
"apiContentType"
:
"application/json;charset=utf-8"
,
"apiName"
:
"查询乐器陪练课列表"
,
"desc"
:
"查询乐器陪练课列表"
},
"API_createCourse"
:
{
"apiPath"
:
"/apollo/public/businessLive/createCourse"
,
"apiContentType"
:
"application/json;charset=utf-8"
,
"apiName"
:
"创建直播课"
,
"desc"
:
"创建直播课"
},
"API_delCourse"
:
{
"apiPath"
:
"/apollo/public/businessLive/delCourse"
,
"apiContentType"
:
"application/json;charset=utf-8"
,
"apiName"
:
"删除直播课"
,
"desc"
:
"删除直播课"
}
}
\ No newline at end of file
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