Allen Roulston
Allen Roulston

Reputation: 307

Is it possible to use Cucumber to test an existing Rails Application?

I have just finished reading many different web pages on the subject of Cucumber. It appears to be impossible to use Cucumber to test an existing Ruby on Rails application. I'm just asking in case I missed something. (We are considering using it for future RoR app development.)

While I am asking, what is the current consensus on the best tool to test an existing Ruby on Rails application?

I did a little exploration with WATIR and it seems easy to use, but driving the web browser results in being not scalable. I have read some have moved from WATIR to Celerity....

However, I am in an environment where we are starting from zero previous testing. What is the 'best' choice to quickly write tests for an existing Ruby on Rails application?

Upvotes: 1

Views: 697

Answers (2)

vijay chouhan
vijay chouhan

Reputation: 1012

Cucumber is able to test an existing application.

You have to set configuration setting for cucumber and generate cucumber folder by rails g cucumber

before run this command you have to include gem: gem 'cucumber'.

Upvotes: 0

varatis
varatis

Reputation: 14740

In no way is Cucumber unable to test an existing application. Not sure what gave you this idea, but perhaps because it's typically used with test-driven development?

Cucumber is by far the most widely used integration testing software for Rails. I would definitely suggest using Cucumber with Capybara, Guard, Spork, and RSpec for your testing suite. (RSpec for unit testing, Capybara for integration tests, Guard and Spork for running your tests quickly).

If you've never looked at Cucumber before, you might want to take a look at some tutorials first.

To get started on your project, try to make a Cucumber feature for a simple feature. For example, write a test to visit the homepage. Something like:

Feature: View homepage
   Given I am on the profile page
   When I click "home"
   Then I should see the homepage logo

Once you've understood that, move on to more complicated features. Examples might include create a user account, login, view a profile, etc. (I don't know what your application does but I think you get the point.)

Upvotes: 3

Related Questions