MiniTest and TestUnit implementations
Hi, Why both minitest and testunit modules are so tied to output in the code ... Why is there no class/instance method with which i can get result as an object (~ Minitest::Unit.run(<test_file, or class test file ..>) => <TestResult @errors = ... @failures= ...>) Why must i hack theses modules(even if its quite easy with ruby) to get result as an object i can work with , that is get (with Testunit) : <Test::Unit::TestResult:0x10109a1a8 @assertion_count=13, @errors=[], @run_count=9, @channels={"CHANGED"=>{}, "FAULT"=>{}}, @failures=[]> Can you imagine , like it's done in ZenTest i gonna parse output with regexp to get it ... :( :( I've digged the source code (both minitest and testunit), but if i'm wrong and this way exists without hacking, tell me it .. Thanks. anoiaque@gmail.com
Hi, Minitest doesn't have a really clean way of doing what you want, but it does have a simple way. If you look at minitest/pride: https://github.com/seattlerb/minitest/blob/master/lib/minitest/pride.rb It implements an alternative output format for minitest that you could copy and then change so it counts the number of tests. Test::Unit in Ruby 1.9 is just a compatibility layer to minitest, so they are really the same thing for what you are asking about. FWIW, rspec has proper custom formatters that support exactly what you have asked about. HTH, Mark Rada mrada@marketcircle.com On 2011-05-04, at 8:08 AM, anoiaque wrote:
Hi,
Why both minitest and testunit modules are so tied to output in the code ... Why is there no class/instance method with which i can get result as an object (~ Minitest::Unit.run(<test_file, or class test file ..>) => <TestResult @errors = ... @failures= ...>)
Why must i hack theses modules(even if its quite easy with ruby) to get result as an object i can work with , that is get (with Testunit) : <Test::Unit::TestResult:0x10109a1a8 @assertion_count=13, @errors=[], @run_count=9, @channels={"CHANGED"=>{}, "FAULT"=>{}}, @failures=[]>
Can you imagine , like it's done in ZenTest i gonna parse output with regexp to get it ... :( :(
I've digged the source code (both minitest and testunit), but if i'm wrong and this way exists without hacking, tell me it ..
Thanks.
anoiaque@gmail.com
_______________________________________________ MacRuby-devel mailing list MacRuby-devel@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
As we say in french "Nous ne sommes jamais mieux servis que par nous-mêmes" . In my main project, i've made a module which respond to what i want : Get an object (TestResult object) after each test (it is yielded after each test and return an object of class Error , Failure, Error or Success) and get global result of tests after all. Perhaps it can be usefull for someone else, so i've extracted it as a gem. You can find it on Gemcutter : https://rubygems.org/gems/minitest_owrapper Github repo : https://github.com/anoiaque/minitest_owrapper Best regards.
On May 4, 2011, at 05:08 , anoiaque wrote:
Why both minitest and testunit modules are so tied to output in the code ... Why is there no class/instance method with which i can get result as an object (~ Minitest::Unit.run(<test_file, or class test file ..>) => <TestResult @errors = ... @failures= ...>)
Why must i hack theses modules(even if its quite easy with ruby) to get result as an object i can work with [...] :
Probably because you haven't filed a ticket or otherwise communicated with me at all. It's getting old folks.
participants (3)
-
anoiaque
-
Mark Rada
-
Ryan Davis