Need help Translating Python unittest to Ruby Test::Unit 
Author Message
 Need help Translating Python unittest to Ruby Test::Unit

I need help in translating the function
"testOtherTests" and the last line from the following
python code (do not know if the Tabs will preserved by
Yahoo! email client).

To be specific, what is the equivalent of the lines:

result=unittest.TextTestRunner().run(othertests)

and

unittest.main()

in Ruby Test:Unit framework ?

Any help will be highly appreciated,
Thanks,
-- shanko

------------------ Python Code ------------------

class TestMain(unittest.TestCase):
    def setUp(self):
                                ... code for setup ...                          

    def testRemove(self):
                                ... code for this test ...

                def testOtherTests(self):
                                import test_others

othertests=unittest.TestLoader().loadTestsFromModule(test_others)
                                result=unittest.TextTestRunner().run(othertests)
                                assert result.failures==[] , "Other tests returned
%i failures" % len(result.failures)
                                assert result.errors==[], "Other tests returned %i
errors" % len(result.errors)
                                print "Now continuing with the main tests:"

                ... some more tests ...

                def tearDown(self):
                                .... code for tearDown...

if __name__ == '__main__':
        unittest.main()

-------------------------------------------------

__________________________________
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo.
http://www.*-*-*.com/



Tue, 08 Nov 2005 00:21:13 GMT  
 Need help Translating Python unittest to Ruby Test::Unit


Quote:
> I need help in translating the function...
> To be specific, what is the equivalent of the lines:

> result=unittest.TextTestRunner().run(othertests)

Found it :

  require 'test/unit/ui/console/testrunner'
  result = Test::Unit::UI::Console::TestRunner.run(othertests)

Don't know if this is _The Ruby Way_
Any suggestions?
-- shanko



Sun, 13 Nov 2005 11:37:56 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Need help translating a Python class to Ruby

2. Test::Unit::Mock: Mock objects for testing with Test::Unit

3. help: how to write unit tests for Ruby-X11

4. using test::unit for C++ unit tests

5. Problems with Test::Unit and Ruby 1.8?

6. ruby/mock and test::unit

7. Unit Testing in Ruby for the (Absolute) Novice

8. unit testing in ruby

9. applying unit testing to ruby?

10. TriZPUG November Meeting: Unit Testing in Python

11. Need Test::Unit for 1.7.3

12. Researching Python IDEs, debuggers, code coverage, unit testing and mem management tools

 

 
Powered by phpBB® Forum Software