Commit fff6111d by fanyuanmeng

Merge remote-tracking branch 'origin/master'

parents 89d58ccb 566234c6
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);
}
}
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;
......
......@@ -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() + 30 * 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);
......
......@@ -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
......@@ -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
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