Bonjour,

je cherche à faire des tests unitaires via TestNG.

Ayant généré une projet Seam avec le Plugin JBOSS, j'obtiens 4 projets dans mon workspace:
- Seam-test qui contient mon projet web
- Seam-test-ear
- Seam-test-ejb
- Seam-test-test

ayant farfouiller sur le web, j'ai trouver entre autre des infos sur le site JBOSS

J'ai pu y trouver un bout de code permettant normalement de faire rapidement des tests.


Première remarque, si mon test est dans le projet de test... Cela ne marche pas! J'ai donc déplacer ma classe dans mon projet ejb et quelque chose se passe alors...

Deuxièmement, comme vous le voyez, mon test ne fait pas grand choses si ce n'est vérifier que ça roule.

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
package com.sample;
 
import org.jboss.seam.mock.SeamTest;
import org.testng.annotations.Test;
 
public class RegisterTest extends SeamTest {
 
	@Test
	public void testRegisterComponent() throws Exception {
 
 
 
	}
}
malheureusement, j'obtiens l'erreur suivante:

java.lang.RuntimeException: Could not create Component: statementOfAccount
at org.jboss.seam.init.Initialization.addComponent(Initialization.java:1202)
at org.jboss.seam.init.Initialization.installComponents(Initialization.java:1118)
at org.jboss.seam.init.Initialization.init(Initialization.java:733)
at org.jboss.seam.mock.AbstractSeamTest.startSeam(AbstractSeamTest.java:919)
at org.jboss.seam.mock.SeamTest.startSeam(SeamTest.java:58)
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:592)
at org.testng.internal.MethodHelper.invokeMethod(MethodHelper.java:604)
at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:394)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:142)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:79)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:261)
at org.testng.SuiteRunner.run(SuiteRunner.java:190)
at org.testng.TestNG.createAndRunSuiteRunners(TestNG.java:792)
at org.testng.TestNG.runSuitesLocally(TestNG.java:765)
at org.testng.TestNG.run(TestNG.java:699)
at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:73)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:122)
Caused by: java.lang.IllegalArgumentException: You must specify org.jboss.seam.core.init.jndiPattern or use @JndiName: statementOfAccount
at org.jboss.seam.Component.getJndiName(Component.java:451)
at org.jboss.seam.Component.<init>(Component.java:233)
at org.jboss.seam.Component.<init>(Component.java:205)
at org.jboss.seam.init.Initialization.addComponent(Initialization.java:1186)
... 19 more
Quelqu'un a-t'il une idée? une solution? Merci d'avance
Jean