Tutorial :Rails unit tests: How to add my own output to unit test results


When running Rails unit tests I get output specifying line numbers and methods when a test fails, e.g.:

  1) Failure:  test_05_photo_tag_add_remove(TC_javascript02Test)      [./helper/helper.rb:6:in `handle_assert'       ./helper/helper.rb:17:in `check_not_string'       ./helper/helper.rb:134:in `check_for_ajax_remove_string'       javascript.rb:39:in `test_05_photo_tag_add_remove']:  <false> is not true.  

Is it possible to dd my own text to this stack?

Thanks in advance Peter


Most assertions take a message parameter, for example:

assert_equal 64, obj.size, "Size should be 64"  

If the assertion fails, the message will be displayed in addition to the usual test output.

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »