Reputation: 416
I've been trying cucumber to create new features for our project, but it's been very hard to find a way to run the tests against real data. I have to create entities of everything with Factory Girl in order to run them properly, am I doing it wrong? Or cucumber it's only to do every flow step by step, creating fake data? Will I be better off trying the Steak approach? (Rspec-Capybara)?
Please let me know if someone has faced this issue when having a project already running with a bunch of features and you are adding the TDD-BDD to your duties.
Upvotes: 1
Views: 742
Reputation: 7196
The point of FactoryGirl and other fixture libraries is to produce data without relying on production imports. Importing data from production to run your tests suggests that the behaviour you are testing for is not actually the behaviour that is occurring in production.
New or old functionality, if your behaviour is known then define it with cucumber. Start small, select a piece of functionality that is simple and create your .feature
file. Define you step_definitions on what you know to be the correct behaviour. Then if your tests fail then fix it in your application code rather than cucumber.
Ensure that your step definitions are doing black box tests. They don't need to know the internal state of the function they are testing, they only want to work with the known inputs and test the result.
Upvotes: 1