[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

test/unit runner with ui?

Its Me

11/26/2004 3:54:00 AM

Context: 1.8.2 on WinXP: I find myself often in a mode of making changes to
code and needing to drill down into specific tests with logging or
breakpoints. So I want an easy way to control which tests to run when in
that mode.

Which UI test runner is easily used with test/unit? I tried Tk assuming it
was 'built in'
require 'test/unit/ui/tk/testrunner'
and
Test::Unit::UI::Tk::TestRunner.run( TestMacros ) # at end of my test
class

And I got
>
This application has requested the Runtime to terminate it in an unusual
way.
Please contact the application's support team for more information.
Process ruby exited with code 3

Thanks!


4 Answers

Its Me

11/26/2004 4:14:00 AM

0

> >
> This application has requested the Runtime to terminate it in an unusual
> way.

Operator error (though it's a strange error message for a mis-typed test
class name). Sorry for the noise.

It runs now. But is there a way of getting a list of all test methods /
classes / suites and selecting only those I want to run?

Thanks!


Sam Roberts

11/26/2004 12:56:00 PM

0

Quoteing itsme213@hotmail.com, on Fri, Nov 26, 2004 at 01:17:57PM +0900:
> > >
> > This application has requested the Runtime to terminate it in an unusual
> > way.
>
> Operator error (though it's a strange error message for a mis-typed test
> class name). Sorry for the noise.
>
> It runs now. But is there a way of getting a list of all test methods /
> classes / suites and selecting only those I want to run?

Yes, specify the names of the test functions you want to run on the
command line:

./test_all.rb test_schneir_a

Sam



Its Me

11/26/2004 4:53:00 PM

0

> Yes, specify the names of the test functions you want to run on the
> command line:
>
> ./test_all.rb test_schneir_a

That was the first thing I tried, but it still ran all the tests. It could
be that command-line options only allow me to select between different test
suite files. But my ruby file looks like:

----------------
# ... my code to be tested
class A ... end
class B ... end

# test code
if __FILE__ == $0
require 'test/unit'
class Test_C < Test::Unit::TestCase
def test_1; ...; end
def test_2; ...; end
end
end
---------------
Am I doing something wrong? Can I get selection at the level of test methods
i.e. test_1 vs. test_2 ?

Thanks!


Nathaniel Talbott

11/27/2004 3:34:00 PM

0

On Nov 26, 2004, at 11:57, itsme213 wrote:

> Am I doing something wrong? Can I get selection at the level of test
> methods
> i.e. test_1 vs. test_2 ?

As a general rule, try --help first:

ntalbott@jacob:~/sandbox$ ruby t.rb --help
Test::Unit automatic runner.
Usage: t.rb [options] [-- untouched arguments]
...

For filtering by test, use -n/--name

ntalbott@jacob:~/sandbox$ ruby t.rb --verbose
...
test_a(T): .
test_b(T): .
...
2 tests, 0 assertions, 0 failures, 0 errors

ntalbott@jacob:~/sandbox$ ruby t.rb --verbose -n test_a
...
test_a(T): .
...
1 tests, 0 assertions, 0 failures, 0 errors

Hope that helps,


Nathaniel
Terralien, Inc.

<:((><