3

In the docs for groovy.util.GroovyTestCase (http://groovy.codehaus.org/api/groovy/util/GroovyTestCase.html) the description says "A default JUnit TestCase in Groovy. This provides a number of helper methods plus avoids the JUnit restriction of requiring all test* methods to be void return type.

However, when I use groovy JUnit3 code like the following, JUnit finds no tests:

class MyTest extends GroovyTestCase {
    def testSomething() {
        assert 1 + 1 == 2
    }
}

If I change the return type of testSomething() to void (as is normal in JUnit) the test is found just fine.

Do I need to write the test differently or is the doc wrong?

Jack Holt
  • 497
  • 4
  • 9

1 Answers1

0

Here is the source for v 2.2.1 of GroovyTestCase. I believe that your assertion is correct: the doc is wrong.

I don't see any code that supports the claim, and even in the case for the notYetImplemented feature, the method isPublicTestMethod clearly looks for void (and implies the code is from JUnit itself). This last point isn't related to your code, per se, but further suggests the comment is off base.

Michael Easter
  • 23,733
  • 7
  • 76
  • 107