I have test classes that inherit a class that inherits Test::Unit::TestCase
. I overwrote the assertions so that I get output to a junit style test report for use in bamboo and jenkins. This works fine.
Now I want to catch exceptions if they occur throughout the test classes from setup, through multiple testcases and onto teardown. Outside putting in begin/resucue/end blocks in all the methods is there an easier way to do this?
there is but you need to dig (and understand some of the) Test::Unit
internals.
what you're trying to achieve is probably easiest done by patching/replacing the Test::Unit::TestCase#run method with your own. be aware that this might break between versions so be sure to make patching "smart".