Replacing Cucumber

Jiří Stránský jstransk at redhat.com
Thu Nov 22 10:46:56 UTC 2012


On 22.11.2012 08:42, Martin Povolny wrote:
> I suggest writing controller and view tests using RSpec and Capybara.

+1 *with a wish* :) I'll explain below.

> I accent that I do not want to rewrite anything I just want to allow
> faster creation of tests using more programmer-friendly tools to get
> better test coverage.

+1

Also I think we should consider using something that can run and test JavaScript. I'm focusing on API, so this doesn't affect my work directly, but I think it might be worth it. Maybe frontend guys can say something about this.


Now to what I mean by "+1 with a wish" :)

I like writing integration tests. I think our hate for Cucumber comes mainly from not using reusable steps much. We write the scenarios unnecessarily tediously and when something in the app changes, we might have to fix cucumbers on multiple places, instead of fixing it on one place, in some reusable step. For more explanation about what I mean, see this article [1].

So I'm fully for switching to some Ruby internal DSL [2], like RSpec + Capybara, but I'd like to have our integration tests built using more reusable steps and less repetition of "I fill this and then I see that". Here's a small example how to write reusable steps for RSpec and Capybara [3].

We already use largely reusable steps for API, I'd say, e.g. this one [4] is used across cucumber features for different API resources. Instead of checking separately for content type, then for status code and then for presence of error message, I can just write "Then I should receive a Not Found error" and I get these assertions for free. That's how I'd like our new tests to look like :)

J.

[1] http://collectiveidea.com/blog/archives/2011/06/09/reusable-cucumber-steps/
[2] http://martinfowler.com/bliki/DomainSpecificLanguage.html
[3] http://robots.thoughtbot.com/post/33771089985/rspec-integration-tests-with-capybara
[4] https://github.com/aeolusproject/conductor/blob/master/src/features/step_definitions/api_steps.rb#L100-L119



More information about the aeolus-devel mailing list