I've started to use the Timeout Junit rule in some places.  This is because
of thread safety issues with @Test.  In JUnit's javadoc it says:

THREAD SAFETY WARNING: Test methods with a timeout parameter are run in a
thread other than the thread which runs the fixture's @Before and @After
methods. This may yield different behavior for code that is not thread safe
when compared to the same test method without a timeout parameter. Consider
using the org.junit.rules.Timeout rule instead, which ensures a test method
is run on the same thread as the fixture's @Before and @After methods.

So I don't think requiring a timeout in the annotation itself is a good
thing for every test in case people want to use the Timeout rule instead.

On Tue, Oct 10, 2017 at 3:51 PM, Clebert Suconic <[email protected]>
wrote:

> There's a annotation I contributed with seventu that we already use to
> require name on every method's Parameterized.Parameters.
>
>
> I'm thinking to extend its usage and require timeout on every test we
> write:
>
> @Test(timeout = 60000)
>
>
>
> The good thing about this, is that we wouldn't leave cases where tests
> start to take a long time to run.. and they fail with a timeout
> instead.
>
>
>
> Is there anyone opposing to such thing?
>
>
>
>
> --
> Clebert Suconic
>

Reply via email to