Q: How not to run TestCase

Discussion in 'Ruby' started by Tomoyuki Kosimizu, Oct 17, 2004.

  1. 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?

    -net.ne.jp
     
    Tomoyuki Kosimizu, Oct 17, 2004
    #1
    1. Advertising

  2. 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.
     
    gabriele renzi, Oct 17, 2004
    #2
    1. Advertising

  3. Tomoyuki Kosimizu

    Jim Weirich Guest

    gabriele renzi wrote:
    > Tomoyuki Kosimizu ha scritto:

    [... example of parent test case elided ...]
    >> 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.


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

    --
    -- Jim Weirich http://onestepback.org
    -----------------------------------------------------------------
    "Beware of bugs in the above code; I have only proved it correct,
    not tried it." -- Donald Knuth (in a memo to Peter van Emde Boas)
     
    Jim Weirich, Oct 17, 2004
    #3
  4. On Oct 17, 2004, at 15:46, Jim Weirich wrote:

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


    That would be my suggestion as well.


    Nathaniel
    Terralien, Inc.

    <:((><
     
    Nathaniel Talbott, Oct 20, 2004
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. davy
    Replies:
    4
    Views:
    1,486
  2. Oltmans
    Replies:
    1
    Views:
    880
    Francesco Bochicchio
    Sep 28, 2009
  3. albert kao
    Replies:
    1
    Views:
    902
    Eric Sosman
    Jan 21, 2011
  4. Scott
    Replies:
    1
    Views:
    144
    Timothy Hunter
    Aug 20, 2005
  5. Replies:
    2
    Views:
    104
    Logan Capaldo
    Aug 29, 2006
Loading...

Share This Page