Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7166309
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T14:23:34+00:00 2026-05-28T14:23:34+00:00

I am currently trying to use cucumber together with capybara for some integration tests

  • 0

I am currently trying to use cucumber together with capybara for some integration tests of a web-app.

There is one test where I just want to click through all (or most of) the pages of the web app and see if no error is returned. I want to be able to see afterwards which pages are not working.

I think that Scenario outlines would be the best approach so I started in that way:

Scenario Outline: Checking all pages pages

   When I go on the page <page>
   Then the page has no HTTP error response

    Examples:
      | page                        |
      | "/resource1"                |
      | "/resource2"                |
      ...

I currently have 82 pages and that works fine.

However I find this approach is not maintable as there may new resources and resources that will be deleted.

A better approach would be to load the data from the table from somewhere (parsing HTML of an index page, the database etc…).

But I did not figure out how to do that.

I came across an article about table transformation but I could not figure out how to use this transformation in an scenario outline.

Are there any suggestions?

OK since there is some confusion. If you have a look at the example above. All I want to do is change it so that the table is almost empty:

Scenario Outline: Checking all pages pages

  When I go on the page <page>
  Then the page has no HTTP error response

  Examples:
    | page                        |
    | "will be generated"         |

Then I want to add a transformation that looks something like this:

Transform /^table:page$/ do
  all_my_pages.each do |page|
    table.hashes << {:page => page}
  end 
  table.hashes
end

I specified the transformation in the same file, but it is not executed, so I was assuming that the transformations don’t work with Scenario outlines.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T14:23:34+00:00Added an answer on May 28, 2026 at 2:23 pm

    Cucumber is really the wrong tool for that task, you should describe functionality in terms of features. If you want to describe behavior programmatically you should use something like rspec or test-unit.

    Also your scenario steps should be descriptive and specialized like a written text and not abstract phrases like used in a programming language. They should not include “incidental details” like the exact url of a ressource or it’s id.

    Please read http://blog.carbonfive.com/2011/11/07/modern-cucumber-and-rails-no-more-training-wheels/ and watch http://skillsmatter.com/podcast/home/refuctoring-your-cukes

    Concerning your question about “inserting into tables”, yes it is possible if you
    mean adding additional rows to it, infact you could do anything you like with it.
    The result of the Transform block completely replaces the original table.

    Transform /^table:Name,Posts$/ do
      # transform the table into a list of hashes
      results = table.hashes.map do |row|
        user = User.create! :name => row["Name"]
        posts = (1..row["Posts"]).map { |i| Post.create! :title => "Nr #{i}" }
        { :user => user, :posts => posts }
      end
      # append another hash to the results (e.g. a User "Tim" with 2 Posts)
      tim = User.create! :name => "Tim"
      tims_posts = [Post.create! :title => "First", Post.create! :title => "Second"]
      results << { :user => tim, :posts => tims_posts }
      results
    end
    
    Given /^I have Posts of the following Users:$/ do |transformation_results|
      transformation_results.each do |row|
        # assing Posts to the corresponding User
        row[:user].posts = row[:posts]
      end
    end
    

    You could combine this with Scenario Outlines like this:

    Scenario Outline: Paginate the post list of an user at 10
      Given I have Posts of the following Users:
        | Name | Posts |
        | Max  | 7     |
        | Tom  | 11    |
      When I visit the post list of <name>
      Then I should see <count> posts
    Examples:
      | name | count |
      | Max  |     7 |
      | Tom  |    10 |
      | Tim  |     2 |
    

    This should demonstarte why “adding” rows to a table, might not be best practice.

    Please note that it is impossible to expand example tags inside of a table:

    Scenario Outline: Paginate the post list of an user at 10
      Given I have Posts of the following Users:
        | Name   | Posts      |
        | <name> | <existing> | # won't work
      When I visit the post list of <name>
      Then I should see <displayed> posts
    Examples:
      | name | existing | displayed |
      | Max  |     7    |         7 |
      | Tom  |    11    |        10 |
      | Tim  |     2    |         2 |
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying out capybara with cucumber to get some better javascript test coverage. I
I am currently trying to use a web service I developed within an Integration
currently i'm trying to use imagick to generate some images without saving them on
I'm currently trying to use omniauth in my rails application. I was just curious,
I'm currently trying to use the core-plot library to graph some data I get
I'm currently trying to use the current session of a php web page from
I am currently trying to use Eclipse to develop some code that I've been
I'm currently trying to use PHPUnit to learn about Test Driven Development (TDD) and
I am currently trying to use NAnt and CruiseControl.NET to manage various aspects of
I am currently trying to use AJAX in my application via jRails. I am

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.