Sunday, 15 July 2012

Using variable values within different scenarios in a feature, capybara -


I have a feature with 4 scenarios, I want to use the value of 1 variable which is different steps in landscape 1 I set in and in scenario 2.

I use $ but this is not set I agree that $ value remains the same in a feature

  when the user goes to the user, then One / one / / /) of the secondary users Click_Link "Admin" click_link "Manage Users" Emailofuser = ENV ["Email"]. To_s atpos = emailofuser.index ('@') emailofuser = emailofuser [0, Eppus] page.body.to_s.scan (/ & lt; td> (. *?) @ ABC.com  

In the above step, step one feature The file is in 1 scenario and I have the same phase secondary user in Scenario 2 within a feature. Variable $ secondaryuserEmail is not set up at some time and login as a secondary user fails.

What is the best way to declare a variable for me, and in some scenarios, in a scenario, within a feature.

< P> You should find out why $ secondaryuserEmail is not set Not happen. It seems like a bug somewhere in the app you are tested. If it is not a bug, give you exception should try to HK.

For your basic question, setting the variables in helpful methods can be a good idea, then ask these methods to use the example variable to use. Most people generally recommend sharing the variables in scenarios, but during my specs, I have used helpful methods to store variables, which are usually unchanged.


No comments:

Post a Comment