vividus icon indicating copy to clipboard operation
vividus copied to clipboard

Composite steps not working inside conditional steps

Open vinay-kabbe opened this issue 3 years ago • 6 comments

When we create a conditional step and give a composite step inside it , the composite step does not get executed

Sample story which gives error is as below

Meta :

GivenStories: /path/to/test.story

Scenario:

test.story

Meta:

Scenario: 1.login to the application When the condition '`#{eval(${testBooleanValue} == true)}' is true I do |step| |composite step|


when we run the story the composite step does not get executed and is just printed on the console without any execution

Artifacts If applicable, add artifacts to help explain your problem:

  • Screenshots
  • Allure report
  • Test execution logs

Execution environment (please complete the following information):

  • Vividus version: [e.g. 0.4.10]
  • OS: Windows 10
  • Java: java 18.0.1.1 2022-04-22 Java(TM) SE Runtime Environment (build 18.0.1.1+2-6) Java HotSpot(TM) 64-Bit Server VM (build 18.0.1.1+2-6, mixed mode, sharing)

vinay-kabbe avatar Aug 08 '22 13:08 vinay-kabbe

@vinay-kabbe most probably you're facing known issue: https://github.com/vividus-framework/vividus/issues/1746. In order to debug your case could you please describe how variable ${testBooleanValue} is initialized?

valfirst avatar Aug 08 '22 13:08 valfirst

@vinay-kabbe if your variable is true or false you can use it without eval

When the condition '${testBooleanValue}' is true I do
|step|
|composite step|

ikalinin1 avatar Aug 08 '22 14:08 ikalinin1

@vinay-kabbe most probably you're facing known issue: #1746. In order to debug your case could you please describe how variable ${testBooleanValue} is initialized?

the variable testBooleanValue is initialized in the property file from where it is directly read into the story

vinay-kabbe avatar Aug 09 '22 06:08 vinay-kabbe

@vinay-kabbe if your variable is true or false you can use it without eval

When the condition '${testBooleanValue}' is true I do
|step|
|composite step|

I tried doing this but no change in behaviour , it still does not execute the composite step

vinay-kabbe avatar Aug 09 '22 06:08 vinay-kabbe

the variable testBooleanValue is initialized in the property file from where it is directly read into the story

@vinay-kabbe could you please provide your test execution logs and report, or create Short, Self Contained, Correct (Compilable), Example

valfirst avatar Aug 09 '22 06:08 valfirst

the variable testBooleanValue is initialized in the property file from where it is directly read into the story

@vinay-kabbe could you please provide your test execution logs and report, or create Short, Self Contained, Correct (Compilable), Example

I have created a short example using google which demonstrates the problem that I am facing. Please have a look at it , the composite step is not executed if it is inside a conditional step vividus-starter.zip Below is the allure report for the story which I ran in the above project allure-report-for-google-scenario.zip

vinay-kabbe avatar Aug 09 '22 13:08 vinay-kabbe

@valfirst : what is the priority for this bug and what is the ETA? Do let me know if you need anything else from my side

vinay-kabbe avatar Aug 11 '22 13:08 vinay-kabbe

@vinay-kabbe

  1. The original scenario has typo:
... '>>>`<<<#{eval(...

remove backtick ` and everything will work

  1. The provided test project also has the same typos:
When the condition '`#{eval(${isEnteredText} == true)}`' is true I do

It must be either

When the condition '#{eval(${isEnteredText} == true)}' is true I do

or

When the condition `#{eval(${isEnteredText} == true)}` is true I do
  1. Also Ivan's suggestion works perfectly:
When the condition '${isEnteredText}' is true I do
|step|
|composite step|

valfirst avatar Aug 12 '22 15:08 valfirst