Commit 23a17183 by DuJunLi

优化代码

parent 930c0c82
...@@ -85,7 +85,8 @@ public class TestBatchSendCouponToMember extends SelectTargetTrainingCampAndGetI ...@@ -85,7 +85,8 @@ public class TestBatchSendCouponToMember extends SelectTargetTrainingCampAndGetI
body.put("brandId", xmAppApi.getLoginInfo().getBrandId()); body.put("brandId", xmAppApi.getLoginInfo().getBrandId());
body.put("couponId", couponId); body.put("couponId", couponId);
body.put("receiverIds", receiverIds); body.put("receiverIds", receiverIds);
xmAppApi.doRequest(RequestType.JSON, params, body.toString(), headers).assetsSuccess(true); xmAppApi.doRequest(RequestType.JSON, params, body.toString(), headers);
Assert.assertTrue(Boolean.valueOf(XMJSONPath.readPath(xmAppApi.getApi_response(),"$.success"))==true,"调用接口返回结果:"+XMJSONPath.readPath(xmAppApi.getApi_response(),"$.message"));
String taskId = XMJSONPath.readPath(xmAppApi.getApi_response(), "$.result"); String taskId = XMJSONPath.readPath(xmAppApi.getApi_response(), "$.result");
//check任务中心生成一条任务 //check任务中心生成一条任务
......
...@@ -10,6 +10,7 @@ import com.xiaomai.utils.CommUtil; ...@@ -10,6 +10,7 @@ import com.xiaomai.utils.CommUtil;
import com.xiaomai.utils.XMBaseTest; import com.xiaomai.utils.XMBaseTest;
import com.xiaomai.utils.XMJSONPath; import com.xiaomai.utils.XMJSONPath;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.testng.Assert;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
...@@ -74,7 +75,9 @@ public class CampScheduleTools extends XMBaseTest { ...@@ -74,7 +75,9 @@ public class CampScheduleTools extends XMBaseTest {
body.put("assistCoachIds", assistCoachIds); //设置助教,可设置为空 new ArrayList<>(); body.put("assistCoachIds", assistCoachIds); //设置助教,可设置为空 new ArrayList<>();
body.put("force", force); //是否有冲突 true,false body.put("force", force); //是否有冲突 true,false
body.put("enableCustomerReserve", "NO"); //能否用户自己约课,不能 body.put("enableCustomerReserve", "NO"); //能否用户自己约课,不能
dataApi.doRequest(RequestType.JSON, dataparams, body.toString(), dataheadrs).assetsSuccess(true); dataApi.doRequest(RequestType.JSON, dataparams, body.toString(), dataheadrs);
Assert.assertTrue(Boolean.valueOf(XMJSONPath.readPath(dataApi.getApi_response(),"$.success"))==true,"调用接口返回结果:"+XMJSONPath.readPath(dataApi.getApi_response(),"$.message"));
} }
/** /**
...@@ -115,7 +118,9 @@ public class CampScheduleTools extends XMBaseTest { ...@@ -115,7 +118,9 @@ public class CampScheduleTools extends XMBaseTest {
body.put("assistCoachIds", new ArrayList<>()); //设置助教,可设置为空 new ArrayList<>(); body.put("assistCoachIds", new ArrayList<>()); //设置助教,可设置为空 new ArrayList<>();
body.put("force", force); //是否有冲突 true,false body.put("force", force); //是否有冲突 true,false
body.put("enableCustomerReserve", "NO"); //能否用户自己约课,不能 body.put("enableCustomerReserve", "NO"); //能否用户自己约课,不能
dataApi.doRequest(RequestType.JSON, dataparams, body.toString(), dataheadrs).assetsSuccess(true); dataApi.doRequest(RequestType.JSON, dataparams, body.toString(), dataheadrs);
Assert.assertTrue(Boolean.valueOf(XMJSONPath.readPath(dataApi.getApi_response(),"$.success"))==true,"调用接口返回结果:"+XMJSONPath.readPath(dataApi.getApi_response(),"$.message"));
} }
...@@ -146,7 +151,9 @@ public class CampScheduleTools extends XMBaseTest { ...@@ -146,7 +151,9 @@ public class CampScheduleTools extends XMBaseTest {
body.put("coachId", coachId); body.put("coachId", coachId);
}*/ }*/
dataApi.doRequest(RequestType.JSON, dataparams, body.toString(), dataheadrs).assetsSuccess(true); dataApi.doRequest(RequestType.JSON, dataparams, body.toString(), dataheadrs);
Assert.assertTrue(Boolean.valueOf(XMJSONPath.readPath(dataApi.getApi_response(),"$.success"))==true,"调用接口返回结果:"+XMJSONPath.readPath(dataApi.getApi_response(),"$.message"));
} }
...@@ -162,7 +169,9 @@ public class CampScheduleTools extends XMBaseTest { ...@@ -162,7 +169,9 @@ public class CampScheduleTools extends XMBaseTest {
body.put("brandId", dataApi.getLoginInfo().getBrandId()); body.put("brandId", dataApi.getLoginInfo().getBrandId());
body.put("force", true);//删除学员约课记录 body.put("force", true);//删除学员约课记录
body.put("ruleId", ruleId); body.put("ruleId", ruleId);
dataApi.doRequest(RequestType.JSON, dataparams, body.toString(), dataheadrs).assetsSuccess(true); dataApi.doRequest(RequestType.JSON, dataparams, body.toString(), dataheadrs);
Assert.assertTrue(Boolean.valueOf(XMJSONPath.readPath(dataApi.getApi_response(),"$.success"))==true,"调用接口返回结果:"+XMJSONPath.readPath(dataApi.getApi_response(),"$.message"));
} }
...@@ -180,7 +189,9 @@ public class CampScheduleTools extends XMBaseTest { ...@@ -180,7 +189,9 @@ public class CampScheduleTools extends XMBaseTest {
body.put("brandId", dataApi.getLoginInfo().getBrandId()); body.put("brandId", dataApi.getLoginInfo().getBrandId());
body.put("startDate", startDate); body.put("startDate", startDate);
body.put("endDate", endDate); body.put("endDate", endDate);
dataApi.doRequest(RequestType.JSON, dataparams, body.toString(), dataheadrs).assetsSuccess(true); dataApi.doRequest(RequestType.JSON, dataparams, body.toString(), dataheadrs);
Assert.assertTrue(Boolean.valueOf(XMJSONPath.readPath(dataApi.getApi_response(),"$.success"))==true,"调用接口返回结果:"+XMJSONPath.readPath(dataApi.getApi_response(),"$.message"));
if (Integer.valueOf(XMJSONPath.readPath(dataApi.getApi_response(), "$.result.totalCount")) > 0) { if (Integer.valueOf(XMJSONPath.readPath(dataApi.getApi_response(), "$.result.totalCount")) > 0) {
return dataApi.getBodyInJSON().getJSONObject("result").getJSONArray("timetableGroups").getJSONObject(0).getJSONArray("timetableList"); return dataApi.getBodyInJSON().getJSONObject("result").getJSONArray("timetableGroups").getJSONObject(0).getJSONArray("timetableList");
} }
...@@ -205,7 +216,9 @@ public class CampScheduleTools extends XMBaseTest { ...@@ -205,7 +216,9 @@ public class CampScheduleTools extends XMBaseTest {
body.put("startDate", startDate); body.put("startDate", startDate);
body.put("endDate", endDate); body.put("endDate", endDate);
body.put("weekdays", weekdaysList); body.put("weekdays", weekdaysList);
dataApi.doRequest(RequestType.JSON, dataparams, body.toString(), dataheadrs).assetsSuccess(true); dataApi.doRequest(RequestType.JSON, dataparams, body.toString(), dataheadrs);
Assert.assertTrue(Boolean.valueOf(XMJSONPath.readPath(dataApi.getApi_response(),"$.success"))==true,"调用接口返回结果:"+XMJSONPath.readPath(dataApi.getApi_response(),"$.message"));
return Integer.valueOf(XMJSONPath.readPath(dataApi.getApi_response(),"$.result")); return Integer.valueOf(XMJSONPath.readPath(dataApi.getApi_response(),"$.result"));
} }
...@@ -220,7 +233,9 @@ public class CampScheduleTools extends XMBaseTest { ...@@ -220,7 +233,9 @@ public class CampScheduleTools extends XMBaseTest {
body.put("studioId", dataApi.getLoginInfo().getStudioId()); body.put("studioId", dataApi.getLoginInfo().getStudioId());
body.put("brandId", dataApi.getLoginInfo().getBrandId()); body.put("brandId", dataApi.getLoginInfo().getBrandId());
body.put("id", ruldId); body.put("id", ruldId);
dataApi.doRequest(RequestType.JSON, dataparams, body.toString(), dataheadrs).assetsSuccess(true); dataApi.doRequest(RequestType.JSON, dataparams, body.toString(), dataheadrs);
Assert.assertTrue(Boolean.valueOf(XMJSONPath.readPath(dataApi.getApi_response(),"$.success"))==true,"调用接口返回结果:"+XMJSONPath.readPath(dataApi.getApi_response(),"$.message"));
} }
...@@ -235,7 +250,9 @@ public class CampScheduleTools extends XMBaseTest { ...@@ -235,7 +250,9 @@ public class CampScheduleTools extends XMBaseTest {
body.put("studioId", dataApi.getLoginInfo().getStudioId()); body.put("studioId", dataApi.getLoginInfo().getStudioId());
body.put("brandId", dataApi.getLoginInfo().getBrandId()); body.put("brandId", dataApi.getLoginInfo().getBrandId());
body.put("id", scheduleId); body.put("id", scheduleId);
dataApi.doRequest(RequestType.JSON, dataparams, body.toString(), dataheadrs).assetsSuccess(true); dataApi.doRequest(RequestType.JSON, dataparams, body.toString(), dataheadrs);
Assert.assertTrue(Boolean.valueOf(XMJSONPath.readPath(dataApi.getApi_response(),"$.success"))==true,"调用接口返回结果:"+XMJSONPath.readPath(dataApi.getApi_response(),"$.message"));
} }
/** /**
...@@ -251,7 +268,9 @@ public class CampScheduleTools extends XMBaseTest { ...@@ -251,7 +268,9 @@ public class CampScheduleTools extends XMBaseTest {
body.put("brandId", dataApi.getLoginInfo().getBrandId()); body.put("brandId", dataApi.getLoginInfo().getBrandId());
body.put("scheduleId", scheduleId); body.put("scheduleId", scheduleId);
body.put("applyRestRule", applyRestRule); body.put("applyRestRule", applyRestRule);
dataApi.doRequest(RequestType.JSON, dataparams, body.toString(), dataheadrs).assetsSuccess(true); dataApi.doRequest(RequestType.JSON, dataparams, body.toString(), dataheadrs);
Assert.assertTrue(Boolean.valueOf(XMJSONPath.readPath(dataApi.getApi_response(),"$.success"))==true,"调用接口返回结果:"+XMJSONPath.readPath(dataApi.getApi_response(),"$.message"));
} }
/** /**
...@@ -283,7 +302,7 @@ public class CampScheduleTools extends XMBaseTest { ...@@ -283,7 +302,7 @@ public class CampScheduleTools extends XMBaseTest {
* @param ruldId * @param ruldId
* @return * @return
*/ */
public Set<String> getCampTableDate(int n,String ruldId) { /* public Set<String> getCampTableDate(int n,String ruldId) {
//查看下周训练营课表 //查看下周训练营课表
getCampScheduleTable(CommUtil.oneKeyGetNextWeekStartDay(), CommUtil.oneKeyGetNextWeekEndDay()); getCampScheduleTable(CommUtil.oneKeyGetNextWeekStartDay(), CommUtil.oneKeyGetNextWeekEndDay());
String date = CommUtil.oneKeyGetNextWeekXDay(n);//下周N 日期时间戳 String date = CommUtil.oneKeyGetNextWeekXDay(n);//下周N 日期时间戳
...@@ -301,6 +320,26 @@ public class CampScheduleTools extends XMBaseTest { ...@@ -301,6 +320,26 @@ public class CampScheduleTools extends XMBaseTest {
} }
return null; return null;
}*/
public String getCampTableDate(int n,String ruldId) {
//查看下周训练营课表
getCampScheduleTable(CommUtil.oneKeyGetNextWeekStartDay(), CommUtil.oneKeyGetNextWeekEndDay());
String date = CommUtil.oneKeyGetNextWeekXDay(n);//下周N 日期时间戳
int count = XMJSONPath.getJSONArrayByReadPath(dataApi.getApi_response(), "$.result.timetableGroups").size();
if (count > 0) {
JSONArray array = XMJSONPath.getJSONArrayByReadPath(dataApi.getApi_response(), "$.result.timetableGroups");
String scheduleId = array.toJavaList(JSONObject.class).stream()
.filter(e -> e.getString("date").equals(date))//过滤出日期等于下周N的数据
.flatMap(e -> e.getJSONArray("timetableList").toJavaList(JSONObject.class).stream())//对过滤出的数据再次取目标数据重新组合成一个新的数据流
.filter(e -> null != e.getString("ruleId"))
.filter(e ->e.getString("ruleId").equals(ruldId))
.map(e -> e.getString("scheduleId"))//获取scheduleId
.findFirst().orElse("");
return scheduleId; //如果当天没排课,
}
return "";
} }
......
...@@ -124,7 +124,9 @@ public class TestEditCampRuleSchedule extends SelectTargetTrainingCampAndGetInfo ...@@ -124,7 +124,9 @@ public class TestEditCampRuleSchedule extends SelectTargetTrainingCampAndGetInfo
body.put("endDate", CommUtil.getNDayEndTimeTamp(22)); //结束日期缩短了20天, body.put("endDate", CommUtil.getNDayEndTimeTamp(22)); //结束日期缩短了20天,
body.put("force", true); body.put("force", true);
body.put("retainBooking", true); body.put("retainBooking", true);
xmAppApi.doRequest(RequestType.JSON, params, body.toString(), headers).assetsSuccess(true); xmAppApi.doRequest(RequestType.JSON, params, body.toString(), headers);
Assert.assertTrue(Boolean.valueOf(XMJSONPath.readPath(xmAppApi.getApi_response(),"$.success"))==true,"调用接口返回结果:"+XMJSONPath.readPath(xmAppApi.getApi_response(),"$.message"));
//查询训练营日程详情,check修改项是否被同步修改 //查询训练营日程详情,check修改项是否被同步修改
campScheduleTools.getCampRuleScheduleDetail(ruldId); campScheduleTools.getCampRuleScheduleDetail(ruldId);
......
package com.xiaomai.cases.polar.schedule.camp; package com.xiaomai.cases.polar.schedule.camp;
import com.alibaba.druid.util.StringUtils;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.xiaomai.cases.polar.finance.order.OrderTools; import com.xiaomai.cases.polar.finance.order.OrderTools;
...@@ -81,8 +82,8 @@ public class TestGetCampScheduleItemDetail extends SelectTargetTrainingCampAndGe ...@@ -81,8 +82,8 @@ public class TestGetCampScheduleItemDetail extends SelectTargetTrainingCampAndGe
ruldId = XMJSONPath.getJSONArrayByReadPath(dataApi.getApi_response(), "$.result").getJSONObject(0).getString("ruleId"); ruldId = XMJSONPath.getJSONArrayByReadPath(dataApi.getApi_response(), "$.result").getJSONObject(0).getString("ruleId");
//查看下周5的日课表,期望值无数据 //查看下周5的日课表,期望值无数据
Set<String> scheduleIds5 = campScheduleTools.getCampTableDate(11,ruldId); String scheduleIds5 = campScheduleTools.getCampTableDate(11,ruldId);
Assert.assertTrue(scheduleIds5.size() == 0 || scheduleIds5 == null, "周五没排课,但是检查出有课次"); Assert.assertTrue(StringUtils.isEmpty(scheduleIds5), "周五没排课,但是检查出有课次");
//查看下周日的日课表,有数据,并查看课次详情 //查看下周日的日课表,有数据,并查看课次详情
String startDate = CommUtil.oneKeyGetNextWeekXDay(13);//下周日00点时间 String startDate = CommUtil.oneKeyGetNextWeekXDay(13);//下周日00点时间
...@@ -104,7 +105,9 @@ public class TestGetCampScheduleItemDetail extends SelectTargetTrainingCampAndGe ...@@ -104,7 +105,9 @@ public class TestGetCampScheduleItemDetail extends SelectTargetTrainingCampAndGe
body.put("studioId", xmAppApi.getLoginInfo().getStudioId()); body.put("studioId", xmAppApi.getLoginInfo().getStudioId());
body.put("brandId", xmAppApi.getLoginInfo().getBrandId()); body.put("brandId", xmAppApi.getLoginInfo().getBrandId());
body.put("id", scheduleId); body.put("id", scheduleId);
xmAppApi.doRequest(RequestType.JSON, params, body.toString(), headers).assetsSuccess(true); xmAppApi.doRequest(RequestType.JSON, params, body.toString(), headers);
Assert.assertTrue(Boolean.valueOf(XMJSONPath.readPath(xmAppApi.getApi_response(),"$.success"))==true,"调用接口返回结果:"+XMJSONPath.readPath(xmAppApi.getApi_response(),"$.message"));
//断言check //断言check
//课次中有1个学员check //课次中有1个学员check
......
...@@ -104,7 +104,9 @@ public class TestGetCampScheduleTable extends SelectTargetTrainingCampAndGetInfo ...@@ -104,7 +104,9 @@ public class TestGetCampScheduleTable extends SelectTargetTrainingCampAndGetInfo
body.put("coachId", coachId); body.put("coachId", coachId);
body.put("statusSet", statusSet); body.put("statusSet", statusSet);
body.put("venueAreaId", venueAreaId); body.put("venueAreaId", venueAreaId);
xmAppApi.doRequest(RequestType.JSON, params, body.toString(), headers).assetsSuccess(true); xmAppApi.doRequest(RequestType.JSON, params, body.toString(), headers);
Assert.assertTrue(Boolean.valueOf(XMJSONPath.readPath(xmAppApi.getApi_response(),"$.success"))==true,"调用接口返回结果:"+XMJSONPath.readPath(xmAppApi.getApi_response(),"$.message"));
int resultCount = Integer.parseInt(XMJSONPath.readPath(xmAppApi.getApi_response(), "$.result.totalCount")); int resultCount = Integer.parseInt(XMJSONPath.readPath(xmAppApi.getApi_response(), "$.result.totalCount"));
Assert.assertTrue(resultCount >= total, "查询到的课表数据和预期不一致"); Assert.assertTrue(resultCount >= total, "查询到的课表数据和预期不一致");
} }
......
...@@ -12,6 +12,7 @@ import com.xiaomai.utils.XMBaseTest; ...@@ -12,6 +12,7 @@ import com.xiaomai.utils.XMBaseTest;
import com.xiaomai.utils.XMJSONPath; import com.xiaomai.utils.XMJSONPath;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import org.testng.Assert;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.ArrayList; import java.util.ArrayList;
...@@ -74,7 +75,9 @@ public class GroupScheduleTools extends XMBaseTest { ...@@ -74,7 +75,9 @@ public class GroupScheduleTools extends XMBaseTest {
body.put("endDate", CommUtil.getNDayEndTimeTamp(60)); //排课结束日期,这里就设置自动延顺60天,结束日期会覆盖你传的endDate body.put("endDate", CommUtil.getNDayEndTimeTamp(60)); //排课结束日期,这里就设置自动延顺60天,结束日期会覆盖你传的endDate
} }
dataApi.doRequest(RequestType.JSON, dataparams, body.toString(), dataheadrs).assetsSuccess(true); dataApi.doRequest(RequestType.JSON, dataparams, body.toString(), dataheadrs);
Assert.assertTrue(Boolean.valueOf(XMJSONPath.readPath(dataApi.getApi_response(),"$.success"))==true,"调用接口返回结果:"+XMJSONPath.readPath(dataApi.getApi_response(),"$.message"));
} }
...@@ -98,7 +101,8 @@ public class GroupScheduleTools extends XMBaseTest { ...@@ -98,7 +101,8 @@ public class GroupScheduleTools extends XMBaseTest {
if (coachId != null && coachId.length() != 0) { if (coachId != null && coachId.length() != 0) {
body.put("coachId", coachId); body.put("coachId", coachId);
} }
dataApi.doRequest(RequestType.JSON, dataparams, body.toString(), dataheadrs).assetsSuccess(true); dataApi.doRequest(RequestType.JSON, dataparams, body.toString(), dataheadrs);
Assert.assertTrue(Boolean.valueOf(XMJSONPath.readPath(dataApi.getApi_response(),"$.success"))==true,"调用接口返回结果:"+XMJSONPath.readPath(dataApi.getApi_response(),"$.message"));
return XMJSONPath.getJSONArrayByReadPath(dataApi.getApi_response(), "$.result"); return XMJSONPath.getJSONArrayByReadPath(dataApi.getApi_response(), "$.result");
} }
...@@ -144,7 +148,9 @@ public class GroupScheduleTools extends XMBaseTest { ...@@ -144,7 +148,9 @@ public class GroupScheduleTools extends XMBaseTest {
body.put("brandId", dataApi.getLoginInfo().getBrandId()); body.put("brandId", dataApi.getLoginInfo().getBrandId());
body.put("force", force); body.put("force", force);
body.put("ruleId", ruleId); body.put("ruleId", ruleId);
dataApi.doRequest(RequestType.JSON, dataparams, body.toString(), dataheadrs).assetsSuccess(true); dataApi.doRequest(RequestType.JSON, dataparams, body.toString(), dataheadrs);
Assert.assertTrue(Boolean.valueOf(XMJSONPath.readPath(dataApi.getApi_response(),"$.success"))==true,"调用接口返回结果:"+XMJSONPath.readPath(dataApi.getApi_response(),"$.message"));
} }
...@@ -228,7 +234,9 @@ public class GroupScheduleTools extends XMBaseTest { ...@@ -228,7 +234,9 @@ public class GroupScheduleTools extends XMBaseTest {
body.put("studioId", dataApi.getLoginInfo().getStudioId()); body.put("studioId", dataApi.getLoginInfo().getStudioId());
body.put("brandId", dataApi.getLoginInfo().getBrandId()); body.put("brandId", dataApi.getLoginInfo().getBrandId());
body.put("id", ruldId); body.put("id", ruldId);
dataApi.doRequest(RequestType.JSON, dataparams, body.toString(), dataheadrs).assetsSuccess(true); dataApi.doRequest(RequestType.JSON, dataparams, body.toString(), dataheadrs);
Assert.assertTrue(Boolean.valueOf(XMJSONPath.readPath(dataApi.getApi_response(),"$.success"))==true,"调用接口返回结果:"+XMJSONPath.readPath(dataApi.getApi_response(),"$.message"));
} }
...@@ -248,7 +256,9 @@ public class GroupScheduleTools extends XMBaseTest { ...@@ -248,7 +256,9 @@ public class GroupScheduleTools extends XMBaseTest {
body.put("brandId", dataApi.getLoginInfo().getBrandId()); body.put("brandId", dataApi.getLoginInfo().getBrandId());
body.put("id", scheduleId); body.put("id", scheduleId);
dataApi.doRequest(RequestType.JSON, dataparams, body.toString(), dataheadrs).assetsSuccess(true); dataApi.doRequest(RequestType.JSON, dataparams, body.toString(), dataheadrs);
Assert.assertTrue(Boolean.valueOf(XMJSONPath.readPath(dataApi.getApi_response(),"$.success"))==true,"调用接口返回结果:"+XMJSONPath.readPath(dataApi.getApi_response(),"$.message"));
return dataApi.getBodyInJSON().getJSONObject("result"); return dataApi.getBodyInJSON().getJSONObject("result");
} }
...@@ -309,7 +319,9 @@ public class GroupScheduleTools extends XMBaseTest { ...@@ -309,7 +319,9 @@ public class GroupScheduleTools extends XMBaseTest {
body.put("assistCoachIds", new ArrayList()); body.put("assistCoachIds", new ArrayList());
body.put("spanMinutes", 60); body.put("spanMinutes", 60);
body.put("force", false); body.put("force", false);
dataApi.doRequest(RequestType.JSON, dataparams, body.toString(), dataheadrs).assetsSuccess(true); dataApi.doRequest(RequestType.JSON, dataparams, body.toString(), dataheadrs);
Assert.assertTrue(Boolean.valueOf(XMJSONPath.readPath(dataApi.getApi_response(),"$.success"))==true,"调用接口返回结果:"+XMJSONPath.readPath(dataApi.getApi_response(),"$.message"));
} }
...@@ -331,7 +343,9 @@ public class GroupScheduleTools extends XMBaseTest { ...@@ -331,7 +343,9 @@ public class GroupScheduleTools extends XMBaseTest {
body.put("scheduleId", scheduleId); body.put("scheduleId", scheduleId);
body.put("applyRestRule", false); body.put("applyRestRule", false);
dataApi.doRequest(RequestType.JSON, dataparams, body.toString(), dataheadrs).assetsSuccess(true); dataApi.doRequest(RequestType.JSON, dataparams, body.toString(), dataheadrs);
Assert.assertTrue(Boolean.valueOf(XMJSONPath.readPath(dataApi.getApi_response(),"$.success"))==true,"调用接口返回结果:"+XMJSONPath.readPath(dataApi.getApi_response(),"$.message"));
} }
/** /**
...@@ -367,7 +381,7 @@ public class GroupScheduleTools extends XMBaseTest { ...@@ -367,7 +381,7 @@ public class GroupScheduleTools extends XMBaseTest {
* @param ruldId * @param ruldId
* @return * @return
*/ */
public Set<String> getTableDate(int n,String ruldId) { public String getTableDate(int n,String ruldId) {
//查看团课课表 //查看团课课表
getGroupScheduleTable(Long.valueOf(CommUtil.oneKeyGetNextWeekStartDay()), Long.valueOf(CommUtil.oneKeyGetNextWeekEndDay()),""); getGroupScheduleTable(Long.valueOf(CommUtil.oneKeyGetNextWeekStartDay()), Long.valueOf(CommUtil.oneKeyGetNextWeekEndDay()),"");
//获取下周周N及后续的课次 //获取下周周N及后续的课次
...@@ -375,17 +389,17 @@ public class GroupScheduleTools extends XMBaseTest { ...@@ -375,17 +389,17 @@ public class GroupScheduleTools extends XMBaseTest {
int count = XMJSONPath.getJSONArrayByReadPath(dataApi.getApi_response(), "$.result.timetableGroups").size(); int count = XMJSONPath.getJSONArrayByReadPath(dataApi.getApi_response(), "$.result.timetableGroups").size();
if (count > 0) { if (count > 0) {
JSONArray array = XMJSONPath.getJSONArrayByReadPath(dataApi.getApi_response(), "$.result.timetableGroups"); JSONArray array = XMJSONPath.getJSONArrayByReadPath(dataApi.getApi_response(), "$.result.timetableGroups");
Set<String> scheduleIds = array.toJavaList(JSONObject.class).stream() String scheduleIds = array.toJavaList(JSONObject.class).stream()
.filter(e -> e.getString("date").equals(date))//过滤出日期等于下周N的数据 .filter(e -> e.getString("date").equals(date))//过滤出日期等于下周N的数据
.flatMap(e -> e.getJSONArray("timetableList").toJavaList(JSONObject.class).stream())//对过滤出的数据再次取目标数据重新组合成一个新的数据流 .flatMap(e -> e.getJSONArray("timetableList").toJavaList(JSONObject.class).stream())//对过滤出的数据再次取目标数据重新组合成一个新的数据流
.filter(e -> null != e.getString("ruleId")) .filter(e -> null != e.getString("ruleId"))
.filter(e ->e.getString("ruleId").equals(ruldId)) .filter(e ->e.getString("ruleId").equals(ruldId))
.map(e -> e.getString("scheduleId"))//获取scheduleId .map(e -> e.getString("scheduleId"))//获取scheduleId
.collect(Collectors.toSet()); .findFirst().orElse("");
return scheduleIds; //如果当天没排课,则scheduleIds.size()==0 return scheduleIds;
} }
return null; return "";
} }
......
...@@ -80,7 +80,7 @@ public class TestCreateGroupRuleSchedule extends BaseTestImpl { ...@@ -80,7 +80,7 @@ public class TestCreateGroupRuleSchedule extends BaseTestImpl {
List<String> assistCoachIdS = groupScheduleTools.getStudioAdminId(assistCoachIds); List<String> assistCoachIdS = groupScheduleTools.getStudioAdminId(assistCoachIds);
//1-创建排课日程 //1-创建排课日程
groupScheduleTools.createGroupRuleSchedule(courseId, chiefCoachIdS, todayStartTimeTamp, endDateTimeTamp, venueAreaIds, assistCoachIdS, false, 1, 480); groupScheduleTools.createGroupRuleSchedule(courseId, chiefCoachIdS, todayStartTimeTamp, endDateTimeTamp, venueAreaIds, assistCoachIdS, true, 1, 480);
//2-查询排课日程 //2-查询排课日程
JSONArray result = groupScheduleTools.getGroupRuleScheduleList(courseId, chiefCoachIdS); JSONArray result = groupScheduleTools.getGroupRuleScheduleList(courseId, chiefCoachIdS);
String ruldId = XMJSONPath.readPath(result.getJSONObject(0), "$.ruleId"); String ruldId = XMJSONPath.readPath(result.getJSONObject(0), "$.ruleId");
......
package com.xiaomai.cases.polar.schedule.group; package com.xiaomai.cases.polar.schedule.group;
import com.alibaba.druid.util.StringUtils;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.xiaomai.enums.ApiModule; import com.xiaomai.enums.ApiModule;
...@@ -38,59 +39,60 @@ public class TestDelGroupScheduleItem extends UniversalDataScheduling { ...@@ -38,59 +39,60 @@ public class TestDelGroupScheduleItem extends UniversalDataScheduling {
@Test(description = "删除当前课次") @Test(description = "删除当前课次")
public void testDelCurrentGroupSchedule() { public void testDelCurrentGroupSchedule() {
//获取下周四的课次ID(匹配到刚创建的规则ID) //获取下周四的课次ID(匹配到刚创建的规则ID)
Set<String> scheduleIds = groupScheduleTools.getTableDate(10,groupRuldId); String scheduleId = groupScheduleTools.getTableDate(10, groupRuldId);
//如果课次ID有值则继续走删除的case //如果课次ID有值则继续走删除的case
if (scheduleIds!= null && scheduleIds.size() != 0) { if (!StringUtils.isEmpty(scheduleId)) {
scheduleIds.stream().forEach(scheduleId -> { JSONObject body1 = new JSONObject();
JSONObject body = new JSONObject(); body1.put("operatorId", xmAppApi.getLoginInfo().getAdminId());
body.put("operatorId", xmAppApi.getLoginInfo().getAdminId()); body1.put("studioId", xmAppApi.getLoginInfo().getStudioId());
body.put("studioId", xmAppApi.getLoginInfo().getStudioId()); body1.put("brandId", xmAppApi.getLoginInfo().getBrandId());
body.put("brandId", xmAppApi.getLoginInfo().getBrandId()); body1.put("applyRestRule", false);
body.put("applyRestRule", false); body1.put("scheduleId", scheduleId);
body.put("scheduleId", scheduleId); xmAppApi.doRequest(RequestType.JSON, params, body1.toString(), headers);
xmAppApi.doRequest(RequestType.JSON, params, body.toString(), headers).assetsSuccess(true); Assert.assertTrue(Boolean.valueOf(XMJSONPath.readPath(xmAppApi.getApi_response(), "$.success")) == true, "调用接口返回结果:" + XMJSONPath.readPath(xmAppApi.getApi_response(), "$.message"));
//删除成功后check 下周四课表是否有数据
groupScheduleTools.getGroupScheduleTable(Long.valueOf(CommUtil.oneKeyGetNextWeekXDay(10)), Long.valueOf(CommUtil.oneKeyGetNextWeekEndXDay(4)),courseId); //删除成功后check 下周四课表是否有数据
Long countA=XMJSONPath.getJSONArrayByReadPath(dataApi.getApi_response(), "$.result.timetableGroups").toJavaList(JSONObject.class).stream() groupScheduleTools.getGroupScheduleTable(Long.valueOf(CommUtil.oneKeyGetNextWeekXDay(10)), Long.valueOf(CommUtil.oneKeyGetNextWeekEndXDay(4)), courseId);
.flatMap(e -> e.getJSONArray("timetableList").toJavaList(JSONObject.class).stream()) Long countA = XMJSONPath.getJSONArrayByReadPath(dataApi.getApi_response(), "$.result.timetableGroups").toJavaList(JSONObject.class).stream()
.filter(e ->e.getString("scheduleId").equals(scheduleId)).count(); .flatMap(e -> e.getJSONArray("timetableList").toJavaList(JSONObject.class).stream())
Assert.assertTrue(countA==0,"删除课次后,课表中后端返回数据有问题,目前还能发现数据"); .filter(e -> e.getString("scheduleId").equals(scheduleId)).count();
}); Assert.assertTrue(countA == 0, "删除课次后,课表中后端返回数据有问题,目前还能发现数据");
} }
} }
@Test(description = "删除当前及后续课次", dependsOnMethods = {"testDelCurrentGroupSchedule"},alwaysRun = true) @Test(description = "删除当前及后续课次", dependsOnMethods = {"testDelCurrentGroupSchedule"}, alwaysRun = true)
public void testDelCurrentAndSubsequentGroupSchedule() { public void testDelCurrentAndSubsequentGroupSchedule() {
//获取下周三的课次ID(匹配到对应的规则ID) //获取下周三的课次ID(匹配到对应的规则ID)
Set<String> scheduleIds = groupScheduleTools.getTableDate(9,groupRuldId); String scheduleIdsG = groupScheduleTools.getTableDate(9, groupRuldId);
//如果课次ID有值则继续走删除的case //如果课次ID有值则继续走删除的case
if (scheduleIds!= null && scheduleIds.size() != 0) { if (!StringUtils.isEmpty(scheduleIdsG)) {
scheduleIds.stream().forEach(scheduleId -> { JSONObject body = new JSONObject();
JSONObject body = new JSONObject(); body.put("operatorId", xmAppApi.getLoginInfo().getAdminId());
body.put("operatorId", xmAppApi.getLoginInfo().getAdminId()); body.put("studioId", xmAppApi.getLoginInfo().getStudioId());
body.put("studioId", xmAppApi.getLoginInfo().getStudioId()); body.put("brandId", xmAppApi.getLoginInfo().getBrandId());
body.put("brandId", xmAppApi.getLoginInfo().getBrandId()); body.put("applyRestRule", true);
body.put("applyRestRule", true); body.put("scheduleId", scheduleIdsG);
body.put("scheduleId", scheduleId); xmAppApi.doRequest(RequestType.JSON, params, body.toString(), headers);
xmAppApi.doRequest(RequestType.JSON, params, body.toString(), headers).assetsSuccess(true); Assert.assertTrue(Boolean.valueOf(XMJSONPath.readPath(xmAppApi.getApi_response(), "$.success")) == true, "调用接口返回结果:" + XMJSONPath.readPath(xmAppApi.getApi_response(), "$.message"));
//删除成功后check 从下周三到下周日课表是否有数据
groupScheduleTools.getGroupScheduleTable(Long.valueOf(CommUtil.oneKeyGetNextWeekXDay(9)), Long.valueOf(CommUtil.oneKeyGetNextWeekEndDay()),courseId); //删除成功后check 从下周三到下周日课表是否有数据
Long countB=XMJSONPath.getJSONArrayByReadPath(dataApi.getApi_response(), "$.result.timetableGroups").toJavaList(JSONObject.class).stream() groupScheduleTools.getGroupScheduleTable(Long.valueOf(CommUtil.oneKeyGetNextWeekXDay(9)), Long.valueOf(CommUtil.oneKeyGetNextWeekEndDay()), courseId);
.flatMap(e -> e.getJSONArray("timetableList").toJavaList(JSONObject.class).stream()) Long countB = XMJSONPath.getJSONArrayByReadPath(dataApi.getApi_response(), "$.result.timetableGroups").toJavaList(JSONObject.class).stream()
.filter(e -> null != e.getString("ruleId")) .flatMap(e -> e.getJSONArray("timetableList").toJavaList(JSONObject.class).stream())
.filter(e ->e.getString("ruleId").equals(groupRuldId)).count(); .filter(e -> null != e.getString("ruleId"))
Assert.assertTrue(countB==0,"删除当前及后续课次后,课表中后端返回数据有问题,目前还能发现数据"); }); .filter(e -> e.getString("ruleId").equals(groupRuldId)).count();
Assert.assertTrue(countB == 0, "删除当前及后续课次后,课表中后端返回数据有问题,目前还能发现数据");
} }
} }
@AfterTest(description = "删除此case创建的日程") @AfterTest(description = "删除此case创建的日程")
public void delData(){ public void delData() {
List<String> ruleIdIds = new ArrayList<>(); List<String> ruleIdIds = new ArrayList<>();
//查询这个case创建的相关日程 //查询这个case创建的相关日程
JSONArray result = groupScheduleTools.getGroupRuleScheduleList(courseId, chiefCoachIdS); JSONArray result = groupScheduleTools.getGroupRuleScheduleList(courseId, chiefCoachIdS);
...@@ -114,7 +116,6 @@ public class TestDelGroupScheduleItem extends UniversalDataScheduling { ...@@ -114,7 +116,6 @@ public class TestDelGroupScheduleItem extends UniversalDataScheduling {
} }
} }
\ No newline at end of file
...@@ -86,7 +86,9 @@ public class TestEditGroupRuleSchedule extends BaseTestImpl { ...@@ -86,7 +86,9 @@ public class TestEditGroupRuleSchedule extends BaseTestImpl {
body.put("endDate", CommUtil.getNDayEndTimeTamp(0)); //结束日期缩短了,改成当天结束 body.put("endDate", CommUtil.getNDayEndTimeTamp(0)); //结束日期缩短了,改成当天结束
body.put("force", false); body.put("force", false);
body.put("retainBooking", true); body.put("retainBooking", true);
xmAppApi.doRequest(RequestType.JSON, params, body.toString(), headers).assetsSuccess(true); xmAppApi.doRequest(RequestType.JSON, params, body.toString(), headers);
Assert.assertTrue(Boolean.valueOf(XMJSONPath.readPath(xmAppApi.getApi_response(),"$.success"))==true,"调用接口返回结果:"+XMJSONPath.readPath(xmAppApi.getApi_response(),"$.message"));
//4-查看日程详情,check修改内容是否同步变更 //4-查看日程详情,check修改内容是否同步变更
groupScheduleTools.getGroupRuleScheduleDetail(ruldId); groupScheduleTools.getGroupRuleScheduleDetail(ruldId);
......
...@@ -126,7 +126,9 @@ public class TestGetGroupScheduleTable extends BaseTestImpl { ...@@ -126,7 +126,9 @@ public class TestGetGroupScheduleTable extends BaseTestImpl {
body.put("coachId", coachId); body.put("coachId", coachId);
body.put("venueAreaId", venueAreaId); body.put("venueAreaId", venueAreaId);
body.put("statusSet", statusSet); body.put("statusSet", statusSet);
xmAppApi.doRequest(RequestType.JSON, params, body.toString(), headers).assetsSuccess(true); xmAppApi.doRequest(RequestType.JSON, params, body.toString(), headers);
Assert.assertTrue(Boolean.valueOf(XMJSONPath.readPath(xmAppApi.getApi_response(),"$.success"))==true,"调用接口返回结果:"+XMJSONPath.readPath(xmAppApi.getApi_response(),"$.message"));
int resultCount=Integer.parseInt(XMJSONPath.readPath(xmAppApi.getApi_response(),"$.result.totalCount")); int resultCount=Integer.parseInt(XMJSONPath.readPath(xmAppApi.getApi_response(),"$.result.totalCount"));
Assert.assertTrue(resultCount>=totalCount,"查询到的课表数据和预期不一致"); Assert.assertTrue(resultCount>=totalCount,"查询到的课表数据和预期不一致");
......
...@@ -54,9 +54,9 @@ public class TestDoForceOpenTraining extends BaseCreateTrainingData { ...@@ -54,9 +54,9 @@ public class TestDoForceOpenTraining extends BaseCreateTrainingData {
if (status.equals("APPLY_NOT_START")) { if (status.equals("APPLY_NOT_START")) {
//对报名未开始的活动操作立即成营 //对报名未开始的活动操作立即成营
JSONObject body = new JSONObject(); JSONObject body = new JSONObject();
body.put("operatorId", dataApi.getLoginInfo().getAdminId()); body.put("operatorId", xmAppApi.getLoginInfo().getAdminId());
body.put("studioId", dataApi.getLoginInfo().getStudioId()); body.put("studioId", xmAppApi.getLoginInfo().getStudioId());
body.put("brandId", dataApi.getLoginInfo().getBrandId()); body.put("brandId", xmAppApi.getLoginInfo().getBrandId());
body.put("id", id); body.put("id", id);
xmAppApi.doRequest(RequestType.JSON, params, body.toString(), headers); xmAppApi.doRequest(RequestType.JSON, params, body.toString(), headers);
Assert.assertEquals(XMJSONPath.readPath(xmAppApi.getApi_response(), "$.message"), "只有报名中的训练营能【立即成营】"); Assert.assertEquals(XMJSONPath.readPath(xmAppApi.getApi_response(), "$.message"), "只有报名中的训练营能【立即成营】");
...@@ -80,11 +80,13 @@ public class TestDoForceOpenTraining extends BaseCreateTrainingData { ...@@ -80,11 +80,13 @@ public class TestDoForceOpenTraining extends BaseCreateTrainingData {
if(goalN>0){ if(goalN>0){
goalId=XMJSONPath.readPath(dataApi.getApi_response(),"$.result.records[0].id"); goalId=XMJSONPath.readPath(dataApi.getApi_response(),"$.result.records[0].id");
JSONObject body1 = new JSONObject(); JSONObject body1 = new JSONObject();
body1.put("operatorId", dataApi.getLoginInfo().getAdminId()); body1.put("operatorId", xmAppApi.getLoginInfo().getAdminId());
body1.put("studioId", dataApi.getLoginInfo().getStudioId()); body1.put("studioId", xmAppApi.getLoginInfo().getStudioId());
body1.put("brandId", dataApi.getLoginInfo().getBrandId()); body1.put("brandId", xmAppApi.getLoginInfo().getBrandId());
body1.put("id", goalId); body1.put("id", goalId);
xmAppApi.doRequest(RequestType.JSON, params, body1.toString(), headers).assetsSuccess(true); xmAppApi.doRequest(RequestType.JSON, params, body1.toString(), headers);
Assert.assertTrue(Boolean.valueOf(XMJSONPath.readPath(xmAppApi.getApi_response(),"$.success"))==true,"调用接口返回结果:"+XMJSONPath.readPath(xmAppApi.getApi_response(),"$.message"));
} }
......
...@@ -82,7 +82,7 @@ public class TestDoSignCampOrder extends SelectTargetTrainingCampAndGetInfo { ...@@ -82,7 +82,7 @@ public class TestDoSignCampOrder extends SelectTargetTrainingCampAndGetInfo {
//退单后再搜索报名记录check //退单后再搜索报名记录check
trainingTools.getTrainingApplyRecordsList(this.campId, phone); trainingTools.getTrainingApplyRecordsList(this.campId, phone);
Assert.assertTrue(XMJSONPath.getJSONArrayByReadPath(dataApi.getApi_response(), "$.result").size() == 0, "给学员退单后,在报名列表中还能查询到数据"); Assert.assertTrue(XMJSONPath.getJSONArrayByReadPath(dataApi.getApi_response(), "$.result").size() == 0, "给学员退单后,在报名列表中还能查询到数据");
Thread.sleep(1000); Thread.sleep(2000);
//退单后check训练营报名记录(入口:报名记录):根据训练营,报名记录状态,来源 //退单后check训练营报名记录(入口:报名记录):根据训练营,报名记录状态,来源
List<String> cardState=new ArrayList<>(); List<String> cardState=new ArrayList<>();
...@@ -123,7 +123,7 @@ public class TestDoSignCampOrder extends SelectTargetTrainingCampAndGetInfo { ...@@ -123,7 +123,7 @@ public class TestDoSignCampOrder extends SelectTargetTrainingCampAndGetInfo {
Assert.assertEquals(XMJSONPath.readPath(xmAppApi.getApi_response(), "$.message"), "签单失败,已报名该训练营无需重复操作"); Assert.assertEquals(XMJSONPath.readPath(xmAppApi.getApi_response(), "$.message"), "签单失败,已报名该训练营无需重复操作");
} }
@Test(description = "给学员报名训练营活动构造待支付订单",priority = 1) @Test(description = "给学员报名训练营活动构造待支付订单",dependsOnMethods = {"testDoSignCampOrder"},alwaysRun = true)
public void testUnpaidOrder() throws InterruptedException { public void testUnpaidOrder() throws InterruptedException {
//搜索目标会员 //搜索目标会员
String phone = "15658063769"; String phone = "15658063769";
...@@ -131,8 +131,8 @@ public class TestDoSignCampOrder extends SelectTargetTrainingCampAndGetInfo { ...@@ -131,8 +131,8 @@ public class TestDoSignCampOrder extends SelectTargetTrainingCampAndGetInfo {
if (memberId2.isEmpty()) { if (memberId2.isEmpty()) {
memberId2 = tools.create("晨晨爸爸", phone).getString("result"); memberId2 = tools.create("晨晨爸爸", phone).getString("result");
} }
//报名接口做了重复调用限制,间隔3000秒,否则提示:调用过于频繁,请稍后重试
Thread.sleep(3000); Thread.sleep(4000);
JSONObject body = new JSONObject(); JSONObject body = new JSONObject();
body.put("operatorId", xmAppApi.getLoginInfo().getAdminId()); body.put("operatorId", xmAppApi.getLoginInfo().getAdminId());
...@@ -149,7 +149,9 @@ public class TestDoSignCampOrder extends SelectTargetTrainingCampAndGetInfo { ...@@ -149,7 +149,9 @@ public class TestDoSignCampOrder extends SelectTargetTrainingCampAndGetInfo {
campInfo.put("campId", this.campId); campInfo.put("campId", this.campId);
body.put("camp", campInfo); body.put("camp", campInfo);
body.put("paymentWays", new JSONArray());//支付方式传空 body.put("paymentWays", new JSONArray());//支付方式传空
xmAppApi.doRequest(RequestType.JSON, params, body.toString(), headers).assetsSuccess(true); xmAppApi.doRequest(RequestType.JSON, params, body.toString(), headers);
Assert.assertTrue(Boolean.valueOf(XMJSONPath.readPath(xmAppApi.getApi_response(),"$.success"))==true,"调用接口返回结果:"+XMJSONPath.readPath(xmAppApi.getApi_response(),"$.message"));
orderId = XMJSONPath.readPath(xmAppApi.getApi_response(), "$.result"); orderId = XMJSONPath.readPath(xmAppApi.getApi_response(), "$.result");
//报名成功后根据会员手机号,在报名会员列表搜索报名数据 //报名成功后根据会员手机号,在报名会员列表搜索报名数据
trainingTools.getTrainingApplyRecordsList(this.campId, phone); trainingTools.getTrainingApplyRecordsList(this.campId, phone);
......
...@@ -130,7 +130,9 @@ public class TestEditTraining extends BaseCreateTrainingData { ...@@ -130,7 +130,9 @@ public class TestEditTraining extends BaseCreateTrainingData {
editBody.put("xcxSaleStatus", "YES"); //开启小程序售卖 editBody.put("xcxSaleStatus", "YES"); //开启小程序售卖
editBody.put("underlinePrice", 29.9);//可以修改 editBody.put("underlinePrice", 29.9);//可以修改
editBody.put("id", oneKeytTrainingId); //活动ID editBody.put("id", oneKeytTrainingId); //活动ID
xmAppApi.doRequest(RequestType.JSON, params, editBody.toString(), headers).assetsSuccess(true); xmAppApi.doRequest(RequestType.JSON, params, editBody.toString(), headers);
Assert.assertTrue(Boolean.valueOf(XMJSONPath.readPath(xmAppApi.getApi_response(),"$.success"))==true,"调用接口返回结果:"+XMJSONPath.readPath(xmAppApi.getApi_response(),"$.message"));
//5.查看活动详情,check 不能修改项和一修改项是否被同步修改 //5.查看活动详情,check 不能修改项和一修改项是否被同步修改
trainingTools.findTrainingDetailById(oneKeytTrainingId); trainingTools.findTrainingDetailById(oneKeytTrainingId);
//5.1不能修改的字段check(修改后和修改前比对) //5.1不能修改的字段check(修改后和修改前比对)
......
...@@ -99,7 +99,9 @@ public class TestSearchTrainingAccountRecordsList extends SelectTargetTrainingCa ...@@ -99,7 +99,9 @@ public class TestSearchTrainingAccountRecordsList extends SelectTargetTrainingCa
} }
body.put("memberCardStateList", memberCardState); body.put("memberCardStateList", memberCardState);
xmAppApi.doRequest(RequestType.JSON, params, body.toString(), headers).assetsSuccess(true); xmAppApi.doRequest(RequestType.JSON, params, body.toString(), headers);
Assert.assertTrue(Boolean.valueOf(XMJSONPath.readPath(xmAppApi.getApi_response(),"$.success"))==true,"调用接口返回结果:"+XMJSONPath.readPath(xmAppApi.getApi_response(),"$.message"));
//有存量数据,理论上每个查询都会至少有1条数据 //有存量数据,理论上每个查询都会至少有1条数据
Assert.assertTrue(XMJSONPath.getJSONArrayByReadPath(xmAppApi.getApi_response(), "$.result.records").size() >= flag, "没有搜索到相关数据"); Assert.assertTrue(XMJSONPath.getJSONArrayByReadPath(xmAppApi.getApi_response(), "$.result.records").size() >= flag, "没有搜索到相关数据");
......
...@@ -86,7 +86,9 @@ public class TestSearchTrainingList extends BaseCreateTrainingData { ...@@ -86,7 +86,9 @@ public class TestSearchTrainingList extends BaseCreateTrainingData {
body.put("courseId", courseId); body.put("courseId", courseId);
body.put("stateList", stateList); body.put("stateList", stateList);
body.put("title", title); body.put("title", title);
xmAppApi.doRequest(RequestType.JSON, params, body.toString(), headers).assetsSuccess(true); xmAppApi.doRequest(RequestType.JSON, params, body.toString(), headers);
Assert.assertTrue(Boolean.valueOf(XMJSONPath.readPath(xmAppApi.getApi_response(),"$.success"))==true,"调用接口返回结果:"+XMJSONPath.readPath(xmAppApi.getApi_response(),"$.message"));
//有存量数据,理论上每个查询都会至少有1条数据 //有存量数据,理论上每个查询都会至少有1条数据
Assert.assertTrue(XMJSONPath.getJSONArrayByReadPath(xmAppApi.getApi_response(),"$.result.records").size()>=1,"没有搜索到相关数据"); Assert.assertTrue(XMJSONPath.getJSONArrayByReadPath(xmAppApi.getApi_response(),"$.result.records").size()>=1,"没有搜索到相关数据");
......
...@@ -9,6 +9,7 @@ import com.xiaomai.enums.Terminal; ...@@ -9,6 +9,7 @@ import com.xiaomai.enums.Terminal;
import com.xiaomai.utils.*; import com.xiaomai.utils.*;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.testng.Assert; import org.testng.Assert;
import org.testng.Reporter;
import java.util.List; import java.util.List;
...@@ -367,7 +368,9 @@ public class TrainingTools extends XMBaseTest { ...@@ -367,7 +368,9 @@ public class TrainingTools extends XMBaseTest {
payObject.put("voucherResourceIds",new JSONArray()); payObject.put("voucherResourceIds",new JSONArray());
paymentWays.add(payObject); paymentWays.add(payObject);
body.put("paymentWays",paymentWays); body.put("paymentWays",paymentWays);
dataApi.doRequest(RequestType.JSON, dataparams, body.toString(), dataheadrs).assetsSuccess(true); dataApi.doRequest(RequestType.JSON, dataparams, body.toString(), dataheadrs);
Reporter.log(XMJSONPath.readPath(dataApi.getApi_response(),"$.message"));
Assert.assertTrue(Boolean.valueOf(XMJSONPath.readPath(dataApi.getApi_response(),"$.success"))==true,"调用接口返回结果:"+XMJSONPath.readPath(dataApi.getApi_response(),"$.message"));
} }
...@@ -418,7 +421,9 @@ public class TrainingTools extends XMBaseTest { ...@@ -418,7 +421,9 @@ public class TrainingTools extends XMBaseTest {
payObject.put("voucherResourceIds",new JSONArray()); payObject.put("voucherResourceIds",new JSONArray());
paymentWays.add(payObject); paymentWays.add(payObject);
body.put("paymentWays",paymentWays); body.put("paymentWays",paymentWays);
dataApi.doRequest(RequestType.JSON, dataparams, body.toString(), dataheadrs).assetsSuccess(true); dataApi.doRequest(RequestType.JSON, dataparams, body.toString(), dataheadrs);
Assert.assertTrue(Boolean.valueOf(XMJSONPath.readPath(dataApi.getApi_response(),"$.success"))==true,"调用接口返回结果:"+XMJSONPath.readPath(dataApi.getApi_response(),"$.message"));
} }
...@@ -489,7 +494,9 @@ public class TrainingTools extends XMBaseTest { ...@@ -489,7 +494,9 @@ public class TrainingTools extends XMBaseTest {
body.put("current", 0); body.put("current", 0);
body.put("size", 20); body.put("size", 20);
body.put("memberId", memberId); body.put("memberId", memberId);
dataApi.doRequest(RequestType.JSON, dataparams, body.toString(), dataheadrs).assetsSuccess(true); dataApi.doRequest(RequestType.JSON, dataparams, body.toString(), dataheadrs);
Assert.assertTrue(Boolean.valueOf(XMJSONPath.readPath(dataApi.getApi_response(),"$.success"))==true,"调用接口返回结果:"+XMJSONPath.readPath(dataApi.getApi_response(),"$.message"));
} }
......
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