Closed ajaysuryavamshi closed 1 year ago
you are setting dryrun mode so it is expected to step get reported.
I even tried by setting false but still all the steps are getting executed. Can you please help me here on how to skip a specific step on a condition
It worked for me as expected. Make sure you have registered listener. Here is what i tried with: Listener class:
package com.example.common;
...
public class QAFListenerImpl extends QAFListenerAdapter {
@Override
public void beforExecute(StepExecutionTracker stepExecutionTracker) {
TestStep step = stepExecutionTracker.getStep();
//stepExecutionTracker.getScenario().getSteps()
if(stepExecutionTracker.getStep().getDescription().contains("Test Step-3")) {
getBundle().setProperty(ApplicationProperties.DRY_RUN_MODE.key, true);
}
}
@Override
public void afterExecute(StepExecutionTracker stepExecutionTracker) {
if(stepExecutionTracker.getStep().getDescription().contains("Test Step-3")) {
getBundle().setProperty(ApplicationProperties.DRY_RUN_MODE.key, false);
}
}
}
Step Implementation:
@QAFTestStep(description = "Test Step-1")
public static void step1() {
Reporter.log("Excecuted Test Step-1");
}
@QAFTestStep(description = "Test Step-2")
public static void step2() {
Reporter.log("Excecuted Test Step-2");
}
@QAFTestStep(description = "Test Step-3")
public static void step3() {
Reporter.log("Excecuted Test Step-3");
}
@QAFTestStep(description = "Test Step-4")
public static void step4() {
Reporter.log("Excecuted Test Step-4");
}
BDD file:
Scenario: Test Step SKIP
Given Test Step-1
When Test Step-2
And Test Step-3
Then Test Step-4
And Test Step-1
End
Report without listener: Commented listener registration to run without listener
# commented to run without listener
#qaf.listeners=com.example.common.QAFListenerImpl
Report with listener Registered full qualified name in properties file:
qaf.listeners=com.example.common.QAFListenerImpl
QAF Version - 2.1.14
Steps To Reproduce
Sample Config XML file
Expected behavior
Expecting Test Step-3 to be skipped
Actual behavior
Test Step-3 is getting executed
Is the issue reproducible on the runner?
Test case sample