SeamTest, simulate JSF actions with error
mach31 Apr 25, 2008 4:44 PMHello,
i write a second post for a second question about my problem for Integration test with SeamTest
i have the same EJB Seam to test, and would simulate JSF Actions;
this is my EJB Seam
@Stateful
@Scope(ScopeType.CONVERSATION)
@Name("ejbSeam")
public class EJBSeam implements
EJBSeamLocale {
private static final Logger aLogger =
Logger.getLogger(EJBSeam.class);
@PersistenceContext(type = PersistenceContextType.EXTENDED, unitName = "MyUnitName")
private EntityManager em;
@In(required = false)
@Out(required = false)
private APojo myPojoWichContainsEJBEntity;
@EJB
private AnInterfaceLocal MyEJBActions;
private Boolean actionPossible;
private String errorMessage;
...
}This is part of the xhtml Page
...
<h:inputText id="name" value="#{myPojoWichContainsEJBEntity.entityBean.name}" /><br />
...and this is my SeamTest extended class
@Test
public class TestSeamEJB extends SeamTest {
public void testAddCF() throws Exception {
new FacesRequest() {
@Override
protected void updateModelValues() throws Exception
{
APojo myPojoInstance = (APojo) Component.getInstance("myPojoWichContainsEJBEntity");
assert myPojoInstance!=null;
}
}.run();
}
}
I obtain this ful stack trace error:
FAILED: testAddCF java.lang.AssertionError at test.integration.formation.TestGestionCFA$1.updateModelValues(TestGestionCFA.java:50) at org.jboss.seam.mock.SeamTest$Request.run(SeamTest.java:476) at test.integration.formation.TestGestionCFA.testAddCF(TestGestionCFA.java:59) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.testng.internal.MethodHelper.invokeMethod(MethodHelper.java:580) at org.testng.internal.Invoker.invokeMethod(Invoker.java:478) at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:607) at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:874) at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:125) at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:109) at org.testng.TestRunner.runWorkers(TestRunner.java:689) at org.testng.TestRunner.privateRun(TestRunner.java:566) at org.testng.TestRunner.run(TestRunner.java:466) at org.testng.SuiteRunner.runTest(SuiteRunner.java:301) at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:296) at org.testng.SuiteRunner.privateRun(SuiteRunner.java:276) at org.testng.SuiteRunner.run(SuiteRunner.java:191) at org.testng.TestNG.createAndRunSuiteRunners(TestNG.java:808) at org.testng.TestNG.runSuitesLocally(TestNG.java:776) at org.testng.TestNG.run(TestNG.java:701) at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:73) at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:124)
I have Seam 1.2.1GA, TestNG5.7 with eclipse plugin, and move the embedded.jar files in first position in classpath for this test class.
I don't understand what do i do to test this JSF interacitons.
If anyone could help me or just give me indication, or example, or anything else.
I read books and tutorials about seam, and seam manual without finding how to solve this problem.
Thanks in advance