From: Steve Tuckner Date: 2003-11-04T04:47:46+09:00 Subject: Test/Unit question This is a multi-part message in MIME format. ------=_NextPart_000_0211_01C3A211.0AC767D0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Is there any easy way to have a test/unit failure display the call stack of the failure? Typically it displays the test name and test case but not where in the test function exactly if the assertion was in a function called by test function. So if my test case is as below: require "test/unit" class SillyTest < Test::Unit::TestCase def check_result(x1, x2, y1, y2) assert_equal(x1, x2) assert_equal(y1, y2) end def test_values_1 check_result(1,2,3,4) check_result(1,2,4,5) end def test_values_2 check_result(1,2,4,5) check_result(1,2,5,6) end end and my output is: 1) Failure!!! test_values_1(SillyTest) [SillyTest.rb: 5]: <1> expected but was <2> I don't know where the failure originated in the test case. It could be line 10 or 11. Thanks for a great tool! Steve Tuckner ------=_NextPart_000_0211_01C3A211.0AC767D0 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
Is = there any easy=20 way to have a test/unit failure display the call stack of the failure? = Typically=20 it displays the test name and test case but not where in the = test function=20 exactly if the assertion was in a function called by test function. So = if my=20 test case is as below:
 
require=20 "test/unit"
 
class = SillyTest <=20 Test::Unit::TestCase
    def check_result(x1, x2, y1, y2)
       =20 assert_equal(x1, x2)
       =20 assert_equal(y1, y2)
    = end
 
    def test_values_1
       =20 check_result(1,2,3,4)
       =20 check_result(1,2,4,5)
    = end
 
    def test_values_2
       =20 check_result(1,2,4,5)
       =20 check_result(1,2,5,6)
    = end
end
 
and = my output=20 is:
 
  1)=20 Failure!!!
test_values_1(SillyTest) [SillyTest.rb: 5]:
<1> = expected=20 but was
<2>
 
I don't know=20 where the failure originated in the test case. It could be line 10 or=20 11.
 
Thanks for a great=20 tool!
 
Steve Tuckner =
------=_NextPart_000_0211_01C3A211.0AC767D0--