You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When writing tests in Groovy, it's tempting to use def for the test methods, since that is typically the way to go in Groovy. However, for def the compiler produces a method that returns Object.
If this was a method annotated with @Test, it would be silently ignored by JUnit, as it should be a void method. This leads to lots of pulled hairs and other frustrations.
Test run finished after 13 ms
[ 2 containers found ]
[ 0 containers skipped ]
[ 2 containers started ]
[ 0 containers aborted ]
[ 2 containers successful ]
[ 0 containers failed ]
[ 0 tests found ]
[ 0 tests skipped ]
[ 0 tests started ]
[ 0 tests aborted ]
[ 0 tests successful ]
[ 0 tests failed ]
I would like JUnit to shout in my face that I'm using it wrong.
The text was updated successfully, but these errors were encountered:
We will have a look into it and provide a validation message that complains about the generated method or provide a fallback (and only printing a warning).
Overview
When writing tests in Groovy, it's tempting to use
def
for the test methods, since that is typically the way to go in Groovy. However, fordef
the compiler produces a method that returnsObject
.If this was a method annotated with
@Test
, it would be silently ignored by JUnit, as it should be avoid
method. This leads to lots of pulled hairs and other frustrations.I would like JUnit to shout in my face that I'm using it wrong.
The text was updated successfully, but these errors were encountered: