Skip to content

Commit

Permalink
ios端同步支持断言不想等
Browse files Browse the repository at this point in the history
  • Loading branch information
caofengbin committed May 17, 2023
1 parent 2aed085 commit 0c887b0
Showing 1 changed file with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -389,19 +389,26 @@ public void unLock(HandleContext handleContext) {
}

public void asserts(HandleContext handleContext, String actual, String expect, String type) {
handleContext.setDetail("真实值: " + actual + " 期望值: " + expect);
handleContext.setStepDes("");
try {
switch (type) {
case "assertEquals" -> {
handleContext.setDetail("真实值: " + actual + " 期望等于: " + expect);
handleContext.setStepDes("断言验证(相等)");
assertEquals(actual, expect);
}
case "assertNotEquals" -> {
handleContext.setDetail("真实值: " + actual + " 期望不等于: " + expect);
handleContext.setStepDes("断言验证(不相等)");
assertNotEquals(actual, expect);
}
case "assertTrue" -> {
handleContext.setDetail("真实值: " + actual + " 期望包含: " + expect);
handleContext.setStepDes("断言验证(包含)");
assertTrue(actual.contains(expect));
}
case "assertNotTrue" -> {
handleContext.setDetail("真实值: " + actual + " 期望不包含: " + expect);
handleContext.setStepDes("断言验证(不包含)");
assertFalse(actual.contains(expect));
}
Expand Down Expand Up @@ -1488,7 +1495,7 @@ public void runStep(JSONObject stepJSON, HandleContext handleContext) throws Thr
case "lock" -> lock(handleContext);
case "unLock" -> unLock(handleContext);
case "keyCode" -> keyCode(handleContext, step.getString("content"));
case "assertEquals", "assertTrue", "assertNotTrue" -> {
case "assertEquals", "assertNotEquals", "assertTrue", "assertNotTrue" -> {
String actual = TextHandler.replaceTrans(step.getString("text"), globalParams);
String expect = TextHandler.replaceTrans(step.getString("content"), globalParams);
asserts(handleContext, actual, expect, step.getString("stepType"));
Expand Down

0 comments on commit 0c887b0

Please sign in to comment.