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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T10:52:08+00:00 2026-05-27T10:52:08+00:00

In Ruby’s test/unit, and other such nunit style frameworks, what makes a good failure

  • 0

In Ruby’s test/unit, and other such nunit style frameworks, what makes a good failure message?

Should the failure message merely describe how the expected value does not match the expected value?

assert_match("hey", "hey this is a test", "The word does not exist in the string")

Should it describe what you expected to happen?

assert_match("hey", "hey this is a test", "I expected hey to be in the string")

Should it describe why you wanted the behavior to happen?

assert_match("hey", "hey this is a test", "Program should provide a greeting")

Should it describe why you thought the test may fail?

assert_match("konnichiwa", "konnichiwa this is a test",
  "Program failed to use supplied i18n configuration")

Should information about tests also exist in the name of the test method, and in the name of the test case?

This is based on Ruby "test/unit" , how do I display the messages in asserts

  • 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-27T10:52:08+00:00Added an answer on May 27, 2026 at 10:52 am

    the failure message is supposed to add context to the failure message. So anything that saves you having to drill into the test code to know what failed.

    So if the [method name, expected, actual] set is adequate for the above purpose, you can skip the failure message. If you need more information, then you add the optional failure message.

    e.g.
    Expected true but was false, doesn’t tell me anything.

    You can use a failure message so that
    Return value should contain only multiples of 10. Expected true but was false

    You can first try to use more descriptive matchers.
    So that failures read Expected all items to be divisible by 10 but was [10,20,35,40] does.

    Personally I prefer matchers… use failure messages as the last resort. (because like comments, it decays. You need discipline to ensure that the failure message is updated if you change the check.)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Ruby can add methods to the Number class and other core types to get
Ruby definitely stores such information at runtime, as it is printed in stack traces
ruby-1.9.2-p180 :154 > a = [] => [] ruby-1.9.2-p180 :154 > h = {:test
Using ruby(1.8.7) , rails(2.3.8) , rspec(1.3.1) and rspec-rails(1.3.3) how do I test a method
Ruby, Java, and Python all have several very good libraries which allow you to
Ruby has two different exceptions mechanisms: Throw/Catch and Raise/Rescue. Why do we have two?
Ruby setters—whether created by (c)attr_accessor or manually—seem to be the only methods that need
Ruby's standard popen3 module does not work on Windows. Is there a maintained replacement
Ruby has a wealth of conditional constructs, including if / unless , while /
Ruby on Rails does not do multithreaded request-responses very well, or at least, ActiveRecord

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.