-
1. Re: SeamTest + TestNG doesn't find any TestNG annotations
lcbdl888 Feb 20, 2009 5:44 PM (in response to coenos)try right click on your testng.xml, then Run As, TestNG Suite
-
2. Re: SeamTest + TestNG doesn't find any TestNG annotations
coenos Feb 20, 2009 7:08 PM (in response to coenos)Ok I am now running the Suite with some extra classpath entries and also within a ComponentTest. I also simplified the test:
public class MyTest extends SeamTest { @Test public void testThis() throws Exception{ new ComponentTest() { @Override protected void testComponents() throws Exception { QuotationFacade facade = (QuotationFacade)Component.getInstance("quotationFacadeImpl",true); assert true; } }.run(); } }
The suite now runs, but I get another Exception:
[RunInfo] Adding method selector: org.testng.internal.XmlMethodSelector@1a33d48 priority: 10 [TestClass] Creating TestClass for [ClassImpl uk.co.tntpost.umbrella.test.MyTest] [TestClass] Adding method xxxx.test.MyTest.testThis() on TestClass class xxxx.test.MyTest [XmlMethodSelector] Including method xxxx.test.testThis() [SuiteRunner] Created 1 TestRunners [TestRunner] Running test xxxxxx.test.MyTest on 1 classes, included groups:[] excluded groups:[] [TestClass] ====== TESTCLASS: xxxx.test.MyTest [TestClass] Test : xxxx.test.MyTest.testThis() [TestClass] ====== [TestRunner] Found 1 applicable methods [TestRunner] WILL BE RUN IN RANDOM ORDER: [TestRunner] xxxx.test.MyTest.testThis() [TestRunner] on instances [TestRunner] xxxx.test.MyTest@125fefa [TestRunner] === [Invoker 23667197] Invoking xxxx.test.MyTest.testThis *********** INVOKED METHODS xxxx.test.MyTest.testThis() 19267322 *********** Creating C:\Workspaces\EclipseTNTUmbrellaWorkspace\umbrella-parent\umbrella-war\test-output\umbrella-war\xxxxx.test.MyTest.html FAILED: testThis java.lang.NullPointerException at org.jboss.seam.servlet.ServletSessionMap.get(ServletSessionMap.java:54) at org.jboss.seam.contexts.BasicContext.get(BasicContext.java:49) at org.jboss.seam.contexts.Contexts.lookupInStatefulContexts(Contexts.java:199) at org.jboss.seam.Component.getInstance(Component.java:1939) at org.jboss.seam.Component.getInstance(Component.java:1934) at xxxx.test.MyTest$1.testComponents(MyTest.java:20) at org.jboss.seam.mock.AbstractSeamTest$ComponentTest.run(AbstractSeamTest.java:163) at xxxx.test.MyTest.testThis(MyTest.java:33) ... Removed 22 stack frames =============================================== uk.co.tntpost.umbrella.test.MyTest Tests run: 1, Failures: 1, Skips: 0 =============================================== =============================================== umbrella-war Total tests run: 1, Failures: 1, Skips: 0 ===============================================
I don't understand this. Is this a bug in SeamTest ?
Thanks for your help,
Coen -
3. Re: SeamTest + TestNG doesn't find any TestNG annotations
coenos Feb 21, 2009 10:27 AM (in response to coenos)Ok I looked at the Seam source code in the org.jboss.seam.servlet.ServletSessionMap.
public Object get(Object key) { return session.getAttribute( (String) key ); }
It's failing on the session.getAttribute method.
I don't understand why there is no Session????
Please help,
Coen -
4. Re: SeamTest + TestNG doesn't find any TestNG annotations
marcioendo.marcioendo.gmail.com Feb 21, 2009 7:33 PM (in response to coenos)
I don't understand why there is no Session????I think the problem is that you're implementing your test as a ComponentTest.
Try extending a FacesRequest and see if the results are any different.
-
5. Re: SeamTest + TestNG doesn't find any TestNG annotations
coenos Feb 22, 2009 1:31 PM (in response to coenos)Ok now I get another exception. I am new to testNG testing....
I changed the test code to:
public class MyTest extends SeamTest { @Test public void testThis() throws Exception{ /* new ComponentTest() { @Override protected void testComponents() throws Exception { QuotationFacade facade = (QuotationFacade)Component.getInstance("quotationFacadeImpl",true); assert true; } }.run(); */ new FacesRequest(){ @Override protected void invokeApplication() throws Exception{ //QuotationFacade facade = (QuotationFacade)Component.getInstance("quotationFacadeImpl",true); assert true; } }.run(); } }
This is the exception:
FAILED: testThis java.lang.NullPointerException at org.jboss.seam.mock.AbstractSeamTest$Request.run(AbstractSeamTest.java:492) at xxxx.test.MyTest.testThis(MyTest.java:35) ... Removed 22 stack frames
I do not understand this.
Please help,
Coen -
6. Re: SeamTest + TestNG doesn't find any TestNG annotations
coenos Feb 23, 2009 3:33 PM (in response to coenos)Ok, I'm back to where I started. TestNG doesn't crash anymore but I am getting the same output, whether I run a Class, a Method or a Suite. Or whether I run a FacesRequest or ComponentTest....
Parser] Running: C:\Workspaces\EclipseTNTUmbrellaWorkspace\umbrella-parent\umbrella-war\temp-testng-customsuite.xml [RunInfo] Adding method selector: org.testng.internal.XmlMethodSelector@1e8a1f6 priority: 10 [TestNGClassFinder] SKIPPING CLASS class xxxx.test.facestest.MyFacesTest no TestNG annotations found [SuiteRunner] Created 1 TestRunners [TestRunner] Running test xxxx.test.facestest.MyFacesTest on 0 classes, included groups:[] excluded groups:[] [TestRunner] Found 0 applicable methods *********** INVOKED METHODS *********** Creating C:\Workspaces\EclipseTNTUmbrellaWorkspace\umbrella-parent\umbrella-war\test-output\umbrella-war\xxxx.test.facestest.MyFacesTest.html =============================================== xxxx.test.facestest.MyFacesTest Tests run: 0, Failures: 0, Skips: 0 =============================================== =============================================== umbrella-war Total tests run: 0, Failures: 0, Skips: 0 =============================================== Creating C:\Workspaces\EclipseTNTUmbrellaWorkspace\umbrella-parent\umbrella-war\test-output\umbrella-war\toc.html Creating C:\Workspaces\EclipseTNTUmbrellaWorkspace\umbrella-parent\umbrella-war\test-output\umbrella-war\xxxx.test.facestest.MyFacesTest.properties Creating C:\Workspaces\EclipseTNTUmbrellaWorkspace\umbrella-parent\umbrella-war\test-output\umbrella-war\index.html Creating C:\Workspaces\EclipseTNTUmbrellaWorkspace\umbrella-parent\umbrella-war\test-output\umbrella-war\main.html Creating C:\Workspaces\EclipseTNTUmbrellaWorkspace\umbrella-parent\umbrella-war\test-output\umbrella-war\groups.html Creating C:\Workspaces\EclipseTNTUmbrellaWorkspace\umbrella-parent\umbrella-war\test-output\umbrella-war\methods.html Creating C:\Workspaces\EclipseTNTUmbrellaWorkspace\umbrella-parent\umbrella-war\test-output\umbrella-war\methods-alphabetical.html Creating C:\Workspaces\EclipseTNTUmbrellaWorkspace\umbrella-parent\umbrella-war\test-output\umbrella-war\classes.html Creating C:\Workspaces\EclipseTNTUmbrellaWorkspace\umbrella-parent\umbrella-war\test-output\umbrella-war\reporter-output.html Creating C:\Workspaces\EclipseTNTUmbrellaWorkspace\umbrella-parent\umbrella-war\test-output\umbrella-war\methods-not-run.html Creating C:\Workspaces\EclipseTNTUmbrellaWorkspace\umbrella-parent\umbrella-war\test-output\umbrella-war\testng.xml.html Creating C:\Workspaces\EclipseTNTUmbrellaWorkspace\umbrella-parent\umbrella-war\test-output\index.html Creating C:\Workspaces\EclipseTNTUmbrellaWorkspace\umbrella-parent\umbrella-war\test-output\testng-results.xml
Running out of options.......
Thanks for any help,
Coen -
7. Re: SeamTest + TestNG doesn't find any TestNG annotations
kapitanpetko Feb 23, 2009 5:31 PM (in response to coenos)Wild guess: make sure you are using TestNG's annotations, and not JUnit's. Are you import-ing org.junit.Test or org.testng.annotations.Test?
-
8. Re: SeamTest + TestNG doesn't find any TestNG annotations
coenos Feb 23, 2009 6:20 PM (in response to coenos)Yes, indeed, using TestNG annotations.
The weird thing is that when I run a clean test (from Eclipse) StartSeam is called. But when I run the test with the required embedded jboss jars, the annotations are not found (?????).
-
9. Re: SeamTest + TestNG doesn't find any TestNG annotations
coenos Feb 23, 2009 7:28 PM (in response to coenos)So, I followed the instructions to get TestNG test in Eclipse plus plugin running using this setup
, but then I get the
No annotations
problem (?????).Maybe a bug?
-
10. Re: SeamTest + TestNG doesn't find any TestNG annotations
marcioendo.marcioendo.gmail.com Feb 23, 2009 8:48 PM (in response to coenos)How did you setup your Eclipse project?
I'd suggest you create a sample project following these instructions and see what you are doing differently.
-
11. Re: SeamTest + TestNG doesn't find any TestNG annotations
coenos Feb 24, 2009 10:40 AM (in response to coenos)Yeah all is setup fine.
I have a Maven2 project and Eclipse Europa, running in Tomcat embedded Jboss.
I tested this also in a seam-gen project, but I get the same problem.
This is my test:
@org.testng.annotations.Test public class MyFacesTest extends SeamTest { @org.testng.annotations.Test public void testThisNow() throws Exception { new FacesRequest() { @Override protected void invokeApplication() throws Exception { QuotationFacade facade = (QuotationFacade) Component .getInstance("quotationFacadeImpl", true); assert true; } }.run(); } }
This is my suite:
<suite name="umbrella-war"> <test verbose="10" name="xxxx.facestest.MyFacesTest" annotations="JDK"> <classes> <class name="xxxx.facestest.MyFacesTest"> <methods> <include name="testThisNow"/> </methods> </class> </classes> </test> </suite>
- bootstrap directory from the Seam distr.
- hibernate-all.jar
- jboss-embedded-all.jar
- thirdparty-all.jar
- activation.jar
- jboss-seam-remoting.jar
- jboss-deployers-client-spi.jar
- jboss-deployers-core-spi.jar
- jboss-embedded-api.jar
- jboss-seam.jar
- jsf-api.jar
- el-api.jar
As far as I know this is the correct setup for integration testing Seam apps in Eclipse.
If you have any clue, please let me know,
Coen -
12. Re: SeamTest + TestNG doesn't find any TestNG annotations
marcioendo.marcioendo.gmail.com Feb 24, 2009 7:13 PM (in response to coenos)With Seam 2.1.0.GA, seam-gen project, I get tests running with no problems.
Your jars seems different though. Make sure you follow the readme.txt in the seam-gen project:
If you want to run tests using the Eclipse TestNG plugin, you'll need to add these jars to the top of your TestNG classpath. Using the Run Dialog, select xml suite to run, and add /lib/test/jboss-embedded-all.jar, /lib/test/hibernate-all.jar, /lib/test/thirdparty-all.jar, /lib/jboss-embedded-api.jar, /lib/jboss-deployers-client-spi.jar, /lib/jboss-deployers-core-spi.jar, and /bootstrap as the first entries in the User classpath.
-
13. Re: SeamTest + TestNG doesn't find any TestNG annotations
coenos Feb 25, 2009 11:02 AM (in response to coenos)Ok, I am running a Mavenized project.
The other jar's I need to add, otherwise the container won't start. I need Seam in the classpath. The other jar's are needed otherwise Seam won't start :)