开发者

ruby cucumber testing practices

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

When run together, s开发者_StackOverflow社区ome 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 ?


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


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜