dimanche 2 août 2020

when Cucumber values are defined at the end of scenario outline, get an error

I'm trying to set a test with Cucumber. I need the same value in two steps

This doesn't work:

Scenario Outline: print to screen 
Then print a <filename> to screen
Then print again the <filename> and extension <extension> to screen
Examples:
      | filename| extension |
      | abcd    | txt  |

The error i get:

io.cucumber.core.exception.CucumberException: Step [A] is defined with 1 parameters at xxxxxx(java.lang.String)'.
However, the gherkin step has 0 arguments.

Basically says that i must have at least one parameter in the first step..

This works:

Scenario Outline: print to screen
Then print a <filename> to screen
Examples:
      | filename |
      | abcd  |
Then print again the <filename> and extension <extension> to screen
Examples:
      | filename | extension |
      | abcd     | txt  |

I followed this example: https://www.baeldung.com/cucumber-scenario-outline#rewriting-features-using-scenario-outlines

thanks..

Aucun commentaire:

Enregistrer un commentaire