Commit c70123df by zhangying

补充大班互动7个case

parent be9b6fb5
......@@ -11,6 +11,9 @@ 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/3/12 18:08
......@@ -26,7 +29,7 @@ public class TestCreateBigInteractionCourse extends XMBaseTest {
super.beforeTest();
}
@Test
@Test(description = "创建普通大班互动课,不添加学员")
public void testCreateBigInteractionCourse() {
JSONObject largeInteractionClassLive = new JSONObject();
......@@ -58,4 +61,55 @@ public class TestCreateBigInteractionCourse extends XMBaseTest {
}
@Test(description = "创建大班互动课,同时添加扣课时学员和不扣课时学员")
public void testCreateBigInteractionCourse1() {
//组装扣课时学员数据
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 consumeStudentIds = new ArrayList();
consumeStudentIds.add(jsondata);
String studentId1 = "1358297612940660738"; //不扣课时学员
List studentIds = new ArrayList();
studentIds.add(studentId1);
JSONObject largeInteractionClassLive = new JSONObject();
largeInteractionClassLive.put("courseName", RandomStringUtil.randomNumber(14, "大班互动_"));
largeInteractionClassLive.put("teacherId","1235115979473997826");
largeInteractionClassLive.put("startTime",System.currentTimeMillis() + 60 * 1000);
largeInteractionClassLive.put("endTime",System.currentTimeMillis() + 30 * 60 * 1000);
largeInteractionClassLive.put("needRecord","YES");
largeInteractionClassLive.put("liveType","LARGE_CLASS_INTERACTION");
largeInteractionClassLive.put("consumeHourNum",1);
largeInteractionClassLive.put("consumeClassTime","1");
largeInteractionClassLive.put("podium","12");
largeInteractionClassLive.put("consumeStudentIds",consumeStudentIds);
largeInteractionClassLive.put("studentIds",studentIds);
xmAppApi.doRequest(RequestType.JSON, params, largeInteractionClassLive.toJSONString(), headers);
JSONObject jsonBody = xmAppApi.getBodyInJSON();
System.out.println("jsonBody ="+jsonBody);
String courseId =jsonBody.getString("result");
GetLiveCourseData getLiveCourseData = new GetLiveCourseData();
JSONObject getCourseData = getLiveCourseData.getInteractionClassLiveList();
System.out.println("getCourseData"+getCourseData);
String courseId1 = getCourseData.getJSONObject("result").getJSONArray("records").getJSONObject(0).getString("liveCourseId");
Assert.assertEquals("true", jsonBody.getString("success"));
Assert.assertEquals("200", jsonBody.getString("code"));
Assert.assertEquals(courseId, courseId1);
}
}
......@@ -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.GetLiveCourseData;
import org.testng.Assert;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
......@@ -28,19 +29,50 @@ public class TestGetCourseDetail extends XMBaseTest {
/**
* 大班互动直播课-课程详情
*/
@Test
@Test(description = "已添加学员的大班互动课,查看详情")
public void testGetCourseDetail() {
GetLiveCourseData getLiveCourseData = new GetLiveCourseData();
JSONObject getLargeCourseData = getLiveCourseData.getInteractionClassLiveList1("大班互动");
String liveCourseId = getLargeCourseData.getJSONObject("result").getJSONArray("records").getJSONObject(0).getString("liveCourseId");
System.out.println("liveCourseId ="+liveCourseId);
JSONObject jsonObject = new JSONObject();
jsonObject.put("liveCourseId",liveCourseId);
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.getJSONObject("result").getString("liveCourseId") );
Assert.assertEquals(liveCourseId,jsonBody.getJSONObject("result").getString("liveCourseId"));
Assert.assertEquals(2,jsonBody.getJSONObject("result").getJSONArray("liveStudentBaseVO").size());
Assert.assertEquals("true", jsonBody.getString("success"));
Assert.assertEquals("200", jsonBody.getString("code"));
}
/**
* 大班互动直播课-课程详情
*/
@Test(description = "普通的大班互动课,查看详情")
public void testGetCourseDetail1() throws InterruptedException {
GetLiveCourseData getLiveCourseData = new GetLiveCourseData();
JSONObject getLargeCourseData = getLiveCourseData.createLargeInteractionClassLive();
String liveCourseId = getLargeCourseData.getString("result");
JSONObject jsonObject = new JSONObject();
jsonObject.put("liveCourseId","1356798987214893057");
jsonObject.put("liveCourseId",liveCourseId);
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 );
System.out.println("jsonBody ="+jsonBody.getJSONObject("result").getString("liveCourseId") );
Assert.assertNotEquals(jsonBody.getJSONObject("result").getJSONArray("liveStudentBaseVO").size(), 0);
Assert.assertEquals(liveCourseId,jsonBody.getJSONObject("result").getString("liveCourseId"));
Assert.assertEquals("true", jsonBody.getString("success"));
Assert.assertEquals("200", jsonBody.getString("code"));
......
......@@ -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.GetLiveCourseData;
import org.testng.Assert;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
......@@ -49,7 +50,7 @@ public class TestGetInteractionClassLiveList extends XMBaseTest {
}
/**
* 大班直播课列表数据-详细查询
* 大班互动课列表数据-详细查询
*/
@Test
public void testGetInteractionClassLiveList1() {
......@@ -78,4 +79,30 @@ public class TestGetInteractionClassLiveList extends XMBaseTest {
}
/**
* 大班互动课列表数据-按名称查询
*/
@Test
public void testGetInteractionClassLiveList2() {
JSONObject jsonObject = new JSONObject();
jsonObject.put("instId","1235115978015883266");
jsonObject.put("current","1");
jsonObject.put("size","10");
jsonObject.put("courseName","大班互动");
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.assertNotEquals("1", jsonBody.getJSONObject("result").getJSONArray("records").size());
Assert.assertEquals("true", jsonBody.getString("success"));
Assert.assertEquals("200", jsonBody.getString("code"));
}
}
package com.live.cases.interactionLive;
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.GetLiveCourseData;
import org.testng.Assert;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
/**
* @author zhangying
* @date 2021/3/18 6:09 下午
*/
public class TestLargeInteractionDelCourse 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端等, 必传)
dal.setCase_owner("张莹");
super.beforeTest();
}
/**
* 大班互动直播课-删除上课中的课程
*/
@Test(description = "大班互动直播课-删除未成功开课的课程")
public void testGetCourseDetail() {
GetLiveCourseData getLiveCourseData = new GetLiveCourseData();
JSONObject getLargeCourseData = getLiveCourseData.getInteractionClassLiveListWithStatus("EXPIRED");
System.out.println("getLargeCourseData =="+getLargeCourseData);
String liveCourseId = getLargeCourseData.getJSONObject("result").getJSONArray("records").getJSONObject(0).getString("liveCourseId");
System.out.println("liveCourseId ="+liveCourseId);
JSONObject jsonObject = new JSONObject();
jsonObject.put("liveCourseId",liveCourseId);
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);
JSONObject getLargeCourseData1 = getLiveCourseData.getInteractionClassLiveListWithStatus("EXPIRED");
String liveCourseId1 = getLargeCourseData1.getJSONObject("result").getJSONArray("records").getJSONObject(0).getString("liveCourseId");
System.out.println("liveCourseId1 =="+liveCourseId1);
Assert.assertNotEquals(liveCourseId1, liveCourseId);
Assert.assertEquals("true", jsonBody.getString("success"));
Assert.assertEquals("200", jsonBody.getString("code"));
}
/**
* 大班互动直播课-删除已完成的课程
*/
@Test(description = "大班互动直播课-删除已完成的课程")
public void testGetCourseDetail1() {
GetLiveCourseData getLiveCourseData = new GetLiveCourseData();
JSONObject getLargeCourseData = getLiveCourseData.getInteractionClassLiveListWithStatus("FINISH");
System.out.println("getLargeCourseData =="+getLargeCourseData);
String liveCourseId = getLargeCourseData.getJSONObject("result").getJSONArray("records").getJSONObject(0).getString("liveCourseId");
System.out.println("liveCourseId ="+liveCourseId);
JSONObject jsonObject = new JSONObject();
jsonObject.put("liveCourseId",liveCourseId);
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);
JSONObject getLargeCourseData1 = getLiveCourseData.getInteractionClassLiveListWithStatus("FINISH");
String liveCourseId1 = getLargeCourseData1.getJSONObject("result").getJSONArray("records").getJSONObject(0).getString("liveCourseId");
System.out.println("liveCourseId1 =="+liveCourseId1);
Assert.assertNotEquals("直播课已扣学员课时,不支持删除", "message");
Assert.assertEquals("false", jsonBody.getString("success"));
}
/**
* 大班互动直播课-删除待上课的课程
*/
@Test(description = "大班互动直播课-删除待上课的课程")
public void testGetCourseDetail3() throws InterruptedException {
GetLiveCourseData getLiveCourseData = new GetLiveCourseData();
JSONObject createCourse = getLiveCourseData.createLargeInteractionClassLive();
JSONObject getLargeCourseData = getLiveCourseData.getInteractionClassLiveListWithStatus("UN_START");
System.out.println("getLargeCourseData =="+getLargeCourseData);
String liveCourseId = getLargeCourseData.getJSONObject("result").getJSONArray("records").getJSONObject(0).getString("liveCourseId");
System.out.println("liveCourseId ="+liveCourseId);
JSONObject jsonObject = new JSONObject();
jsonObject.put("liveCourseId",liveCourseId);
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);
JSONObject getLargeCourseData1 = getLiveCourseData.getInteractionClassLiveListWithStatus("FINISH");
String liveCourseId1 = getLargeCourseData1.getJSONObject("result").getJSONArray("records").getJSONObject(0).getString("liveCourseId");
System.out.println("liveCourseId1 =="+liveCourseId1);
Assert.assertEquals("true", jsonBody.getString("success"));
Assert.assertNotEquals(liveCourseId1, liveCourseId);
}
/**
* 大班互动直播课-删除上课中的课程
*/
@Test(description = "大班互动直播课-删除上课中的课程")
public void testGetCourseDetail4() throws InterruptedException {
GetLiveCourseData getLiveCourseData = new GetLiveCourseData();
JSONObject createCourse = getLiveCourseData.createLargeInteractionClassLive();
String courseId =createCourse.getString("result");
JSONObject getStartingCourse = getLiveCourseData.changeCourseStateToStarting(courseId);
JSONObject getLargeCourseData = getLiveCourseData.getInteractionClassLiveListWithStatus("STARTING");
System.out.println("getLargeCourseData =="+getLargeCourseData);
String liveCourseId = getLargeCourseData.getJSONObject("result").getJSONArray("records").getJSONObject(0).getString("liveCourseId");
System.out.println("liveCourseId ="+liveCourseId);
JSONObject jsonObject = new JSONObject();
jsonObject.put("liveCourseId",liveCourseId);
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);
JSONObject getLargeCourseData1 = getLiveCourseData.getInteractionClassLiveListWithStatus("STARTING");
String liveCourseId1 = getLargeCourseData1.getJSONObject("result").getJSONArray("records").getJSONObject(0).getString("liveCourseId");
System.out.println("liveCourseId1 =="+liveCourseId1);
Assert.assertEquals("false", jsonBody.getString("success"));
Assert.assertEquals("删除课程处于上课中状态", jsonBody.getString("message"));
}
}
......@@ -44,4 +44,24 @@ public class TestGetCourseDetail extends XMBaseTest {
}
/**
* 查看直播课新建的直播课详情-直播课包含学员
*/
@Test
public void testGetCourseDetail1() {
JSONObject jsonObject = new JSONObject();
jsonObject.put("liveCourseId","1356196461296828418");
xmAppApi.doRequest(RequestType.JSON, params, jsonObject.toJSONString(), headers);
System.out.println(xmAppApi);
JSONObject jsonBody = xmAppApi.getBodyInJSON();
Assert.assertNotEquals(jsonBody.getJSONObject("result").getJSONArray("liveStudentBaseVO").size(), 0);
Assert.assertEquals("true", jsonBody.getString("success"));
Assert.assertEquals("200", jsonBody.getString("code"));
}
}
......@@ -179,6 +179,52 @@ public class GetLiveCourseData extends XMBaseTest {
return liveCourseList;
}
public JSONObject getInteractionClassLiveList1(String courseName) {
dataApi.setApiModule(ApiModele.CloudClass_B) // API 所属模块 必传 读取配置文件config.properties配置的api地址
.setApiName("API_getInteractionClassLiveList") // API 名称 必传
.setLoginUser("zhangy-b") // http 接口,测试账号 必传
.setTerminal(Terminal.B); // 所属端位(B端,C端,M端等, 必传)
super.beforeDataRequest();
Map bodyMap = new HashMap();
bodyMap.put("current", 1);
bodyMap.put("instId", dataApi.getLoginInfo().getInstId());
bodyMap.put("size", 10);
bodyMap.put("courseName", courseName);
String bodydata = JSONObject.toJSONString(bodyMap);
dataApi.doRequest(RequestType.JSON, params, bodydata, dataheadrs);
JSONObject liveCourseList=dataApi.getBodyInJSON();
return liveCourseList;
}
public JSONObject getInteractionClassLiveListWithStatus(String courseState) {
dataApi.setApiModule(ApiModele.CloudClass_B) // API 所属模块 必传 读取配置文件config.properties配置的api地址
.setApiName("API_getInteractionClassLiveList") // API 名称 必传
.setLoginUser("zhangy-b") // http 接口,测试账号 必传
.setTerminal(Terminal.B); // 所属端位(B端,C端,M端等, 必传)
super.beforeDataRequest();
Map bodyMap = new HashMap();
bodyMap.put("current", 1);
bodyMap.put("instId", dataApi.getLoginInfo().getInstId());
bodyMap.put("size", 10);
bodyMap.put("courseState", courseState);
String bodydata = JSONObject.toJSONString(bodyMap);
dataApi.doRequest(RequestType.JSON, params, bodydata, dataheadrs);
JSONObject liveCourseList=dataApi.getBodyInJSON();
return liveCourseList;
}
public JSONObject createLargeInteractionClassLive() throws InterruptedException {
dataApi.setApiModule(ApiModele.CloudClass_B)
......@@ -195,7 +241,7 @@ public class GetLiveCourseData extends XMBaseTest {
return liveCourse;
}
//组装大班直播新增的数据
//组装大班互动课新增的数据
public JSONObject buildCreateLargeInteractionClassLiveParam() {
JSONObject largeInteractionClassLive = new JSONObject();
largeInteractionClassLive.put("courseName", RandomStringUtil.randomNumber(14, "course_"));
......
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