Commit dc710dd4 by zhangying

补充case和优化代码

parent 0f454559
......@@ -31,7 +31,7 @@ public class TestChangeCourseState extends XMBaseTest {
* 测试改变直播课次状态
*/
@Test
public void testChangeCourseState() {
public void testChangeCourseState() throws InterruptedException {
GetLiveCourseData getLiveCourseData=new GetLiveCourseData();
JSONObject largeCourse=getLiveCourseData.createLargeClassLive();
......
......@@ -31,7 +31,7 @@ public class TestInitXmLive extends XMBaseTest {
* 测试初始化直播间信息
*/
@Test
public void testInitXmLive() {
public void testInitXmLive() throws InterruptedException {
GetLiveCourseData getLiveCourseData=new GetLiveCourseData();
JSONObject largeClassCourse=getLiveCourseData.getLargeClassLiveList();
......
......@@ -30,7 +30,7 @@ public class TestQueryStudentByCourseId extends XMBaseTest {
* 测试通过课次id查询直播学员API
*/
@Test
public void testQueryStudentByCourseId() {
public void testQueryStudentByCourseId() throws InterruptedException {
GetLiveCourseData getLiveCourseData=new GetLiveCourseData();
JSONObject largeClassCourse=getLiveCourseData.getLargeClassLiveList();
......
......@@ -85,7 +85,7 @@ public class TestLargeClassDelCourse extends XMBaseTest {
* 大班直播课-删除课程(待上课)
*/
@Test
public void testLargeClassDelCourse2() {
public void testLargeClassDelCourse2() throws InterruptedException {
GetLiveCourseData getLiveCourseData = new GetLiveCourseData();
JSONObject getLargeCourseData = getLiveCourseData.createLargeClassLive();
String liveCourseId = getLargeCourseData.getString("result");
......@@ -113,12 +113,16 @@ public class TestLargeClassDelCourse extends XMBaseTest {
* 大班直播课-删除课程(上课中)
*/
@Test
public void testLargeClassDelCourse3() {
public void testLargeClassDelCourse3() throws InterruptedException {
GetLiveCourseData getLiveCourseData = new GetLiveCourseData();
JSONObject getLargeCourseData = getLiveCourseData.getLargeClassLiveListStarting();
String liveCourseId = getLargeCourseData.getJSONObject("result").getJSONArray("records").getJSONObject(0).getString("liveCourseId");
JSONObject getLargeCourseData = getLiveCourseData.createLargeClassLive();
String liveCourseId = getLargeCourseData.getString("result");
System.out.println("liveCourseId =="+liveCourseId);
JSONObject getStartingCourse = getLiveCourseData.changeCourseStateToStarting(liveCourseId);
System.out.println("getStartingCourse =="+getStartingCourse);
JSONObject jsonObject = new JSONObject();
jsonObject.put("liveCourseId",liveCourseId);
......
package com.live.xmutils;
import com.alibaba.fastjson.JSONObject;
import com.live.client.XMAppApi;
import com.live.enums.ApiModele;
import com.live.enums.RequestType;
import com.live.enums.Terminal;
......@@ -9,6 +10,7 @@ import com.live.utils.XMBaseTest;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.TimeUnit;
public class GetLiveCourseData extends XMBaseTest {
......@@ -104,7 +106,27 @@ public class GetLiveCourseData extends XMBaseTest {
return liveCourseList;
}
public JSONObject createLargeClassLive() {
public JSONObject changeCourseStateToStarting(String liveCourseId) {
dataApi.setApiModule(ApiModele.CloudClass_apollo) // API 所属模块 必传 读取配置文件config.properties配置的api地址
.setApiName("api_changeCourseState") // API 名称 必传
.setLoginUser("zhangy-b") // http 接口,测试账号 必传
.setTerminal(Terminal.B); // 所属端位(B端,C端,M端等, 必传)
super.beforeDataRequest();
JSONObject jsonObject = new JSONObject();
jsonObject.put("liveCourseId",liveCourseId);
jsonObject.put("courseState","STARTING");
dataApi.doRequest(RequestType.JSON, params, jsonObject.toJSONString(), dataheadrs);
System.out.println(dataApi);
JSONObject liveCourseList=dataApi.getBodyInJSON();
return liveCourseList;
}
public JSONObject createLargeClassLive() throws InterruptedException {
dataApi.setApiModule(ApiModele.CloudClass_B)
.setApiName("API_createLargeClassLive")
.setLoginUser("zhangy-b")
......@@ -113,6 +135,7 @@ public class GetLiveCourseData extends XMBaseTest {
dataApi.doRequest(RequestType.JSON, params, buildCreateLargeClassLiveParam().toJSONString(), dataheadrs);
TimeUnit.SECONDS.sleep(3);
JSONObject liveCourse=dataApi.getBodyInJSON();
return liveCourse;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment