2 Replies Latest reply on Jun 29, 2011 6:45 AM by benkirby

    Multiple test classes, one deployment: workaround?

    benkirby

      Hi,

       

      We've recently started using JUnit with Arquillian Alpha5 on a remote JBoss AS 6 to test our JPA DAO beans, using CDI injection. All the test classes inherit a @Deployment method from a common superclass. It's working brilliantly, allowing us to test our database queries more easily than ever before - so thanks!

       

      The thing is, we'd like to run all the tests in one go, and we've now got almost 300 test classes. We can do this with our current setup, but it results in each test class being wrapped in its own test.war, which is deployed on the remote server, the tests executed, and then the war undeployed. As we progress through the test classes (on the same instance of the server), the deploy and undeploy steps take longer and longer, until we're waiting over 10 minutes for a test class to finish it's run cycle. The tests themselves aren't the issue, it's just the deploy/undeploy time.

       

      Because of this, we'd ideally like to put all these test classes in one test.war, so we don't suffer the hot-deploy overhead. I've seen from other posts on here that this functionality is not currently available, but will be coming down the line. So, for use until then, I've been trying a workaround, whereby we have one test class, marked to be run with Arquillian, with one annotated test method. This method then programmattically finds all the 'real' test classes, finds their annotated @Test methods, and attempts to run them using Java Reflection (method.invoke). Quite fairly, this doesn't currently work, because the 'real' test methods refer to injected beans which haven't been enriched by Arquillian, because only the 'collecting' test class is known to/run by it.

       

      So, is there any way in which the Arquillian classes which do the enrichment in the normal lifecycle can be called from within a test, which will be run on the server, so I can enrich the test classes before I invoke their methods? We don't need the deploy steps, purely the enrichment, but I couldn't find a way in at that stage via the API.

       

      Secondly, have you encountered the hot-deploy slowdown  yourselves, and can you suggest any other workarounds for it? I'm not sure we're at the point where bringing a new server up each time would be quicker overall.

       

      Finally, is there a date for when a release containing the 'multiple test classes, one deployment' functionality will be released?

       

      Hope you can help, thanks!

        • 1. Re: Multiple test classes, one deployment: workaround?
          aslak

          Are you useing a Remote or a Managed container?

           

          The slow down could be due to memory leaks, perm gen etc. We have test suites where we use the maxTestClassesBeforeRestart option. This basically tells Arquillian to restart the Container for every N testcase, but will only work for ManagedContainers since thy are the only ones we start.

           

          We're targeting the Multi Test pr Deployment feature for 1.1. It's a bit tricky on how it should work, specially with regards to multi deployments and multi containers.

          • 2. Re: Multiple test classes, one deployment: workaround?
            benkirby

            Thanks Aslak - I bet!

             

            We're currently using the remote container - will perhaps try managed, to take advantage of the restart.

             

            I take it the attempt to use Arquillian classes to enrich classes inside a running test was a bit far-fetched! Anyway, we'll (eagerly) await 1.1. Keep up the good work!