I'm pretty new to BDD and Lettuce and I cam across an issue which I'm not sure how best to handle.
I want to create a Lettuce test suite which I can then run against different environments, where some parameters in the scenario would be different for each environment.
So following the Lettuce documentation I have this example scenario:
Scenario: Create correct config
Given I have IP "127.0.0.0:8000"
And I specify username "myuser" and password "mypassword"
When I connect to the server
Then I get return code 200
In this case I would have to change the IP, user and password for each environment. But this is not practical and I want to be able to have some config file which I can create for each environment and it would contain the value for these parameters.
I found out about terrain.py
and saw that you can set variables in this file which you can access from your steps.py
using world
.
So it would be possible to re-word the scenario like this:
Scenario: Create correct config
Given I have a correct IP
And I specify correct credentials
When I connect to the sever
Then I get return code 200
Now in the step definitions example for "I have a correct IP
" you can use world.correctIP
which will be defined in terrain.py
.
This would work in the way I need it to, but I'm not convinced this is the correct way to do it and if terrain.py was intended to be used like this...or is there a different way to handle this situation?