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 8995079
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T23:34:14+00:00 2026-06-15T23:34:14+00:00

I’m building a Ruby command-line program, and using Cucumber and Aruba to test it.

  • 0

I’m building a Ruby command-line program, and using Cucumber and Aruba to test it. Aruba includes some really handy matchers, so I can test output with a few lines in the .feature file:

When I run `myprogram`
Then it should pass with:
  """
  my program output
  """

The problem is that my program may contain dozens or even hundreds of lines of output; putting all that in the .feature file will make it harder to read and navigate (and is kind of obnoxious). What’s the recommended way to test the output in such a case?

  • 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-06-15T23:34:16+00:00Added an answer on June 15, 2026 at 11:34 pm

    The short answer is: you should not do that.

    Cucumber tests are supposed to be user-facing and readable. They describe features. A user isn’t going to care if error output matches some known value byte for byte.

    You need to ask yourself: What am I testing? Is the answer the error message? Probably not. You’re testing some functionality in your application. If all you really want to ensure it fails, then what you want in your Cucumber scenario is the following line:

    Then the exit status should not be 0
    

    This assumes the script follows the standard convention that a non-zero exit status signals an error.

    If your scenario requires that there be a certain message in the output, you can add it:

    Then it should fail with
    """
    Some error message
    """
    

    but this need not be the entire output, only a partial match. (Note that there’s a “it should fail with exactly:” defined in aruba, but I don’t recommend using it.)

    Edit: You’ve changed your example to be testing for a pass rather than a fail, but my basic advice is the same:

    1. Separate the specifics of the output from the logic of the scenario. Using the example in the comments, if you have a test that confirms you can output a single user-generated comment, and another test that confirms you have output the correct 100 comments, then it is sufficient, you don’t need to have 100 comments’ worth of output in the Cucumber scenario.
    2. Keep the Cucumber scenarios written from the user’s perspective. Each scenario should test something that will be important to the user. Try to keep them minimal by removing anything that leaks in from the implementation when the user wouldn’t care.
    3. Use the built-in Aruba constructs that test for partial matches to achieve this. Look for key words or phrases in the output. Not only will the Cucumber tests be easier to read, they’ll be more robust and immune to unrelated output changes.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We're building an app, our first using Rails 3, and we're having to build
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
For some reason, after submitting a string like this Jack’s Spindle from a text
I am reading a book about Javascript and jQuery and using one of the
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
We are using XSLT to translate a RIXML file to XML. Our RIXML contains

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.