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

Steve Ebersole steve at hibernate.org
Mon Sep 26 12:36:05 EDT 2011


>> 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.

Understood, but I literally just copied that from your subject line ;)


>> 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

No idea about this AllDefaultPossibilitiesBuilder.  Sounds more like a 
question for the JUnit crowd.  But in terms of calling 
computeTestMethods, yes it would be done in withBeforeClasses *as well 
as* in withAfterClasses.  I was simply pointing out that that is better 
than writing the skip-condition-detection logic again.

-- 
steve at hibernate.org
http://hibernate.org



More information about the hibernate-dev mailing list