2 Replies Latest reply on Jan 22, 2008 3:28 AM by chawax

    Problem with Seam tests and "dependsOnGroups"

    chawax

      Hi,

      I have problems on TestNG tests for Seam components when using dependsOnGroups attribute of @Test annotation.

      For example, this test works :

      @org.testng.annotations.Test (groups="groupe1")
      public void testUsageUnite() throws Exception
      {
       new ComponentTest() {
       @Override
       protected void testComponents() throws Exception {


      while this one doesn't work :

      @org.testng.annotations.Test (
       groups="groupe2",
       dependsOnGroups="groupe1")
      public void testCreerUnitesOrganisationFromCodeUnique() throws Exception
      {
       new ComponentTest() {
       @Override
       protected void testComponents() throws Exception {


      The stack trace is the following :

      begin(fr.myCompanycore.organisation.test.ServiceOrganisationExterneTest) Time elapsed: 0.062 sec <<< FAILURE!
      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:169)
       at org.jboss.seam.contexts.ServletLifecycle.beginSession(ServletLifecycle.java:124)
       at org.jboss.seam.mock.BaseSeamTest.begin(BaseSeamTest.java:920)
       at org.jboss.seam.mock.SeamTest.begin(SeamTest.java:28)
       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:552)
       at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:322)
       at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:156)
       at org.testng.internal.Invoker.invokeMethod(Invoker.java:365)
       at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:785)
       at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:114)
       at org.testng.TestRunner.privateRun(TestRunner.java:693)
       at org.testng.TestRunner.run(TestRunner.java:574)
       at org.testng.SuiteRunner.privateRun(SuiteRunner.java:241)
       at org.testng.SuiteRunner.run(SuiteRunner.java:145)
       at org.testng.TestNG.createAndRunSuiteRunners(TestNG.java:901)
       at org.testng.TestNG.runSuitesLocally(TestNG.java:863)
       at org.apache.maven.surefire.testng.TestNGExecutor.executeTestNG(TestNGExecutor.java:69)
       at org.apache.maven.surefire.testng.TestNGXmlTestSuite.execute(TestNGXmlTestSuite.java:78)
       at org.apache.maven.surefire.Surefire.run(Surefire.java:132)
       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.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:308)
       at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:879)
      


      If I remove the dependsOnGroups attribute, the tests are successful.

      Is it a known problem ?