[jboss-user] [JBoss Seam] - Re: TestNG and Seam Documentation 12.1. Unit testing Seam co

EagleEye do-not-reply at jboss.com
Mon Aug 13 07:59:17 EDT 2007


"chuckadams" wrote : You can't depend on the EJB3 container being initialized in a @BeforeClass/beforeTestClass method, because it does in fact run before the embedded container is started by SeamTest.init().  
  | 

Yep got the same problem. But with your idea you will get the same problem. It's not workin, even the empty test class inheriting from SeamTest with a @BeforeClass/beforeTestClass method is executed before the EJB3 container being initialized. I'm couldn't solve this problem.

Not a good work around is to do the init method for the DS without any @Before.... And call this method from every test class with

  | protected void initDataSource(){
  |      emf = Persistence.createEntityManagerFactory("mediportal");
  | }
  | 

and call this method in every TestClass
with

  | @Configuration(beforeTestClass = true)
  | public void initDS() {
  |      initDataSource();
  | }
  | 

That means the DS will be initialized before every TestClass. It's stupid, cuz if you would write a test suite there is no sense to init the DS in every class.

anonymous wrote : 
  | Speaking of things out of date, Seam is using a pretty old version of TestNG.  Any plans to update it to 5.1?
  | 
This is also a really good question.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4073517#4073517

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4073517



More information about the jboss-user mailing list