From 4c37565ed9353d8d322b9ad7b819da2d49591dcd Mon Sep 17 00:00:00 2001 From: Benoit CIVEL Date: Thu, 28 Nov 2024 22:38:55 +0100 Subject: [PATCH] Condition related to execution (if action executed and returned OK....etc) > support the usage of the condition from a step library --- .../core/crud/entity/TestCaseExecution.java | 18 +++++++++++++++--- .../execution/impl/ExecutionRunService.java | 1 + 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/source/src/main/java/org/cerberus/core/crud/entity/TestCaseExecution.java b/source/src/main/java/org/cerberus/core/crud/entity/TestCaseExecution.java index be841bd0b..d3cc25bc1 100644 --- a/source/src/main/java/org/cerberus/core/crud/entity/TestCaseExecution.java +++ b/source/src/main/java/org/cerberus/core/crud/entity/TestCaseExecution.java @@ -141,6 +141,7 @@ public class TestCaseExecution { private List fileList; // Host the list of Steps that will be executed (both pre tests and main test) private List testCaseStepExecutionList; + private TestCaseStepExecution testCaseStepInExecution; // Host the full list of data calculated during the execution. private TreeMap testCaseExecutionDataMap; // This is used to keep track of all property calculated within a step/action/control. It is reset each time we enter a step/action/control and the property name is added to the list each time it gets calculated. In case it was already asked for calculation, we stop the execution with FA message. @@ -339,9 +340,20 @@ public TestCaseStepExecution getTestCaseStepExecutionBySortId(int sortID) { } public TestCaseStepExecution getTestCaseStepExecutionByStepId(int stepId) { - for (TestCaseStepExecution tcse : this.testCaseStepExecutionList) { - if (stepId == tcse.getTestCaseStep().getStepId()) { - return tcse; + TestCaseStepExecution tcsee = this.getTestCaseStepInExecution(); + //If step executing if from library, return the step from the library instead + if (tcsee.isUsingLibraryStep()){ + for (TestCaseStepExecution tcse : this.testCaseStepExecutionList) { + if (stepId == tcse.getTestCaseStep().getLibraryStepStepId()) { + return tcse; + } + } + return tcsee; + } else { + for (TestCaseStepExecution tcse : this.testCaseStepExecutionList) { + if (stepId == tcse.getTestCaseStep().getStepId()) { + return tcse; + } } } return null; diff --git a/source/src/main/java/org/cerberus/core/engine/execution/impl/ExecutionRunService.java b/source/src/main/java/org/cerberus/core/engine/execution/impl/ExecutionRunService.java index 5f9e758b8..b53150fa5 100644 --- a/source/src/main/java/org/cerberus/core/engine/execution/impl/ExecutionRunService.java +++ b/source/src/main/java/org/cerberus/core/engine/execution/impl/ExecutionRunService.java @@ -1018,6 +1018,7 @@ private TestCaseStepExecution executeStep(TestCaseStepExecution stepExecution, T List testCaseStepActionList = stepExecution.getTestCaseStep().getActions(); LOG.debug("{}Getting list of actions of the step. {} action(s) to perform.", logPrefix, testCaseStepActionList.size()); + execution.setTestCaseStepInExecution(stepExecution); for (TestCaseStepAction tcAction : testCaseStepActionList) { // Start Execution of TestCaseStepAction