[hibernate-dev] HHH-6677 skip @BeforeClassOnce / @AfterClassOnce if test is ignored

Strong Liu stliu at hibernate.org
Mon Sep 26 12:05:55 EDT 2011


On Sep 26, 2011, at 11:47 PM, Steve Ebersole wrote:

> Essentially you want to skip processing @BeforeClassOnce / @AfterClassOnce if there are no test methods to execute for said class being processed.
> 

Ideally, we should skip processing @BeforeClassOnce / @AfterClassOnce and @BeforeClass / @AfterClass but for now skipping these two Once annotations should be fine, since all our tests use those two in favor of junit ones.


> 
> I think you should be able to call org.hibernate.testing.junit4.CustomRunner#computeTestMethods to accomplish this.  If computeTestMethods returns no methods, there are no test methods to be performed.

where should I call this method ? CustomRunner#withBeforeClasses?
as said in the jira comment , it would really great if we can plug into a custom IgnoredBuilder into org.junit.internal.builders.AllDefaultPossibilitiesBuilder

> 
> 
> On Mon 26 Sep 2011 09:41:07 AM CDT, Strong Liu wrote:
>> https://hibernate.onjira.com/browse/HHH-6677
>> 
>> I don't find a elegant way to fix this….
>> one option is in org.hibernate.testing.junit4.CustomRunner#withBeforeClasses, we check if the test class has @Skip (and @RequiresDialect etc.), and if it does, then return super.withBeforeClasses directly (i know this is not a good way to do that)
>> 
>> any suggestions?
>> 
>> -----------
>> Strong Liu<stliu at hibernate.org>
>> http://hibernate.org
>> http://github.com/stliu
>> 
>> 
>> _______________________________________________
>> hibernate-dev mailing list
>> hibernate-dev at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/hibernate-dev
> 
> -- 
> steve at hibernate.org
> http://hibernate.org





More information about the hibernate-dev mailing list