SeamTest agony
lpiccoli.lucio.asteriski.com Sep 8, 2009 1:50 AMhi all,
i am unable to get a simple seamtest to work.
i have read chapter 27 of the seam guide.
1.configured embedded jboss.
2.write my test to get instance of EJB
3.execute test using testng in eclipse.
4.test fails to find any seam component.
what am i doing incorrect?
something doesnt look write when End test
trace occurs before my test is run.
the test code come straight from the user guide
the project was setup from seamgen.
i havent modified the bootstrap directory.
the project correctly deploys to jboss4.2.6 and works fine.
Any help to save my sanity and my meagre pride is appreciated.
test code
------------
import static org.junit.Assert.assertNotNull; import org.jboss.seam.mock.SeamTest; import org.testng.annotations.Test; public class ReferenceBusinessTest extends SeamTest{ @Test public void testSearch() throws Exception{ new ComponentTest() { @Override protected void testComponents() throws Exception { ITPBusiness ref = (ITPBusiness) getInstance("ITPBusiness"); assertNotNull( ref ); } }.run(); } }
EJB code
--------------------------
@Name(value="ITPBusiness") @Stateless @Local( ITPBusinessLocal.class ) @Remote( ITPBusinessRemote.class) public class ITPBusinessImpl implements ITPBusinessLocal{
the testng trace
------------------
[Invoker 19739141] Invoking com.asteriski.itpflow.business.ReferenceBusinessTest.testSearch 09:25:40,586 DEBUG [TestLifecycle] >>> Begin test 09:25:40,591 DEBUG [TestLifecycle] <<< End test [Invoker 19739141] Invoking @AfterMethod org.jboss.seam.mock.SeamTest.end() 09:25:40,592 DEBUG [Lifecycle] End of session, destroying contexts 09:25:40,592 DEBUG [Lifecycle] destroying conversation contexts: [] 09:25:40,592 DEBUG [Lifecycle] destroying session context 09:25:40,592 DEBUG [Contexts] destroying: org.jboss.seam.security.credentials 09:25:40,592 DEBUG [Contexts] destroying: org.jboss.seam.security.ruleBasedPermissionResolver 09:25:40,592 DEBUG [Contexts] destroying: org.jboss.seam.security.identity 09:25:40,593 DEBUG [Contexts] destroying: org.jboss.seam.web.session 09:25:40,593 DEBUG [Contexts] destroying: org.jboss.seam.security.rememberMe 09:25:40,593 DEBUG [Contexts] destroying: org.jboss.seam.core.conversationEntries 09:25:40,593 DEBUG [Contexts] destroying: org.jboss.seam.core.events [Invoker 19739141] Invoking @AfterClass org.jboss.seam.mock.SeamTest.cleanupClass() *********** INVOKED METHODS org.jboss.seam.mock.SeamTest.setupClass() 2288971 com.asteriski.itpflow.business.ReferenceBusinessTest.testSearch() 2288971 org.jboss.seam.mock.SeamTest.cleanupClass() 2288971 *********** Creating C:\src\seamitp\test-output\seamitp\com.asteriski.itpflow.business.ReferenceBusinessTest.html Creating C:\src\seamitp\test-output\seamitp\com.asteriski.itpflow.business.ReferenceBusinessTest.xml FAILED: testSearch java.lang.AssertionError: at org.junit.Assert.fail(Assert.java:91) at org.junit.Assert.assertTrue(Assert.java:43) at org.junit.Assert.assertNotNull(Assert.java:524) at org.junit.Assert.assertNotNull(Assert.java:535) at com.asteriski.itpflow.business.ReferenceBusinessTest$1.testComponents(ReferenceBusinessTest.java:23) at org.jboss.seam.mock.AbstractSeamTest$ComponentTest.run(AbstractSeamTest.java:162) at com.asteriski.itpflow.business.ReferenceBusinessTest.testSearch(ReferenceBusinessTest.java:25)