Professional Web Applications Themes

Test::Unit in 1.8 - Ruby

So far I've noticed two changes in the Test::Unit included with 1.8. They've probably been in Test::Unit for I long time, but I'm just encountering them now with 1.8, due to laziness. First, you have to define #setup instead of #set_up. I guess I prefer the new way (I remember a long discussion some time ago), but it might be nice to get a warning that you have defined #set_up, and it will not be called... Second, you can no longer define a subclass of TestCase to be used as an "abstract" base class of other test case classes. For ...

  1. #1

    Default Test::Unit in 1.8


    So far I've noticed two changes in the Test::Unit included with 1.8.
    They've probably been in Test::Unit for I long time, but I'm just
    encountering them now with 1.8, due to laziness.

    First, you have to define #setup instead of #set_up. I guess I prefer
    the new way (I remember a long discussion some time ago), but it might
    be nice to get a warning that you have defined #set_up, and it will not
    be called...

    Second, you can no longer define a subclass of TestCase to be used as an
    "abstract" base class of other test case classes. For example, the
    following flunks, because BaseTest has no tests:

    require 'test/unit'

    class BaseTest < Test::Unit::TestCase
    def do_foo_test
    puts "testing foo"
    end
    end

    class DerivedTest < BaseTest
    def test_derived
    do_foo_test
    end
    end

    I've gotten around this by adding a dummy test method to my base class.
    I could also have made it a mixin. It's just a minor annoyance.

    Maybe it would be possible to have a class method of TestCase that marks
    the class as "abstract"? E.g.,

    class BaseTest < Test::Unit::TestCase
    abstract_test_class
    ...
    end

    Hope this helps someone who's as slow to upgrade as me...


    Joel VanderWerf Guest

  2. #2

    Default Re: Test::Unit in 1.8

    Joel VanderWerf [mailto:vjoelPATH.Berkeley.EDU] wrote:
    > First, you have to define #setup instead of #set_up. I guess I prefer
    > the new way (I remember a long discussion some time ago), but it might
    > be nice to get a warning that you have defined #set_up, and it will not
    > be called...
    Hmmm... a warning would be nice. Have to see about that.

    > Second, you can no longer define a subclass of TestCase to be used as an
    > "abstract" base class of other test case classes. For example, the
    > following flunks, because BaseTest has no tests:
    [ruby-talk:76201] and the surrounding thread might be helpful.


    Nathaniel

    <:((><


    Nathaniel Talbott Guest

Similar Threads

  1. Test::Unit non-auto-run test case?
    By Sean O'Dell in forum Ruby
    Replies: 1
    Last Post: September 18th, 06:19 PM
  2. Test::Unit -- multiple errors in test method ???
    By Johan Holmberg in forum Ruby
    Replies: 14
    Last Post: September 15th, 03:33 PM
  3. Method test::unit::TestSuite#<<(test)
    By Robert Klemme in forum Ruby
    Replies: 1
    Last Post: August 6th, 11:28 PM
  4. Test order in Test::Unit
    By Brian Candler in forum Ruby
    Replies: 0
    Last Post: July 5th, 08:58 PM
  5. Test::Unit GUI
    By Gour in forum Ruby
    Replies: 5
    Last Post: July 3rd, 04:19 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139