On Friday 08 August 2003 22:21, Nathaniel Talbott wrote: > Dmitry V. Sabanin [mailto:sdmitry / lrn.ru] wrote: > > I have a question about TestUnit. How can i set a human-readable name for > > my > > > TestCase? I see name argument for a new, but i don't know where class > > instance is initialized. That would be nice if i could change name of TC > > from > > > setup(). > > I'm having trouble understanding what it is you want to change the name of. > In Test::Unit, what happens is that your TestCase class is initialized once > for each test that it contains. So if you have a TestCase like this: > > class TC_Me < Test::Unit::TestCase > def test_me > end > > def test_me_too > end > end > > The framework will call the constructor of your TestCase once for each > test: > > TC_Me.new(:test_me) > TC_Me.new(:test_me_too) > > Thus, the TestCase is 'named' once for each test that it contains. > > I'm guessing that you're asking this question because you want to change > the output somehow... I might be able to help more if I can get a better > feel for what you're trying to accomplish. I want to do something similiar to, but for a test case: def self.suite suite = Test::Unit::TestSuite.new "Muravey News System Tests" end where output is: Loaded suite Muravey News System Tests Started FFF Finished in 0.008444 seconds. Now output for testcases is: 1) Failure!!! test_get_news(TC_MNS_View_News) [./tests/test_view.rb:28]: I want TC_MNS_Views_News to be replaced with my own string, like in TestSuite. If it's not possible i will live with that :) > HTH, > > > Nathaniel > > <:((>< -- sdmitry -=- Dmitry V. Sabanin MuraveyLabs.