Hi Cédric,
That's too bad. I do use helper methods (called from a @Test method)
as a workaround, but I end-up needing to use a lot of them within the
same class in order to get around this limitation, so the test code
starts looking sloppy and not as easy to maintain. I feel strongly for
having TestNG recognize all annotated @Test methods as test methods
regardless of their return type, but I understand that we need to
maintain backward compatibility. So what can we do? I propose 2
solutions:
1) Is it possible to add this option to TestNG as an experimental
feature that's activated with a command-line switch? That way, users
such as myself who would trade backward compatibilty for the
convenience of this feature would have this option.
2) If not #1 isn't possible, then if it's not too much trouble, could
you please point me to places in the source code that would need to be
changed in order to have this feature? I see myself needing to create
private builds with this feature each time a new revision of TestNG
becomes available, so that I can have this incredibly useful
capability.
Thank you.
Cheers,
Will
On Nov 11, 12:34 pm, Cédric Beust ♔ <
cbe...@google.com> wrote:
> You are right, I forgot that I'm displaying a warning but still ignoring the
> method.
>
> This was made necessary for backward compatibility. If TestNG suddenly
> started allowing methods that return a value as valid test methods, existing
> users of the class level @Test annotation would see a lot of unwanted
> methods be run.
>
> The recommended workaround is to create a void @Test method that invokes the
> method with a result and then ignores that result.
>
> --
> ***Cédric
> *
> > Will- Hide quoted text -
>
> - Show quoted text -