4 Replies Latest reply on Nov 8, 2004 9:28 PM by Scott Stark

    auto-testing my JBoss application

    Dan Thompson Newbie

      Testing for us has always been a five step process. Run the build script. Bring down the jboss server. Copy the resulting ears to the a jboss server deploy directory. Start the jboss server. (Our app doesn't hot deploy anymore, different issue... ) Start clicking on the web front end and try to break stuff. (no automated test scripts or junit tests... sad, sad, sad... this is what I'm really trying to fix in our process).

      So I'm trying to fix all this. But here's what I don't understand. 1) How can I stop the Jboss server (if is it already running) from my Ant script. 2) How can I restart the jboss server from my ant script? 3) How can I make the ant script wait until the jboss server is up? 4) How can I check to see that there were no exceptions thrown during deployment?

      Once the server is up and running, then I know how to run JUnit, Cactus and HttpUnit tests against it. But the real issues are the those 4 above.

      Once I have this working, I can move the whole thing into cruise control, which is my end goal.


        • 1. Re: auto-testing my JBoss application
          Mike Finn Apprentice

          If you're using Ant 1.6.x, you should be able to start JBoss using the exec task. Something like:

          <exec dir="/path/to/jboss-3.2.2/bin" executable="bash" spawn="true">
           <arg line="run.sh"/>
           <arg line="-c default"/>

          Stopping it would just be something like so:
           <arg line="shutdown.sh"/>
           <arg line="--server jnp://localhost:1099"/>

          You could wait for it to be started by using waitfor task:
           <waitfor maxwait="5" maxwaitunit="minute" checkevery="500">
           <http url="http://localhost:8080/jmx-console"/>

          I would write a custom JSP page that checked to make sure everything you need was up (and return a 500 if not), unless someone knows of a call you could fabricate (like with the get task) to html adaptor to see if the server is 'done' starting.

          To look for errors on startup or in log, you're best bet is to find/write a task that greps your logfile for errors.


          • 2. Re: auto-testing my JBoss application
            Mike Finn Apprentice

            Sorry - if it wasn't clear, that custom JSP page I referred to would be called by the waitfor/http task instead of jmx-console. Fingers are typing faster than brain....

            • 3. Re: auto-testing my JBoss application
              Dan Thompson Newbie

              Thanks, nice and simple, just the way I like it.
              Good job!

              • 4. Re: auto-testing my JBoss application
                Scott Stark Master

                The testsuite/build.xml in the latest releases (4.0.1RC1, 3.2.7RC1) illustrates how we start/stop several jboss configurations to test clustering, customization of the tomcat container to use ssl, running jboss with a security manager, etc.