From bb0aa309a7480012aaae4f4e66cdb264184e06bc Mon Sep 17 00:00:00 2001 From: Ashish Date: Sun, 1 Sep 2024 18:50:44 +0200 Subject: [PATCH] Fixed retry failed test cases via Command line --- Engine/src/main/java/com/ing/engine/cli/CLI.java | 4 ++-- .../java/com/ing/engine/commands/Assertions.java | 5 +++-- .../src/main/java/com/ing/engine/core/Control.java | 14 +++++--------- .../components/testexecution/tree/TestSetTree.java | 2 +- 4 files changed, 11 insertions(+), 14 deletions(-) diff --git a/Engine/src/main/java/com/ing/engine/cli/CLI.java b/Engine/src/main/java/com/ing/engine/cli/CLI.java index 7caea92..884fe10 100644 --- a/Engine/src/main/java/com/ing/engine/cli/CLI.java +++ b/Engine/src/main/java/com/ing/engine/cli/CLI.java @@ -83,7 +83,7 @@ static void createStandaloneReport() { static void reRun() { try { - Control.call(true); + Control.call(); } catch (UnCaughtException ex) { Logger.getLogger(CLI.class.getName()).log(Level.SEVERE, null, ex); } @@ -115,7 +115,7 @@ static void executeWith(Map execution) { } if (execution.containsKey(Op.RUN)) { try { - Control.call(true); + Control.call(); } catch (UnCaughtException ex) { Logger.getLogger(CLI.class.getName()).log(Level.SEVERE, null, ex); } diff --git a/Engine/src/main/java/com/ing/engine/commands/Assertions.java b/Engine/src/main/java/com/ing/engine/commands/Assertions.java index 2d5c787..0ecf22f 100644 --- a/Engine/src/main/java/com/ing/engine/commands/Assertions.java +++ b/Engine/src/main/java/com/ing/engine/commands/Assertions.java @@ -694,11 +694,12 @@ public void assertVariable() throws RuntimeException { if (strAns.equals(strTemp[1])) { System.out.println("Condition '" + Input + "' is true "); Report.updateTestLog("assertVariable", - "Variable matched with Provided data", Status.PASS); + "Variable value matches with provided data "+strTemp[1], Status.PASSNS); } else { System.out.println("Condition '" + Input + "' is false "); - throw new Exception("Variable did not match with provided data"); + Report.updateTestLog("assertVariable", + "Variable value is "+strAns+" but expected value is "+strTemp[1], Status.FAILNS); } } catch (Exception ex) { Logger.getLogger(this.getClass().getName()).log(Level.SEVERE, null, ex); diff --git a/Engine/src/main/java/com/ing/engine/core/Control.java b/Engine/src/main/java/com/ing/engine/core/Control.java index 6f8d09d..7df1523 100644 --- a/Engine/src/main/java/com/ing/engine/core/Control.java +++ b/Engine/src/main/java/com/ing/engine/core/Control.java @@ -8,7 +8,6 @@ import com.ing.engine.constants.FilePath; import com.ing.engine.constants.SystemDefaults; import com.ing.engine.drivers.PlaywrightDriver; -import com.ing.engine.drivers.WebDriverFactory; import com.ing.engine.execution.exception.UnCaughtException; import com.ing.engine.execution.run.ProjectRunner; @@ -42,13 +41,11 @@ public class Control { private static PlaywrightDriver playwrightDriver; - private static void start(Boolean quit) { + private static void start() { do { Control control = new Control(); control.startRun(); control.resetAll(); - if(quit) - System.exit(0); } while (exe.retryExecution()); ConsoleReport.reset(); @@ -57,15 +54,15 @@ private static void start(Boolean quit) { public static void call(Project project) throws UnCaughtException { RunManager.init(); exe = ProjectRunner.load(project); - start(false); + start(); } - public static void call(Boolean quit) throws UnCaughtException { + public static void call() throws UnCaughtException { RunManager.init(); if (exe == null) { exe = ProjectRunner.load(RunManager.getGlobalSettings().getProjectPath()); } - start(quit); + start(); } public static Project getCurrentProject() { @@ -213,8 +210,7 @@ public static void main(String[] args) throws UnCaughtException { if (args != null && args.length > 0) { LookUp.exe(args); } else { - if( Arrays.asList(args).contains("quit")) - call(true); + call(); } } diff --git a/IDE/src/main/java/com/ing/ide/main/mainui/components/testexecution/tree/TestSetTree.java b/IDE/src/main/java/com/ing/ide/main/mainui/components/testexecution/tree/TestSetTree.java index 8ccb2ad..7ef0782 100644 --- a/IDE/src/main/java/com/ing/ide/main/mainui/components/testexecution/tree/TestSetTree.java +++ b/IDE/src/main/java/com/ing/ide/main/mainui/components/testexecution/tree/TestSetTree.java @@ -477,7 +477,7 @@ private String getBatRCommand() { if (os.contains("windows")) { return "Run.bat"; } - return "Run.command"; + return "./Run.command"; } private void getAzDoYaml() {