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
fff6111d
Commit
fff6111d
authored
Feb 07, 2021
by
fanyuanmeng
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master'
parents
89d58ccb
566234c6
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
121 additions
and
4 deletions
+121
-4
src/main/java/com/live/cases/musicPlay/TestAddCourseStu.java
+105
-0
src/main/java/com/live/cases/musicPlay/TestDelOnlyOneClassLive.java
+0
-1
src/main/java/com/live/xmutils/GetOnlyOneCourseData.java
+3
-3
src/main/resources/apicase/apollo.json
+7
-0
testng.xml
+6
-0
No files found.
src/main/java/com/live/cases/musicPlay/TestAddCourseStu.java
0 → 100644
View file @
fff6111d
package
com
.
live
.
cases
.
musicPlay
;
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
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
* @author zhangying
* @date 2021/2/7 4:55 下午
*/
public
class
TestAddCourseStu
extends
XMBaseTest
{
@BeforeMethod
public
void
beforeTest
()
{
xmAppApi
.
setApiModule
(
ApiModele
.
CloudClass_apollo
)
// API 所属模块 必传 读取配置文件config.properties配置的api地址
.
setApiName
(
"API_addCourseStu"
)
// API 名称 必传
.
setLoginUser
(
"zhangy-b"
)
// http 接口,测试账号 必传
.
setTerminal
(
Terminal
.
B
);
// 所属端位(B端,C端,M端等, 必传)
super
.
beforeTest
();
System
.
out
.
println
(
xmAppApi
);
}
/**
* 测试乐器陪练课-添加学员"不扣课时学员(自动化测试)"
*/
@Test
public
void
testAddCourseStu
()
{
GetOnlyOneCourseData
onlyOneCourseData
=
new
GetOnlyOneCourseData
();
JSONObject
onlyOneClassCourse
=
onlyOneCourseData
.
creatOnlyOneCourse
();
String
liveCourseId
=
onlyOneClassCourse
.
getString
(
"result"
);
String
studentId
=
"1358297612940660738"
;
List
studentIds
=
new
ArrayList
();
studentIds
.
add
(
studentId
);
JSONObject
jsonObject
=
new
JSONObject
();
jsonObject
.
put
(
"liveCourseId"
,
liveCourseId
);
jsonObject
.
put
(
"studentIds"
,
studentIds
);
xmAppApi
.
doRequest
(
RequestType
.
JSON
,
params
,
jsonObject
.
toJSONString
(),
headers
);
JSONObject
jsonBody
=
xmAppApi
.
getBodyInJSON
();
System
.
out
.
println
(
"jsonBody ="
+
jsonBody
);
JSONObject
onlyOneCourseList
=
onlyOneCourseData
.
getOnlyOneCourseList
();
String
studentId1
=
onlyOneCourseList
.
getJSONObject
(
"result"
).
getJSONArray
(
"records"
).
getJSONObject
(
0
).
getJSONArray
(
"liveStudentBaseVO"
).
getJSONObject
(
0
).
getString
(
"studentId"
);
Assert
.
assertEquals
(
"true"
,
jsonBody
.
getString
(
"success"
));
Assert
.
assertEquals
(
"操作成功!"
,
jsonBody
.
getString
(
"message"
));
Assert
.
assertEquals
(
studentId
,
studentId1
);
}
/**
* 测试乐器陪练课-添加学员"扣课时学员(自动化测试)"
*/
@Test
public
void
testAddCourseStu1
()
{
GetOnlyOneCourseData
onlyOneCourseData
=
new
GetOnlyOneCourseData
();
JSONObject
onlyOneClassCourse
=
onlyOneCourseData
.
creatOnlyOneCourse
();
String
liveCourseId
=
onlyOneClassCourse
.
getString
(
"result"
);
String
studentId
=
"1358346398485405697"
;
JSONObject
jsondata
=
new
JSONObject
();
jsondata
.
put
(
"name"
,
"扣课时学员(自动化测试)"
);
jsondata
.
put
(
"phone"
,
"12300000003"
);
jsondata
.
put
(
"studentId"
,
studentId
);
jsondata
.
put
(
"classHourId"
,
"1235120275888328705"
);
jsondata
.
put
(
"consumeHourNum"
,
"100"
);
List
studentIds
=
new
ArrayList
();
studentIds
.
add
(
jsondata
);
JSONObject
jsonObject
=
new
JSONObject
();
jsonObject
.
put
(
"liveCourseId"
,
liveCourseId
);
jsonObject
.
put
(
"consumeStudentIds"
,
studentIds
);
xmAppApi
.
doRequest
(
RequestType
.
JSON
,
params
,
jsonObject
.
toJSONString
(),
headers
);
JSONObject
jsonBody
=
xmAppApi
.
getBodyInJSON
();
System
.
out
.
println
(
"jsonBody ="
+
jsonBody
);
JSONObject
onlyOneCourseList
=
onlyOneCourseData
.
getOnlyOneCourseList
();
String
studentId1
=
onlyOneCourseList
.
getJSONObject
(
"result"
).
getJSONArray
(
"records"
).
getJSONObject
(
0
).
getJSONArray
(
"liveStudentBaseVO"
).
getJSONObject
(
0
).
getString
(
"studentId"
);
// System.out.println("onlyOneCourseList = "+onlyOneCourseList);
Assert
.
assertEquals
(
"true"
,
jsonBody
.
getString
(
"success"
));
Assert
.
assertEquals
(
"操作成功!"
,
jsonBody
.
getString
(
"message"
));
Assert
.
assertEquals
(
studentId
,
studentId1
);
}
}
src/main/java/com/live/cases/musicPlay/TestDelOnlyOneClassLive.java
View file @
fff6111d
package
com
.
live
.
cases
.
musicPlay
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.live.enums.ApiModele
;
import
com.live.enums.RequestType
;
...
...
src/main/java/com/live/xmutils/GetOnlyOneCourseData.java
View file @
fff6111d
...
...
@@ -26,7 +26,7 @@ public class GetOnlyOneCourseData extends XMBaseTest {
bodyMap
.
put
(
"current"
,
1
);
bodyMap
.
put
(
"instId"
,
"1235115978015883266"
);
bodyMap
.
put
(
"size"
,
10
);
bodyMap
.
put
(
"courseState"
,
"EXPIRED"
);
//
bodyMap.put("courseState","EXPIRED");
String
bodydata
=
JSONObject
.
toJSONString
(
bodyMap
);
dataApi
.
doRequest
(
RequestType
.
JSON
,
params
,
bodydata
,
dataheadrs
);
...
...
@@ -53,10 +53,10 @@ public class GetOnlyOneCourseData extends XMBaseTest {
//组装乐器陪练直播新增的数据
public
JSONObject
buildCreateLargeClassLiveParam
()
{
JSONObject
onlyOneClassLive
=
new
JSONObject
();
onlyOneClassLive
.
put
(
"courseName"
,
RandomStringUtil
.
randomNumber
(
14
,
"
onlyOne_
course_"
));
onlyOneClassLive
.
put
(
"courseName"
,
RandomStringUtil
.
randomNumber
(
14
,
"course_"
));
onlyOneClassLive
.
put
(
"teacherId"
,
xmAppApi
.
getLoginInfo
().
getTid
());
onlyOneClassLive
.
put
(
"startTime"
,
System
.
currentTimeMillis
()
+
60
*
1000
);
onlyOneClassLive
.
put
(
"endTime"
,
System
.
currentTimeMillis
()
+
3
0
*
60
*
1000
);
onlyOneClassLive
.
put
(
"endTime"
,
System
.
currentTimeMillis
()
+
6
0
*
60
*
1000
);
onlyOneClassLive
.
put
(
"needRecord"
,
"YES"
);
onlyOneClassLive
.
put
(
"liveType"
,
"SMALL_CLASS_ONLY_ONE"
);
onlyOneClassLive
.
put
(
"consumeHourNum"
,
1
);
...
...
src/main/resources/apicase/apollo.json
View file @
fff6111d
...
...
@@ -178,5 +178,11 @@
"apiContentType"
:
"application/json;charset=utf-8"
,
"apiName"
:
"移动文件"
,
"desc"
:
"移动文件"
},
"API_addCourseStu"
:
{
"apiPath"
:
"/apollo/public/businessLive/addCourseStu"
,
"apiContentType"
:
"application/json;charset=utf-8"
,
"apiName"
:
"课次添加学员"
,
"desc"
:
"课次添加学员"
}
}
\ No newline at end of file
testng.xml
View file @
fff6111d
...
...
@@ -52,4 +52,9 @@
<package
name=
"com.live.cases.musicPlay"
></package>
</packages>
</test>
<test
name=
"videoClass"
preserve-order=
"true"
verbose=
"3"
>
<packages>
<package
name=
"com.live.cases.videoClass"
></package>
</packages>
</test>
</suite>
\ 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