Commit 451ec2c7 by DuJunLi

优化脚本

parent 86774fd7
......@@ -36,7 +36,7 @@ public class CardTools extends XMBaseTest {
//List itemList = new ArrayList();
//itemList.add("");
JSONObject Object = new JSONObject();
Object.put("identifier", xmAppApi.getLoginInfo().getUser());
Object.put("identifier", dataApi.getLoginInfo().getUser());
Object.put("benefitType", "BALANCE");
Object.put("targetScope", "GROUP_CLASS_AND_PERSONAL_COURSE");
Object.put("balance", "30");
......@@ -63,12 +63,12 @@ public class CardTools extends XMBaseTest {
jsonObject.put("underlinePrice", "10");//划线价
jsonObject.put("purchaseNumberLimit", "-1");//购买数量限制
jsonObject.put("xcxSaleStatus", "YES");//小程序是否售卖
jsonObject.put("creatorId", xmAppApi.getLoginInfo().getAdminId());
jsonObject.put("creatorId", dataApi.getLoginInfo().getAdminId());
jsonObject.put("shelfState", "YES");//卡启用状态
jsonObject.put("brandId", xmAppApi.getLoginInfo().getBrandId());
jsonObject.put("studioId", xmAppApi.getLoginInfo().getStudioId());
jsonObject.put("brandId", dataApi.getLoginInfo().getBrandId());
jsonObject.put("studioId", dataApi.getLoginInfo().getStudioId());
jsonObject.put("description", "{\"items\":[{\"content\":\"自动化创建的卡\",\"aspect\":\"\",\"type\":\"TEXT\"}]}");
jsonObject.put("operatorId", xmAppApi.getLoginInfo().getAdminId());
jsonObject.put("operatorId", dataApi.getLoginInfo().getAdminId());
......@@ -95,9 +95,9 @@ public JSONObject fetchPageOfMemberCard(DataUserInfo...dataUserInfos) {
//jsonObject.put("xcxSaleStatus",xcxSaleStatus);//售卖状态
jsonObject.put("current",0);
jsonObject.put("size",20);
jsonObject.put("studioId", xmAppApi.getLoginInfo().getStudioId());
jsonObject.put("brandId", xmAppApi.getLoginInfo().getBrandId());
jsonObject.put("operatorId", xmAppApi.getLoginInfo().getAdminId());
jsonObject.put("studioId", dataApi.getLoginInfo().getStudioId());
jsonObject.put("brandId", dataApi.getLoginInfo().getBrandId());
jsonObject.put("operatorId", dataApi.getLoginInfo().getAdminId());
dataApi.doRequest(RequestType.JSON, dataparams, jsonObject.toJSONString(), dataheadrs).assetsSuccess(true);
JSONObject response=dataApi.getBodyInJSON();
return response;
......@@ -115,9 +115,9 @@ public JSONObject fetchPageOfMemberCard(DataUserInfo...dataUserInfos) {
jsonObject.put("courseId",courseId);
jsonObject.put("current",0);
jsonObject.put("size",20);
jsonObject.put("studioId", xmAppApi.getLoginInfo().getStudioId());
jsonObject.put("brandId", xmAppApi.getLoginInfo().getBrandId());
jsonObject.put("operatorId", xmAppApi.getLoginInfo().getAdminId());
jsonObject.put("studioId", dataApi.getLoginInfo().getStudioId());
jsonObject.put("brandId", dataApi.getLoginInfo().getBrandId());
jsonObject.put("operatorId", dataApi.getLoginInfo().getAdminId());
dataApi.doRequest(RequestType.JSON, dataparams, jsonObject.toJSONString(), dataheadrs).assetsSuccess(true);
JSONObject response=dataApi.getBodyInJSON();
return response.getJSONObject("result");
......@@ -136,10 +136,10 @@ public JSONObject testMemberCardcommonSearch(String title, DataUserInfo...dataUs
super.beforeDataRequest(dataUserInfos);
JSONObject jsonObject = new JSONObject();
jsonObject.put("brandId",xmAppApi.getLoginInfo().getBrandId());
jsonObject.put("studioId",xmAppApi.getLoginInfo().getStudioId());
jsonObject.put("brandId",dataApi.getLoginInfo().getBrandId());
jsonObject.put("studioId",dataApi.getLoginInfo().getStudioId());
jsonObject.put("title",title);//搜索的卡名
jsonObject.put("operatorId",xmAppApi.getLoginInfo().getAdminId());
jsonObject.put("operatorId",dataApi.getLoginInfo().getAdminId());
dataApi.doRequest(RequestType.JSON, dataparams, jsonObject.toJSONString(), dataheadrs).assetsSuccess(true);
JSONObject response=dataApi.getBodyInJSON();
return response;
......@@ -162,9 +162,9 @@ public JSONObject membercardsearch( DataUserInfo...dataUserInfos) {
jsonObject.put("current",0);
jsonObject.put("size",20);
jsonObject.put("studioId", xmAppApi.getLoginInfo().getStudioId());
jsonObject.put("brandId", xmAppApi.getLoginInfo().getBrandId());
jsonObject.put("operatorId", xmAppApi.getLoginInfo().getAdminId());
jsonObject.put("studioId", dataApi.getLoginInfo().getStudioId());
jsonObject.put("brandId", dataApi.getLoginInfo().getBrandId());
jsonObject.put("operatorId", dataApi.getLoginInfo().getAdminId());
dataApi.doRequest(RequestType.JSON, dataparams, jsonObject.toJSONString(), dataheadrs).assetsSuccess(true);
JSONObject response=dataApi.getBodyInJSON();
......@@ -187,9 +187,9 @@ public JSONObject membercardsearch( DataUserInfo...dataUserInfos) {
JSONObject jsonObject = new JSONObject();
jsonObject.put("content",content);
jsonObject.put("studioId", xmAppApi.getLoginInfo().getStudioId());
jsonObject.put("brandId", xmAppApi.getLoginInfo().getBrandId());
jsonObject.put("operatorId", xmAppApi.getLoginInfo().getAdminId());
jsonObject.put("studioId", dataApi.getLoginInfo().getStudioId());
jsonObject.put("brandId", dataApi.getLoginInfo().getBrandId());
jsonObject.put("operatorId", dataApi.getLoginInfo().getAdminId());
dataApi.doRequest(RequestType.JSON, dataparams, jsonObject.toJSONString(), dataheadrs).assetsSuccess(true);
JSONObject response=dataApi.getBodyInJSON();
......@@ -211,9 +211,9 @@ public JSONObject membercardsearch( DataUserInfo...dataUserInfos) {
JSONObject jsonObject = new JSONObject();
jsonObject.put("id",id);
jsonObject.put("studioId", xmAppApi.getLoginInfo().getStudioId());
jsonObject.put("brandId", xmAppApi.getLoginInfo().getBrandId());
jsonObject.put("operatorId", xmAppApi.getLoginInfo().getAdminId());
jsonObject.put("studioId", dataApi.getLoginInfo().getStudioId());
jsonObject.put("brandId", dataApi.getLoginInfo().getBrandId());
jsonObject.put("operatorId", dataApi.getLoginInfo().getAdminId());
dataApi.doRequest(RequestType.JSON, dataparams, jsonObject.toJSONString(), dataheadrs).assetsSuccess(true);
JSONObject response=dataApi.getBodyInJSON();
......@@ -235,9 +235,9 @@ public JSONObject membercardsearch( DataUserInfo...dataUserInfos) {
JSONObject jsonObject = new JSONObject();
jsonObject.put("id", id);
jsonObject.put("studioId", xmAppApi.getLoginInfo().getStudioId());
jsonObject.put("brandId", xmAppApi.getLoginInfo().getBrandId());
jsonObject.put("operatorId", xmAppApi.getLoginInfo().getAdminId());
jsonObject.put("studioId", dataApi.getLoginInfo().getStudioId());
jsonObject.put("brandId", dataApi.getLoginInfo().getBrandId());
jsonObject.put("operatorId", dataApi.getLoginInfo().getAdminId());
dataApi.doRequest(RequestType.JSON, dataparams, jsonObject.toJSONString(), dataheadrs).assetsSuccess(true);
JSONObject response = dataApi.getBodyInJSON();
......@@ -296,9 +296,9 @@ public JSONObject membercardsearch( DataUserInfo...dataUserInfos) {
jsonObject.put("benefitId", benefitId);
jsonObject.put("memberCardId", memberCardId);
jsonObject.put("memo", "自动化手动扣次");
jsonObject.put("operatorId", xmAppApi.getLoginInfo().getAdminId());
jsonObject.put("brandId", xmAppApi.getLoginInfo().getBrandId());
jsonObject.put("studioId", xmAppApi.getLoginInfo().getStudioId());
jsonObject.put("operatorId", dataApi.getLoginInfo().getAdminId());
jsonObject.put("brandId", dataApi.getLoginInfo().getBrandId());
jsonObject.put("studioId", dataApi.getLoginInfo().getStudioId());
dataApi.doRequest(RequestType.JSON, dataparams, jsonObject.toJSONString(), dataheadrs).assetsSuccess(true);
JSONObject response=dataApi.getBodyInJSON();
......@@ -323,9 +323,9 @@ public JSONObject membercardsearch( DataUserInfo...dataUserInfos) {
jsonObject.put("size",20);
jsonObject.put("benefitId",benefitId);
jsonObject.put("memberCardId",memberCardId);
jsonObject.put("brandId",xmAppApi.getLoginInfo().getBrandId());
jsonObject.put("studioId",xmAppApi.getLoginInfo().getStudioId());
jsonObject.put("operatorId",xmAppApi.getLoginInfo().getAdminId());
jsonObject.put("brandId",dataApi.getLoginInfo().getBrandId());
jsonObject.put("studioId",dataApi.getLoginInfo().getStudioId());
jsonObject.put("operatorId",dataApi.getLoginInfo().getAdminId());
dataApi.doRequest(RequestType.JSON, dataparams, jsonObject.toJSONString(), dataheadrs).assetsSuccess(true);
JSONObject response=dataApi.getBodyInJSON();
......@@ -351,9 +351,9 @@ public JSONObject membercardsearch( DataUserInfo...dataUserInfos) {
jsonObject.put("memo","自动化修改会员卡有效期");
jsonObject.put("benefitId",benefitId);
jsonObject.put("memberCardId",memberCardId);
jsonObject.put("brandId",xmAppApi.getLoginInfo().getBrandId());
jsonObject.put("studioId",xmAppApi.getLoginInfo().getStudioId());
jsonObject.put("operatorId",xmAppApi.getLoginInfo().getAdminId());
jsonObject.put("brandId",dataApi.getLoginInfo().getBrandId());
jsonObject.put("studioId",dataApi.getLoginInfo().getStudioId());
jsonObject.put("operatorId",dataApi.getLoginInfo().getAdminId());
dataApi.doRequest(RequestType.JSON, dataparams, jsonObject.toJSONString(), dataheadrs).assetsSuccess(true);
JSONObject response=dataApi.getBodyInJSON();
......@@ -379,9 +379,9 @@ public JSONObject membercardsearch( DataUserInfo...dataUserInfos) {
jsonObject.put("memo","自动化停卡");
jsonObject.put("benefitId",benefitId);
jsonObject.put("memberCardId",memberCardId);
jsonObject.put("brandId",xmAppApi.getLoginInfo().getBrandId());
jsonObject.put("studioId",xmAppApi.getLoginInfo().getStudioId());
jsonObject.put("operatorId",xmAppApi.getLoginInfo().getAdminId());
jsonObject.put("brandId",dataApi.getLoginInfo().getBrandId());
jsonObject.put("studioId",dataApi.getLoginInfo().getStudioId());
jsonObject.put("operatorId",dataApi.getLoginInfo().getAdminId());
dataApi.doRequest(RequestType.JSON, dataparams, jsonObject.toJSONString(), dataheadrs).assetsSuccess(true);
JSONObject response=dataApi.getBodyInJSON();
......@@ -405,9 +405,9 @@ public JSONObject membercardsearch( DataUserInfo...dataUserInfos) {
jsonObject.put("memberCardId",memberCardId);
jsonObject.put("current",0);
jsonObject.put("size",20);
jsonObject.put("brandId",xmAppApi.getLoginInfo().getBrandId());
jsonObject.put("studioId",xmAppApi.getLoginInfo().getStudioId());
jsonObject.put("operatorId",xmAppApi.getLoginInfo().getAdminId());
jsonObject.put("brandId",dataApi.getLoginInfo().getBrandId());
jsonObject.put("studioId",dataApi.getLoginInfo().getStudioId());
jsonObject.put("operatorId",dataApi.getLoginInfo().getAdminId());
dataApi.doRequest(RequestType.JSON, dataparams, jsonObject.toJSONString(), dataheadrs).assetsSuccess(true);
JSONObject response=dataApi.getBodyInJSON();
......
......@@ -8,6 +8,7 @@ import com.xiaomai.enums.Terminal;
import com.xiaomai.utils.XMJSONPath;
import org.testng.Assert;
import org.testng.annotations.AfterClass;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
......@@ -58,7 +59,7 @@ public class TestCreateCampRuleSchedule extends SelectTargetTrainingCampAndGetIn
ruldId=XMJSONPath.getJSONArrayByReadPath(dataApi.getApi_response(),"$.result").getJSONObject(0).getString("ruleId");
}
@AfterClass(description = "删除此case创建的训练营排课日程和训练营活动")
@AfterTest(description = "删除此case创建的训练营排课日程和训练营活动")
public void delData() {
//直接删除训练营会的,对应的排课日程会被自动删除,校验其他case中已有
if (null!=campId||!campId.isEmpty()) {
......
......@@ -9,6 +9,7 @@ import com.xiaomai.utils.CommUtil;
import com.xiaomai.utils.XMJSONPath;
import org.testng.Assert;
import org.testng.annotations.AfterClass;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
......@@ -110,7 +111,7 @@ public class TestDelCampScheduleItem extends SelectTargetTrainingCampAndGetInfo{
}
@AfterClass(description = "删除此case创建的训练营排课日程")
@AfterTest(description = "删除此case创建的训练营排课日程")
public void delData() {
//先删除规则,再操作删除对应的训练营活动,此处顺序不能换,如果先删除训练营活动,对应的排课会自动删除,所以就不用删除排课日程了,这个场景其他case中会体现
if (null!=ruldId||!ruldId.isEmpty()) {
......
......@@ -15,6 +15,7 @@ import com.xiaomai.utils.CommUtil;
import com.xiaomai.utils.XMJSONPath;
import org.testng.Assert;
import org.testng.annotations.AfterClass;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
......@@ -157,7 +158,7 @@ public class TestEditCampRuleSchedule extends SelectTargetTrainingCampAndGetInfo
}
@AfterClass(description = "删除此case创建的训练营排课日程")
@AfterTest(description = "删除此case创建的训练营排课日程")
public void delData() {
if (null != ruldId || !ruldId.isEmpty()) {
campScheduleTools.delCampRuleSchedule(ruldId);
......
......@@ -11,6 +11,7 @@ import com.xiaomai.utils.CommUtil;
import com.xiaomai.utils.XMJSONPath;
import org.testng.Assert;
import org.testng.annotations.AfterClass;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
......@@ -245,7 +246,7 @@ public class TestEditCampScheduleItem extends SelectTargetTrainingCampAndGetInfo
}
@AfterClass(description = "删除此case创建的训练营排课日程")
@AfterTest(description = "删除此case创建的训练营排课日程")
public void delData() {
/* if (null != ruldId || !ruldId.isEmpty()) {
campScheduleTools.delCampRuleSchedule(ruldId);
......
......@@ -13,6 +13,7 @@ import com.xiaomai.utils.CommUtil;
import com.xiaomai.utils.XMJSONPath;
import org.testng.Assert;
import org.testng.annotations.AfterClass;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
......@@ -126,7 +127,7 @@ public class TestGetCampScheduleItemDetail extends SelectTargetTrainingCampAndGe
}
@AfterClass(description = "删除此case创建的训练营排课日程")
@AfterTest(description = "删除此case创建的训练营排课日程")
public void delData() {
if (null != orderId || !orderId.isEmpty()) {
......
......@@ -9,10 +9,7 @@ import com.xiaomai.enums.Terminal;
import com.xiaomai.utils.CommUtil;
import com.xiaomai.utils.XMJSONPath;
import org.testng.Assert;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import org.testng.annotations.*;
import javax.annotation.Resource;
import java.util.ArrayList;
......@@ -112,7 +109,7 @@ public class TestGetCampScheduleTable extends SelectTargetTrainingCampAndGetInfo
Assert.assertTrue(resultCount >= total, "查询到的课表数据和预期不一致");
}
@AfterClass(description = "删除此case创建的训练营排课日程,只操作删除对应的训练营活动即可")
@AfterTest(description = "删除此case创建的训练营排课日程,只操作删除对应的训练营活动即可")
public void delData() {
if (null!=campId||!campId.isEmpty()) {
this.getTrainingTools().deleteTraining(campId);
......
......@@ -10,6 +10,7 @@ import com.xiaomai.utils.CommUtil;
import com.xiaomai.utils.XMJSONPath;
import org.testng.Assert;
import org.testng.annotations.AfterClass;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
......@@ -80,7 +81,7 @@ public class TestDelGroupScheduleItem extends UniversalDataScheduling {
}
}
@AfterClass(description = "删除此case创建的日程")
@AfterTest(description = "删除此case创建的日程")
public void delData(){
List<String> ruleIdIds = new ArrayList<>();
//查询这个case创建的相关日程
......
......@@ -10,6 +10,7 @@ import com.xiaomai.utils.CommUtil;
import com.xiaomai.utils.XMJSONPath;
import org.testng.Assert;
import org.testng.annotations.AfterClass;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
......@@ -178,7 +179,7 @@ public class TestEditGroupSchedule extends UniversalDataScheduling {
@AfterClass(description = "删除此case创建的日程")
@AfterTest(description = "删除此case创建的日程")
public void delData(){
List<String> ruleIdIds = new ArrayList<>();
//查询这个case创建的相关日程
......
......@@ -131,7 +131,7 @@ public class TestGetGroupScheduleTable extends BaseTestImpl {
}
@AfterClass(description = "删除此case创建的日程")
@AfterTest(description = "删除此case创建的日程")
public void delData(){
List<String> ruleIdIds = new ArrayList<>();
//查询这个case创建的相关日程
......
......@@ -9,6 +9,7 @@ import com.xiaomai.utils.RandomStringUtil;
import com.xiaomai.utils.XMJSONPath;
import org.testng.Assert;
import org.testng.annotations.AfterClass;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
......@@ -76,7 +77,7 @@ public class TestDoForceOpenTraining extends BaseCreateTrainingData {
}
@AfterClass(description = "删除此case创建的训练营活动")
@AfterTest(description = "删除此case创建的训练营活动")
public void delData() {
if (!id.isEmpty()) {
trainingTools.deleteTraining(id);
......
......@@ -13,6 +13,7 @@ import com.xiaomai.utils.TimeUtils;
import com.xiaomai.utils.XMJSONPath;
import org.testng.Assert;
import org.testng.annotations.AfterClass;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import com.xiaomai.cases.polar.member.Tools;
......@@ -164,7 +165,7 @@ public class TestDoSignCampOrder extends SelectTargetTrainingCampAndGetInfo {
}
@AfterClass(description = "删除此case创建的训练营活动-退单/取消订单后可以删除活动")
@AfterTest(description = "删除此case创建的训练营活动-退单/取消订单后可以删除活动")
public void delData() {
if (!this.campId.isEmpty()) {
trainingTools.deleteTraining(this.campId);
......
......@@ -9,6 +9,7 @@ import com.xiaomai.utils.RandomStringUtil;
import com.xiaomai.utils.XMJSONPath;
import org.testng.Assert;
import org.testng.annotations.AfterClass;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
......@@ -134,7 +135,7 @@ public class TestEditTraining extends BaseCreateTrainingData {
}
@AfterClass(description = "删除此case创建的训练营")
@AfterTest(description = "删除此case创建的训练营")
public void delData() {
if (!trainingId.isEmpty()) {
trainingTools.deleteTraining(trainingId);
......
......@@ -10,10 +10,7 @@ import com.xiaomai.enums.RequestType;
import com.xiaomai.enums.Terminal;
import com.xiaomai.utils.XMJSONPath;
import org.testng.Assert;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import org.testng.annotations.*;
import javax.annotation.Resource;
import java.util.ArrayList;
......@@ -107,7 +104,7 @@ public class TestSearchTrainingAccountRecordsList extends SelectTargetTrainingCa
}
@AfterClass(description = "删除此case创建的训练营排课日程")
@AfterTest(description = "删除此case创建的训练营排课日程")
public void delData() {
orderTools.discard(orderId,"重复录入","自动化测试作废训练营订单");
if (null != this.campId || !this.campId.isEmpty()) {
......
......@@ -85,11 +85,28 @@ public class TestSignWaitingCampOrder extends SelectTargetTrainingCampAndGetInfo
//再次报名该训练营活动-报名成功
trainingTools.doSignCampOrder(memberId, this.price, this.campId);
String orderId1 = XMJSONPath.readPath(dataApi.getApi_response(), "$.result");
//报名成功后根据会员手机号,在报名会员列表搜索报名数据
trainingTools.getTrainingApplyRecordsList(this.campId, phone);
Assert.assertTrue(XMJSONPath.getJSONArrayByReadPath(dataApi.getApi_response(), "$.result").size() == 1, "给学员报名后,在报名列表没查询到数据");
Assert.assertEquals(XMJSONPath.getJSONArrayByReadPath(dataApi.getApi_response(), "$.result").getJSONObject(0).getString("state"), "PAID");
//作废订单,然后再报名,还可以报名check
orderTools.discard(orderId1,"重复录入","自动化测试作废训练营订单");
//订单作废后,学员还能继续报名check
Thread.sleep(3000);
trainingTools.doSignCampOrder(memberId, this.price, this.campId);
String orderId2 = XMJSONPath.readPath(dataApi.getApi_response(), "$.result");
//继续作废订单,然后删除训练营活动
orderTools.discard(orderId2,"重复录入","自动化测试作废训练营订单");
trainingTools.deleteTraining(campId);
}
}
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