4 Replies Latest reply on Sep 2, 2014 4:07 AM by andrew10961

    Splitting tests across multiple files without causing redeployment per file

    andrew10961

      I'm using Arquillian with ShrinkWrap to create a deployable war archive offering REST services which I test.

       

      The number of tests has risen to become unmanageable in one file, yet if I split tests across multiple files I run into problems.

       

      Ideally I'd like to have all classes contains methods annotated with @test inherit from an ancestor which contains a @deployment directive in which the deployment URL can be read; the goal is a single deployment.

       

      I have not managed to split tests in this way without causing a redployment of the archive for each block of tests, not what I want.

       

      Is there any advice on how to create a large number of tests across multiple files that collectively only require a single deployment?

       

      My JBoss BOM seems to contain Arquillian 1.0.3.Final. 

       

      Thanks..

        • 1. Re: Splitting tests across multiple files without causing redeployment per file
          kwintesencja

          Hi andrew,

           

          there is an issue about that on arquillian jira, you can follow it here: [ARQ-197] Research support for @Deployment on multiple levels - JBoss Issue Tracker

           

           

          for now if you use testable = true deployments you use CDI injection among tests to leverage same deployment, see an example here.

           

          You still can try suite extension: ingwarsw/arquillian-suite-extension · GitHub but dont know if its released yet or if it will be compatible with A|RQ-197

           

          i hope that helps.

          • 2. Re: Splitting tests across multiple files without causing redeployment per file
            andrew10961

            Rafael, thanks, let me try a little further.

             

            Do you think I'm being hampered by only running with 1.0.3 ?    I'm

            struggling to override the contents of my JBoss BOM which limits me to

            this..

             

            Andrew

             

             

            On Mon, Sep 1, 2014 at 3:42 PM, Rafael Pestano <do-not-reply@jboss.com>

            • 3. Re: Re: Splitting tests across multiple files without causing redeployment per file
              kwintesencja

              Hi, i still coudnt reach you(maybe because i'm out of caffeine here) but i didnt get the the relation between the phrases below:

               

               

              Is there any advice on how to create a large number of tests across multiple files that collectively only require a single deployment?

               

              and

               

              My JBoss BOM seems to contain Arquillian 1.0.3.Final. 

               

              my answer refers to first quote.

               

              If you have an example maybe i can help you

              • 4. Re: Re: Splitting tests across multiple files without causing redeployment per file
                andrew10961

                Hi Rafael thanks for following up.

                 

                No real connection between the two that I'm aware of; I just wondered if

                requiring multiple deployments was a known issue, and whether later

                versions of Arquillian help (I've seen 1.1.5.Final around).

                 

                I have a solution that works at the moment.. but it's verbose, ugly, and

                won't work forever.

                 

                TestBase.java

                - defines the shrinkwrap web archive using @deployment

                - a test client which references the value of a deploymentURL injected

                using @ArquillianResource

                 

                RestTest

                - extends TestBase (mainly for reasons of tidiness, could be combined with

                TestBase)

                - lists each of the test methods annotated using @test, and @RunAsClient,

                and order

                - each test method contains a single line that invokes tests whose logic is

                actually defined elsewhere, in static methods across a large number of files

                - at each invocation, a test client is generated using a method on

                TestBase.java which has access to the deployment url.

                 

                This runs a large number of @RunAsClient tests, across a number of files,

                in a specific order, within a single deployment.

                 

                However, it will soon become unwieldy too.

                 

                What I would really like:

                - a single deployment of the archive for all tests

                - RunAsClient tests using this deployment split across multiple classes,

                ideally echoing the package structure of the classes under test.

                - the ability to inject the archive's deployment URL into test classes

                 

                 

                 

                 

                On Mon, Sep 1, 2014 at 7:59 PM, Rafael Pestano <do-not-reply@jboss.com>