Commit 45dbb6e8 by zhangying

补充大班互动的case

parent c6dcb107
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;
import java.util.ArrayList;
import java.util.List;
/**
* @author zhangying
* @date 2021/3/10 7:38 下午
*/
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端等, 必传)
dal.setCase_owner("zhangying");
super.beforeTest();
}
/**
* 测试大班互动直播课-添加学员"不扣课时学员(自动化测试)"
*/
@Test(description = "测试大班互动直播课-添加学员\"不扣课时学员(自动化测试)")
public void testAddCourseStu() throws InterruptedException {
GetLiveCourseData getLiveCourseData = new GetLiveCourseData();
JSONObject getLargeCourseData = getLiveCourseData.createLargeInteractionClassLive();
String liveCourseId = getLargeCourseData.getString("result");
System.out.println("liveCourseId ="+liveCourseId);
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 getLargeCourseData1 = getLiveCourseData.getInteractionClassLiveList();
System.out.println("getLargeCourseData1 =="+getLargeCourseData1);
String studentId1 = getLargeCourseData1.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(description = "测试大班互动直播课-添加学员-扣课时学员(自动化测试)")
public void testAddCourseStu1() throws InterruptedException {
GetLiveCourseData getLiveCourseData = new GetLiveCourseData();
JSONObject getLargeCourseData = getLiveCourseData.createLargeInteractionClassLive();
String liveCourseId = getLargeCourseData.getString("result");
System.out.println("liveCourseId ="+liveCourseId);
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 getLargeCourseData1 = getLiveCourseData.getInteractionClassLiveList();
String studentId1 = getLargeCourseData1.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);
}
}
......@@ -30,7 +30,7 @@ public class TestAddCourseStu extends XMBaseTest {
}
/**
* 测试乐器陪练课-添加学员"不扣课时学员(自动化测试)"
* 测试大班直播课-添加学员"不扣课时学员(自动化测试)"
*/
@Test
......@@ -65,7 +65,7 @@ public class TestAddCourseStu extends XMBaseTest {
}
/**
* 测试乐器陪练课-添加学员"扣课时学员(自动化测试)"
* 测试大班直播课-添加学员"扣课时学员(自动化测试)"
*/
@Test
......
......@@ -26,7 +26,7 @@ public class GetLiveCourseData extends XMBaseTest {
Map bodyMap = new HashMap();
bodyMap.put("current", 1);
bodyMap.put("instId", "1235115978015883266");
bodyMap.put("instId", dataApi.getLoginInfo().getInstId());
bodyMap.put("size", 10);
String bodydata = JSONObject.toJSONString(bodyMap);
......@@ -156,5 +156,59 @@ public class GetLiveCourseData extends XMBaseTest {
return largeClassLive;
}
public JSONObject getInteractionClassLiveList() {
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);
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)
.setApiName("API_createCourse")
.setLoginUser("zhangy-b")
.setTerminal(com.live.enums.Terminal.B);
super.beforeDataRequest();
dataApi.doRequest(RequestType.JSON, params, buildCreateLargeInteractionClassLiveParam().toJSONString(), dataheadrs);
TimeUnit.SECONDS.sleep(3);
JSONObject liveCourse=dataApi.getBodyInJSON();
return liveCourse;
}
//组装大班直播新增的数据
public JSONObject buildCreateLargeInteractionClassLiveParam() {
JSONObject largeInteractionClassLive = new JSONObject();
largeInteractionClassLive.put("courseName", RandomStringUtil.randomNumber(14, "live_course_"));
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");
return largeInteractionClassLive;
}
}
......@@ -13,6 +13,13 @@
"apiName": "新增直播课信息",
"desc": "新增直播课信息"
},
"API_createCourse":
{
"apiPath": "/apollo/public/businessLive/createCourse",
"apiContentType": "application/json;charset=utf-8",
"apiName": "新增直播课信息",
"desc": "新增直播课信息"
},
"API_updateCourse":
{
"apiPath": "/apollo/public/businessLive/updateCourse",
......
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