You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@activemq.apache.org by Clebert Suconic <cl...@gmail.com> on 2017/10/10 19:51:04 UTC

[DISCUSS] Require timeout on every @Test

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

Re: [DISCUSS] Require timeout on every @Test

Posted by Clebert Suconic <cl...@gmail.com>.
fair enough.. I won't do it

On Wed, Oct 11, 2017 at 9:31 AM, Christopher Shannon
<ch...@gmail.com> wrote:
> 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 <cl...@gmail.com>
> 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
>>



-- 
Clebert Suconic

Re: [DISCUSS] Require timeout on every @Test

Posted by Christopher Shannon <ch...@gmail.com>.
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 <cl...@gmail.com>
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
>