Q: How not to run TestCase

T

Tomoyuki Kosimizu

Hi,

I have code like this:

class SuperTestCase << Test::Unit::TestCase
def test_doit
assert_equal('a', get_a)
end

def get_a
raise 'subclass responsibility'
end
end

class SubATest < SuperTestCase
def get_a
return 'a'
end
end

class SubBTest < SuperTestCase
def get_a
return ?a.chr
end
end

Of course, I can not use test/unit.rb. But I don't know other way to
run this. Would you tell me how not to run SuperTestCase?

(e-mail address removed)-net.ne.jp
 
G

gabriele renzi

Tomoyuki Kosimizu ha scritto:
Hi,

I have code like this:

class SuperTestCase << Test::Unit::TestCase
def test_doit
assert_equal('a', get_a)
end

def get_a
raise 'subclass responsibility'
end
end

class SubATest < SuperTestCase
def get_a
return 'a'
end
end

class SubBTest < SuperTestCase
def get_a
return ?a.chr
end
end

Of course, I can not use test/unit.rb. But I don't know other way to
run this. Would you tell me how not to run SuperTestCase?

well, you could have it in a module and include it via mixin. Another
way may be to write your own test suite. Just my two cents.
 
J

Jim Weirich

gabriele said:
Tomoyuki Kosimizu ha scritto:
[... example of parent test case elided ...]
well, you could have it in a module and include it via mixin. Another
way may be to write your own test suite. Just my two cents.

Putting common test methods in a mixin module has worked well for me.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,901
Latest member
Noble71S45

Latest Threads

Top