6 Replies Latest reply on Aug 23, 2011 8:09 AM by kennardconsulting

    Use Arquillian with WebTest?

    kennardconsulting

      Hi guys,

       

      I'm trying to integration test a JSF app running on JBoss AS 6. Arquillian seems like the obvious choice. However the documentation opens with examples of testing EJB, CDI, JPA and JMS - but not JSF?

       

      I understand Arquillian opens new possibilities for in-container testing, but is it still the right choice for simply deploying the app, starting the container, executing a WebTest script (i.e. I want to check the HTML being rendered), and then shutting the container down again? All in Maven?

       

      I tried copying this pom.xml. It seems to create a local copy of JBoss AS 6 in /target (great!), and possibly start it (unclear), but if I try running a WebTest script I get a 'connection refused'? I want something similar to the tomcat-maven-plugin or the jetty-maven-plugin, but for JBoss. Is Arquillian the right solution?

       

      Regards,

       

      Richard.

        • 1. Re: Use Arquillian with WebTest?
          aslak

          Arquillian has two run modes, in container and as client. For WebTesting you normally want to be running as client.

          https://docs.jboss.org/author/display/ARQ/Test+run+modes

           

          Arquillian has a extension called Drone which is responsible for bootstreaping all WebTest related artifacts, e.g. HTMLUnit, Ajocado, Selenium, WebDriver etc..

          https://docs.jboss.org/author/display/ARQ/Drone

           

          Some examples can be found here:

          https://github.com/arquillian/arquillian-showcase/tree/master/ui

          1 of 1 people found this helpful
          • 2. Re: Use Arquillian with WebTest?
            kennardconsulting

            Aslak,

             

            Many thanks for your reply, and your work on Arquillian!

             

            I apologise for not being clear: when I said WebTest, I actually meant Canoo WebTest (http://webtest.canoo.com). The Drone extension says it supports "Arquillian Ajocado, Selenium or WebDriver". The reason I like WebTest is that everything is configured in XML, with no Java code at all. I find this works well for testing XHTML output.

             

            The Arquillian examples seem to involve writing a Java class? I was hoping to avoid this? Can Arquillian just start/deploy/stop the server from Maven? Are there any examples using Canoo WebTest? I found this jboss-maven-plugin which is close to my (simple) needs. Has Arquillian superseded this approach?

             

            Regards,

             

            Richard.

            • 3. Re: Use Arquillian with WebTest?
              aslak

              Arquillian has this: https://github.com/arquillian/arquillian-maven But i'm not sure it will actually help you much here.

               

              It can be bound to DEPLOY or UNDEPLOY to a Remote container, but if you using something that is STARTED as part of the run, then this plugin will basically STOP it after DEPLOY, since the plugin holds on to the container instance. Your closest bet would be to use RUN, but RUN will block until you your self stop it, and i'm afraid other Maven plugins won't be able to execute whithin that time.

               

              One possibility is to only write one TestClass that use Arquillian and defines your @Deployment, and whithin the @Test method simply start WebTester manually and point it to the XML files. Assuming WebTester support 'injection' of URLs, it could look something like this:

               

               

              @RunWith(Arquillian.class)
              public class WebTestserTestCase
              {
                        @Deployment(testable = false)
                        public static WebArchive create() 
                        {
                             return ShrinkWrap.create(WebbArchive.class)
                                       ....;
                        }
              
              
                        @ArquillianResource
                        private URL baseURL;
                
                        @Test
                        public void shouldExecuteWebTesterSuite() throws Exception
                        {
                             new WebTester(xmlFile, baseURL).run();
                        }
              }
              
              
              • 4. Re: Use Arquillian with WebTest?
                kennardconsulting

                Okay, lodged a feature request: https://issues.jboss.org/browse/ARQ-556

                 

                Thanks,

                 

                Richard.

                • 5. Re: Use Arquillian with WebTest?
                  aslak

                  Could you provide a simple example of the setup you use today ?

                  • 6. Re: Use Arquillian with WebTest?
                    kennardconsulting

                    Sure: I've updated the JIRA above.