Forum Discussion

osvarto's avatar
osvarto
Occasional Visitor
4 years ago

Dynamic values in feature file

So I want to be able to implement dynamic data in a feature file based on what envrionment we are running the cucumber test suite. I would like to be able to pull the data from a properties file.

 

I found this stack overflow solution but the data is still hard coded.

How to implement different data for cucumber scenarios based on environment - Stack Overflow

 

``

@dev_env
Scenario: Search by Author
//hardcoded When I search for "Leo Tolstoy" books
// what I am trying to do
When I search for {dev-valid-book-from-dev-prop-file} Then I should get result "3" @qa_env Scenario: Search by Author
//hardcoded When I search for "Stephen King" books
// what I am trying to do
When I search for {qa-valid-book-from-qa-prop-file} Then I should get result "5"

``

Is it possible to load data dynamically into a features file?

  • aslakhellesoy's avatar
    aslakhellesoy
    SmartBear Alumni (Retired)

    That's not supported. If you want dynamic data you have to handle this in your step definitions.