简体   繁体   English

Ruby单元测试:从主类运行测试类

[英]Ruby unit test :run a test class from the main class

In Ruby unit testing can I run a test class from another class 在Ruby单元测试中,我可以从另一个类运行测试类吗

for exa 考试

class Foo < Test::Unit:: TestCase

test_abc()
test_bnd()

Now i want to run this above test suite from my main class 现在我想从我的主类运行以上测试套件

so how could i do it I tried using runner but dono wat should be argument to the run method 所以我该怎么办我尝试使用runner但唐纳扫管at应为run方法的参数

Test::Unit::UI::Console::TestRunner.run(FOO)

, Regards , 问候

That is correct(refer http://www.ensta.fr/~diam/ruby/online/ruby-doc-stdlib/libdoc/test/unit/rdoc/classes/Test/Unit.html ) 正确(请参阅http://www.ensta.fr/~diam/ruby/online/ruby-doc-stdlib/libdoc/test/unit/rdoc/classes/Test/Unit.html

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM