From 2aed0857a6bfdf8daff68d1304e0adc1357aa6c9 Mon Sep 17 00:00:00 2001 From: caofengbin <1050430934@qq.com> Date: Tue, 16 May 2023 19:20:09 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=AE=9E=E7=8E=B0=E6=96=AD=E8=A8=80?= =?UTF-8?q?=E9=AA=8C=E8=AF=81(=E4=B8=8D=E7=9B=B8=E7=AD=89)=E7=9A=84agent?= =?UTF-8?q?=E9=80=BB=E8=BE=91=EF=BC=8C=E5=B9=B6=E4=B8=B0=E5=AF=8C=E5=8F=A6?= =?UTF-8?q?=E5=A4=96=E4=B8=89=E4=B8=AA=E6=96=AD=E8=A8=80=E7=B1=BB=E5=9E=8B?= =?UTF-8?q?=E7=9A=84=E8=BE=93=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../agent/tests/handlers/AndroidStepHandler.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/cloud/sonic/agent/tests/handlers/AndroidStepHandler.java b/src/main/java/org/cloud/sonic/agent/tests/handlers/AndroidStepHandler.java index aa5b2171..e248609a 100755 --- a/src/main/java/org/cloud/sonic/agent/tests/handlers/AndroidStepHandler.java +++ b/src/main/java/org/cloud/sonic/agent/tests/handlers/AndroidStepHandler.java @@ -501,19 +501,26 @@ public void locationMode(HandleContext handleContext, boolean enable) { } 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)); } @@ -2170,7 +2177,7 @@ public void runStep(JSONObject stepJSON, HandleContext handleContext) throws Thr case "locationMode" -> locationMode(handleContext, step.getBoolean("content")); case "keyCode" -> keyCode(handleContext, step.getString("content")); case "keyCodeSelf" -> keyCode(handleContext, step.getInteger("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")); From 0c887b0f23dce6e5633fd2530920fd16c0caf8da Mon Sep 17 00:00:00 2001 From: caofengbin <1050430934@qq.com> Date: Wed, 17 May 2023 14:40:50 +0800 Subject: [PATCH 2/2] =?UTF-8?q?ios=E7=AB=AF=E5=90=8C=E6=AD=A5=E6=94=AF?= =?UTF-8?q?=E6=8C=81=E6=96=AD=E8=A8=80=E4=B8=8D=E6=83=B3=E7=AD=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sonic/agent/tests/handlers/IOSStepHandler.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/cloud/sonic/agent/tests/handlers/IOSStepHandler.java b/src/main/java/org/cloud/sonic/agent/tests/handlers/IOSStepHandler.java index 8bbcffba..d42bd0e7 100755 --- a/src/main/java/org/cloud/sonic/agent/tests/handlers/IOSStepHandler.java +++ b/src/main/java/org/cloud/sonic/agent/tests/handlers/IOSStepHandler.java @@ -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)); } @@ -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"));