0

I have many cucumber feature files, each consists of many scenarios.

When run together, some of them fails. When I run each single test file, they passes. I think my database is not correctly clean after each scenario.

What is the correct process to determine what is causing this behavior ?

2
  • Does this line appear in features/support/env.rb?: Cucumber::Rails::World.use_transactional_fixtures = true Commented Mar 8, 2011 at 20:13
  • @zetetic, yes it appears Commented Mar 9, 2011 at 9:40

2 Answers 2

2

By the sound of it your tests are depening upon one another. You should be trying to get each indervidual test to do what ever set up is required for that indervidual test to run.

The set up parts should be done during the "Given" part of your features. Personally, to stop the features from becoming verbose and to keep them close to the business language that they where written in, i sometimes add additional steps that are required to do the setup and call them from the steps that are in the feature file. If this makes sence to you

Sign up to request clarification or add additional context in comments.

1 Comment

My intention was to write independant test
0

This happens to me for different reasons and different times.

Sometimes its that a stub or mock is invoked in one scenario that screws up another, but only when they are both run (each is fine alone).

The only way I've been able to solve these is debugging while running enough tests to get a failure. You can drop the debugger line in step_definitions or call it as a step itself (When I call the debugger) and match that up to a step definition that just says 'debugger' as the ruby code.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.