[jbossseam-issues] [JBoss JIRA] Created: (JBSEAM-3128) SEAM Unit Test is not working when run as TestNG test from Eclipse
mca.ambrish@gmail.com (JIRA)
jira-events at lists.jboss.org
Fri Jun 20 05:50:46 EDT 2008
SEAM Unit Test is not working when run as TestNG test from Eclipse
-------------------------------------------------------------------
Key: JBSEAM-3128
URL: http://jira.jboss.com/jira/browse/JBSEAM-3128
Project: Seam
Issue Type: Task
Components: Test Harness
Affects Versions: 2.0.2.CR1
Environment: Windows XP, Mozilla FireFox
Reporter: mca.ambrish at gmail.com
I am running a testng.xml file from eclipse TestNG.
My test class is
public class AsmSurveyListTest extends SeamTest
{
@Test
public void unitTestGetList() throws Exception {
EntityManager em = getEntityManagerFactory().createEntityManager();
em.getTransaction().begin();
AsmSurveyList asmSurveyList = new AsmSurveyList();
assert asmSurveyList.getList().size()== 9;
em.getTransaction().commit();
em.close();
}
private EntityManagerFactory emf;
public EntityManagerFactory getEntityManagerFactory()
{
return emf;
}
@BeforeTest
public void init() throws Exception
{
super.init();
emf = Persistence.createEntityManagerFactory("TalentPact");
}
@AfterTest
public void destroy() throws Exception
{
emf.close();
}
}
and my testng.xml file is :
<!DOCTYPE suite SYSTEM "http://beust.com/testng/testng-1.0.dtd" >
<suite name="AsmSurveyList" verbose="2" parallel="false">
<test name="AsmSurveyList">
<classes>
<class name="com.talentpact.test.AsmSurveyListTest"/>
</classes>
</test>
</suite>
Now when I am running the testng.xml file as TestNG from Eclipse, I get the following error:
FAILED CONFIGURATION: @BeforeTest init
java.lang.NoClassDefFoundError: org/jboss/deployers/spi/IncompleteDeploymentException
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at org.jboss.seam.mock.BaseSeamTest.embeddedJBossAvailable(BaseSeamTest.java:1015)
at org.jboss.seam.mock.BaseSeamTest.startJbossEmbeddedIfNecessary(BaseSeamTest.java:1003)
at org.jboss.seam.mock.BaseSeamTest.init(BaseSeamTest.java:929)
at org.jboss.seam.mock.SeamTest.init(SeamTest.java:42)
at com.talentpact.test.AsmSurveyListTest.init(AsmSurveyListTest.java:41)
... Removed 19 stack frames
FAILED CONFIGURATION: @BeforeMethod begin
java.lang.IllegalStateException: Attempted to invoke a Seam component outside the an initialized application
at org.jboss.seam.contexts.Lifecycle.getApplication(Lifecycle.java:36)
at org.jboss.seam.contexts.Lifecycle.beginSession(Lifecycle.java:173)
at org.jboss.seam.contexts.ServletLifecycle.beginSession(ServletLifecycle.java:124)
at org.jboss.seam.mock.BaseSeamTest.begin(BaseSeamTest.java:918)
at org.jboss.seam.mock.SeamTest.begin(SeamTest.java:28)
... Removed 24 stack frames
SKIPPED CONFIGURATION: @AfterMethod end
SKIPPED CONFIGURATION: @AfterClass cleanup
SKIPPED CONFIGURATION: @AfterTest destroy
SKIPPED: unitTestGetList
===============================================
com.talentpact.test.AsmSurveyListTest
Tests run: 1, Failures: 0, Skips: 1
Configuration Failures: 2, Skips: 3
===============================================
===============================================
TalentPact
Total tests run: 1, Failures: 0, Skips: 1
Configuration Failures: 2, Skips: 3
===============================================
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the seam-issues
mailing list