Commit 84115892 authored by 马博's avatar 马博

update

parent fdecc52f
......@@ -71,6 +71,7 @@ public class 修改兑吧商品_ExchangeTest extends DuibaTestBase {
//编辑
doUpdateAppItemService.doUpdateAppItem(appId,appItemId,title,"10","coupon","31658");
Response response2=developerObjectService.editAppItem2(appItemId);
System.out.println(response2.asString());
Assert.assertEquals(response2.jsonPath().getString("data.title"), "【SaaS-自动化测试】优惠券勿动", "校验兑吧优惠券商品标题失败");
Assert.assertEquals(response2.jsonPath().getString("data.credits"), "10", "校验兑吧优惠券商品失败");
......
......@@ -489,6 +489,11 @@ public class 新集卡_开奖流程_DuibaTest extends DuibaTestBase {
}
return statusResponse;
}
// @Test
public void test() throws Exception {
Response response = openPrize("5193",2691,"nomal");
response.prettyPrint();
}
......
......@@ -171,6 +171,7 @@ public class 秒杀自有老虚拟商品_兑换限制_SeckillTest extends DuibaT
queryResponse.prettyPrint();
// if(queryResponse.asString().contains("好可惜,没抢到"))return;
String orderId = MatcherString.getString(queryResponse.asString(),"orderId: '(.*?)'",1);
......
package http.cases.SignTest;
import base.DuibaTestBase;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import http.service.Activity.ManagerService;
import http.service.Authorization;
import http.service.hd.SigninService;
......@@ -12,10 +14,9 @@ import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.*;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.CountDownLatch;
public class ContractSign_Cash_signTest extends DuibaTestBase {
@Autowired
......@@ -175,11 +176,44 @@ public class ContractSign_Cash_signTest extends DuibaTestBase {
Assert.assertEquals(doneStatus, "WAIT_REWARD", "当前期次完成状态不正确");
String winCount = recordRes.jsonPath().getString("data.list[0].winCount");
Assert.assertEquals(winCount, "33333", "瓜分奖励金额不正确");
//领奖
//领奖-并发
CountDownLatch latch = new CountDownLatch(5);
List<String> list = new CopyOnWriteArrayList();
for (int i = 0; i < 5; i++) {
new Thread(() -> {
try {
Response rewardRes = ContractSignService.getReward(contractId1,uid1);
String rewardStatus = rewardRes.jsonPath().getString("success");
String rewardAmount = rewardRes.jsonPath().getString("data");
list.add(rewardRes.asString());
} catch (Exception e) {
e.printStackTrace();
}
latch.countDown();
}).start();
}
latch.await();
int fail=0,success=0;
JSONObject json=null;
for (String s:
list) {
if(s.contains("操作太频繁啦,稍后再试")){
fail++;
}else{
success++;
json = JSON.parseObject(s);
}
}
String rewardAmount = json.getString("data");
String rewardStatus = json.getString("success");
Assert.assertEquals(rewardStatus,"true","领取奖励结果不正确");
Assert.assertEquals(rewardAmount,winCount,"领取奖励金额不正确");
Assert.assertEquals(fail,4);
}
}
......@@ -14,10 +14,8 @@ import io.restassured.response.Response;
import java.net.SocketImpl;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.*;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.ExecutionException;
import utils.RedisUtil;
......@@ -361,7 +359,27 @@ public class ContractSign_Multi_signTest extends DuibaTestBase {
rewardRes = ContractSignService.getReward(contractId4,uid4);
rewardCount = rewardRes.jsonPath().getInt("data");
Assert.assertEquals(rewardCount, 4125, "uid4领取奖励数不正确");
List<String> list = new CopyOnWriteArrayList<>();
// uid6领奖
// for (int i = 0; i < 20; i++) {
// new Thread(() -> {
// try {
// Response rewardRess = ContractSignService.getReward(contractId6, uid6);
// list.add(rewardRess.asString());
// } catch (Exception e) {
// e.printStackTrace();
// }
//
//
// }).start();
//
// }
// Thread.sleep(20000);
// for (String s:
// list) {
// System.out.println(s);
// }
rewardRes = ContractSignService.getReward(contractId6,uid6);
rewardCount = rewardRes.jsonPath().getInt("data");
Assert.assertEquals(rewardCount, 825, "uid6领取奖励数不正确");
......@@ -373,6 +391,12 @@ public class ContractSign_Multi_signTest extends DuibaTestBase {
String desc = rewardRes.jsonPath().getString("desc");
Assert.assertEquals(success, "false", "uid1领取结果不正确");
Assert.assertEquals(desc,"领奖处理失败","uid1领取描述不正确");
rewardRes = ContractSignService.getReward(contractId6,uid6);
rewardRes.prettyPrint();
}
//@Test(description = "多梯度中奖轮播",priority = 7,dependsOnMethods = { "多梯度领奖" })
......
......@@ -207,13 +207,13 @@ public class ContractSignService {
map.put("contractId", ContractId);
logger.info("请求getReward接口,契约id=" + ContractId);
Response response = given().cookies(authorization.dafuwengLogin(uid)).params(map).post(activityHost+"/sign/contract/getReward");
try{
Assert.assertEquals(response.jsonPath().getString("success"), "true", "/sign/contract/getReward接口请求失败");
} catch (Exception e) {
throw new Exception("/sign/contract/getReward接口失败,返回信息" + response.asString());
} catch (Error er) {
throw new Exception("/sign/contract/getReward接口失败,返回信息:" + response.asString());
}
// try{
// Assert.assertEquals(response.jsonPath().getString("success"), "true", "/sign/contract/getReward接口请求失败");
// } catch (Exception e) {
// throw new Exception("/sign/contract/getReward接口失败,返回信息" + response.asString());
// } catch (Error er) {
// throw new Exception("/sign/contract/getReward接口失败,返回信息:" + response.asString());
// }
return response;
}
......
This diff is collapsed.
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