[ 
https://issues.apache.org/jira/browse/HBASE-19873?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16342413#comment-16342413
 ] 

Appy commented on HBASE-19873:
------------------------------

I was thinking about this approach more during skiing, and got another idea. 
Let me try that quickly too.
It's basically this-  We can use RunListener to add timeout rule to every test 
class *via reflection* before it gets started. The only thing to verify is, 
will junit pick up this dynamic runtime addition of rules to test class.

If it works, we won't have to add the Timeout rule to each and every test 
class. That'll be a big win. Trying...

Btw, when researching more about that, i found this:
bq. The statement passed to the TestRule will never throw an exception, and 
throwing an exception from the TestRule will result in undefined behavior. This 
means that some TestRules, such as ErrorCollector, ExpectedException, and 
Timeout, have undefined behavior when used as ClassRules.
Ref:http://junit.org/junit4/javadoc/4.12/org/junit/ClassRule.html



> Add a CategoryBasedTimeout ClassRule for all UTs
> ------------------------------------------------
>
>                 Key: HBASE-19873
>                 URL: https://issues.apache.org/jira/browse/HBASE-19873
>             Project: HBase
>          Issue Type: Sub-task
>            Reporter: Duo Zhang
>            Assignee: Duo Zhang
>            Priority: Major
>             Fix For: 2.0.0-beta-2
>
>         Attachments: HBASE-19873-v1.patch
>
>
> So that our test can timeout as expected without making the surefire plugin 
> kill other tests.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to