Uploaded image for project: 'Application Server 7'
  1. Application Server 7
  2. AS7-1659

TestNG arquillian test in as-client mode not working

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Do
    • Icon: Blocker Blocker
    • None
    • 7.0.1.Final
    • Test Suite
    • None
    • Hide

      Using mixed mode like...

      public class ClientTest extends Arquillian {
      
          @Deployment
          public static JavaArchive createTestArchive() {
      
              return ShrinkWrap.create(JavaArchive.class, "test.jar")
                  .addClass(ClientTest.class)    
                  .addAsManifestResource(EmptyAsset.INSTANCE,
                      ArchivePaths.create("beans.xml"));
          }
      
          @RunAsClient
          @Test
          public void testAsClient() {
            // Testing...
          }
      
      }
      

      But this is not usable in case of @ShouldThrowException(...) because it forces deployment to be testable = false.

      Show
      Using mixed mode like... public class ClientTest extends Arquillian { @Deployment public static JavaArchive createTestArchive() { return ShrinkWrap.create(JavaArchive.class, "test.jar" ) .addClass(ClientTest.class) .addAsManifestResource(EmptyAsset.INSTANCE, ArchivePaths.create( "beans.xml" )); } @RunAsClient @Test public void testAsClient() { // Testing... } } But this is not usable in case of @ShouldThrowException(...) because it forces deployment to be testable = false.

      While running simple TestNG arquillian test in as-client mode like...

      public class ClientTest extends Arquillian {
      
          @Deployment(testable = false)
          public static JavaArchive createTestArchive() {
      
              return ShrinkWrap.create(JavaArchive.class, "test.jar")
                  .addClass(ClientTest.class)    
                  .addAsManifestResource(EmptyAsset.INSTANCE,
                      ArchivePaths.create("beans.xml"));
          }
      
          @Test
          public void testAsClient() {
            // Testing...
          }
      
      }
      

      ..deployment is corrupted but does not lead into deployment failure.

      15:07:52,888 WARN  [org.jboss.modules] (MSC service thread 1-1) Failed to define class org.jboss.cditck.arquillian.client.ClientTest in Module "deployment.test.jar:main" from Service Module Loader: java.lang.LinkageError: Failed to link org/jboss/cditck/arquillian/client/ClientTest (Module "deployment.test.jar:main" from Service Module Loader)
      	at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:401)
      	at org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:261)
      	at org.jboss.modules.ModuleClassLoader$1.loadClassLocal(ModuleClassLoader.java:76)
      	at org.jboss.modules.Module.loadModuleClass(Module.java:588)
      	at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:183)
      	at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:358)
      	at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:307)
      	at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:101)
      	at org.jboss.as.weld.WeldModuleResourceLoader.classForName(WeldModuleResourceLoader.java:68) [jboss-as-weld-7.0.1.Final.jar:7.0.1.Final]
      	at org.jboss.weld.bootstrap.BeanDeployer.addClass(BeanDeployer.java:82) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
      	at org.jboss.weld.bootstrap.BeanDeployer.addClasses(BeanDeployer.java:134) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
      	at org.jboss.weld.bootstrap.BeanDeployment.createBeans(BeanDeployment.java:191) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
      	at org.jboss.weld.bootstrap.WeldBootstrap.deployBeans(WeldBootstrap.java:368) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
      	at org.jboss.as.weld.WeldContainer.start(WeldContainer.java:81) [jboss-as-weld-7.0.1.Final.jar:7.0.1.Final]
      	at org.jboss.as.weld.services.WeldService.start(WeldService.java:89) [jboss-as-weld-7.0.1.Final.jar:7.0.1.Final]
      	at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1765)
      	at org.jboss.msc.service.ServiceControllerImpl$ClearTCCLTask.run(ServiceControllerImpl.java:2291)
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) [:1.6.0_22]
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) [:1.6.0_22]
      	at java.lang.Thread.run(Thread.java:679) [:1.6.0_22]
      Caused by: java.lang.NoClassDefFoundError: org/jboss/arquillian/testng/Arquillian
      	at java.lang.ClassLoader.defineClass1(Native Method) [:1.6.0_22]
      	at java.lang.ClassLoader.defineClass(ClassLoader.java:634) [:1.6.0_22]
      	at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) [:1.6.0_22]
      	at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:397)
      	... 19 more
      

      Probably because of arquillian service is not deployed along with test archive and dependencies are not added to test archive manifest.

      In-container mode works ok.

              arubinge@redhat.com Andrew Rubinger (Inactive)
              mkouba@redhat.com Martin Kouba
              Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: