7 Replies Latest reply on Aug 17, 2010 12:50 PM by rhauch

    Deploying and running tests via browser

    rhauch

      I understand that Arquillian offers a number of ways of running unit tests against components that are deployable into an app server. One such option is to package a bunch of unit tests as a WAR file so they can be deployed to a real JBoss AS instance. IIUC, I would use the Maven command line or an IDE to remotely run those unit tests.

       

      Does Arquillian allow me to use a browser (pointing to the deployed WAR) to remotely run those unit tests and see the test report? Essentially, I'd like to create a web application that runs a series of "qualification tests" against a POJO component deployed as JBoss AS services. I already have thousands of unit tests for this component (as a regular object in an Java SE environment), so these new qualification tests would merely verify these components are configured correctly and well-behaved. It is important, however, that a user can interactively run these tests.

       

      Thanks in advance!

        • 1. Re: Deploying and running tests via browser
          aslak

          I think what your asking is a combination of these issues:

           

          https://jira.jboss.org/browse/ARQ-31

          https://jira.jboss.org/browse/ARQ-231

          https://jira.jboss.org/browse/ARQ-232

           

          They are all planned, but not until later.

           

          Most of these issues are on a very basic idea stage, so if you have any input/requirements to how it should/could work, please feel free follow up on this forum post..

           

           

           

          -aslak-

          • 2. Re: Deploying and running tests via browser
            rhauch

            Thanks, Aslak!

             

            I think that's the basic gist of what I was asking for. Having Arquillian run as a service (https://jira.jboss.org/browse/ARQ-231) would allow the setup of a test and development server, into which can be deployed a number of different testing WARs. That'd be pretty useful.

             

            My original goal, however, is to have a WAR file that could be deployed to any JBoss AS instance in which my POJO service is already deployed (e.g., in a 'production' profile) without modifying that profile to deploy other 'non-production' services. This WAR file would be easily deployed that would perform qualification tests ("Do I have my profile and services set up and configured properly?") and/or performance tests ("What is the performance of Service X in this configuration on machine Y running against database Z?"). If this WAR file is completely self-contained, all I have to do is deploy this WAR file to any JBoss AS instance and run my tests. When I'm finished, I can undeploy and my JBoss AS instance is none-the-wiser.

             

            I'd anticipate my project would contain a new Maven module that builds the WAR file by including the Arquillian artifacts (with the HTML interface described by https://jira.jboss.org/browse/ARQ-232) and my tests (either as Maven dependencies or Java source in the 'src/test' area). Of course, it would rock if Arquillian could provide an archetype to allow me to generate this Maven module. :-)

             

            WDYT?

             

            Thanks!

            • 3. Re: Deploying and running tests via browser
              aslak

              aHa, I see what you mean..

               

              Basically any Arquillian test does what your describing. You don't have to deploy the 'service' your testing against as a part of the Test deployment if it's already on the server. That is up to you. But as of today, an Arquillian Test is a 1 to 1 mapping against a deployment. You can export that deployment during a test run and reuse it if you like, but the 'servlet invocation' part is not so human friendly and no html output support.

               

              So maybe what you want is:

               

              • Servlet invocation with HTML output
              • Arquillian Post Processor for the maven artifact-tests.jar file? Where Arquillian can modify your deployment in the same way it would when running using the TestFramework but output it as a file instead.

               

              ?

               

              -aslak-

              • 4. Re: Deploying and running tests via browser
                rhauch

                So maybe what you want is:

                 

                • Servlet invocation with HTML output
                • Arquillian Post Processor for the maven artifact-tests.jar file? Where Arquillian can modify your deployment in the same way it would when running using the TestFramework but output it as a file instead.

                 

                Exactly. A nice (simple) HTML interface for kicking off the tests and viewing the results.

                • 5. Re: Deploying and running tests via browser
                  aslak
                  • 6. Re: Deploying and running tests via browser
                    dan.j.allen

                    Randall Hauch wrote:

                     

                    So maybe what you want is:

                     

                    • Servlet invocation with HTML output
                    • Arquillian Post Processor for the maven artifact-tests.jar file? Where Arquillian can modify your deployment in the same way it would when running using the TestFramework but output it as a file instead.

                     

                    Exactly. A nice (simple) HTML interface for kicking off the tests and viewing the results.

                    Yep, I was thinking along these same lines when I proposed that Arquillian switch to (or expose) a REST interface for executing the tests. That way, you could deploy the test archive to the server as one step, then invoke the tests on demand using any variant of UI or other executor. You could call this a long-running test deployment, where the test case effectively becomes a service until it is undeployed.

                    • 7. Re: Deploying and running tests via browser
                      rhauch

                      Dan Allen wrote:

                       

                      [snip]

                       

                      Yep, I was thinking along these same lines when I proposed that Arquillian switch to (or expose) a REST interface for executing the tests. That way, you could deploy the test archive to the server as one step, then invoke the tests on demand using any variant of UI or other executor. You could call this a long-running test deployment, where the test case effectively becomes a service until it is undeployed.

                       

                      Exactly. Just don't forget the HTML interface so that I don't have to resort to a different tool to invoke the test or looking at the results.