8 Replies Latest reply on Nov 30, 2005 3:47 AM by marius.oancea

    BookingTest.java n' TestNG

    frankrtg

      Hi!
      I'm in a hurry. I'm totally new with Seam and Jboss.

      I'm trying to run the TestNG BookingTest.java from eclipse but can´t.
      It shows at the console the following error:

      [RunInfo] Adding method selector: org.testng.internal.XmlMethodSelector@1ddebc3 priority: 10
      
      ===============================================
      org.jboss.seam.example.booking.test.BookingTest
      Total tests run: 0, Failures: 0, Skips: 0
      ===============================================
      
      Exception in thread "main" java.lang.NoClassDefFoundError: javax/servlet/ServletContext
       at java.lang.Class.getDeclaredConstructors0(Native Method)
       at java.lang.Class.privateGetDeclaredConstructors(Class.java:2328)
       at java.lang.Class.getConstructors(Class.java:1446)
       at org.testng.internal.TestNGClassFinder.isTestNGClass(TestNGClassFinder.java:149)
       at org.testng.internal.TestNGClassFinder.<init>(TestNGClassFinder.java:49)
       at org.testng.TestRunner.initMethods(TestRunner.java:256)
       at org.testng.TestRunner.init(TestRunner.java:192)
       at org.testng.TestRunner.init(TestRunner.java:164)
       at org.testng.TestRunner.<init>(TestRunner.java:120)
       at org.testng.eclipse.runner.RemoteTestNG$2.newTestRunner(RemoteTestNG.java:81)
       at org.testng.SuiteRunner$ProxyTestRunnerFactory.newTestRunner(SuiteRunner.java:356)
       at org.testng.SuiteRunner.privateRun(SuiteRunner.java:160)
       at org.testng.SuiteRunner.run(SuiteRunner.java:126)
       at org.testng.eclipse.runner.RemoteTestNG.run(RemoteTestNG.java:99)
       at org.testng.eclipse.runner.RemoteTestNG.main(RemoteTestNG.java:138)
      


      I don´t know what is happening. I think the my problem is related with the
      extends SeamTest
      .

      Someone give me a trace please.

      Thank you

        • 1. Re: BookingTest.java n' TestNG
          admin

          Put jsdk.jar into your classpath...

          • 2. Re: BookingTest.java n' TestNG
            frankrtg

            Hi thanks for replying my topic.

            But I did put my classpath and the error is still there, any other suggestion?

            • 3. Re: BookingTest.java n' TestNG
              marius.oancea

              How exactly you tried to execute the test from eclipse ?

              • 4. Re: BookingTest.java n' TestNG
                marius.oancea

                I will try to explaing how I do my tests from eclipse.
                Preconditions:
                - i have TestNG plugin installed
                Configuration:
                - I have the testcases (extensions of SeamTest)
                - testng.xml is in the same folder as the testcases

                Now if I press right mouse on testng and I choose "Run As TestNGSuite" i get an error:

                [RunInfo] Adding method selector: org.testng.internal.XmlMethodSelector@ce5b1c priority: 10
                FAILED: ro.intenso.rmc.test.LoginTest.testLogIn()
                java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
                at javax.faces.component.UIComponentBase.(UIComponentBase.java:45)

                Solution:
                - Rightmouse on testng.xml, RunAs->Run
                - Select TestNG and press New
                - Select "Suite" radio and browse to the testng.xml
                - Go to classpath tab and under "User Entries" add the jars you need.
                - Press Run
                - All works this way

                I hope this will also solve your problem.

                • 5. Re: BookingTest.java n' TestNG
                  frankrtg

                  Firstable, I want to thank you marius.oancea and admin.

                  I already solved my problem. The solution was so easy!
                  If you see this line from the console information:

                  Exception in thread "main" java.lang.NoClassDefFoundError: javax/servlet/ServletContext
                  


                  it is showing "javax/servlet/ServletContext"
                  It means servlet.jar is missing in Eclipse's configuration. So I added it as external jars and it fixed the problem. The three tests are runing!

                  Thanks anyway!

                  • 6. Re: BookingTest.java n' TestNG
                    christian.bauer

                    servlet.jar _is the same_ as jsdk.jar

                    • 7. Re: BookingTest.java n' TestNG
                      frankrtg

                      So I didn´t set the correct configuration in Eclipse.

                      How can I get this jsdk.jar? is it par of jsdk1.5?

                      I have to tell you I'm totally newbie.

                      • 8. Re: BookingTest.java n' TestNG
                        marius.oancea

                        You could use jboss-seam\lib\javax.servlet.jar