3 Replies Latest reply on Sep 6, 2002 7:16 PM by Douglas Campbell

    Strategy for junit like testing of JCA Adapters

    Douglas Campbell Newbie


      I'm looking for a good testing strategy for automating testing of any JCA adapter I or my team comes up with.

      Currently, I'm hacking together something which runs from ant , looks up an EJB on a remote server, and executes a method which wraps a junit testcase. It needs to be able to run unattended and be initiated from an external (to the container) JVM.

      What I've described above seems all wrong. I'm open to suggestions.


        • 1. Re: Strategy for junit like testing of JCA Adapters
          Arno de Quaasteniet Newbie


          We use http://sourceforge.net/projects/junitejb for testing the resource adapter we wrote and are quite happy with it. It's included in the Jboss source code, and you can also find some samples of usage there (look for testcases that extend EJBTestCase). The sourceforge site does not contain any documentation as far as I can see.

          It enables you to write unittests that are executed on the server without having to write client code. So it's pretty much the same as writing normal unit tests.



          • 2. Re: Strategy for junit like testing of JCA Adapters
            David Jencks Master

            Using junitejb is probably better than what I'm about to suggest for most of your purposes, since it (I think, I haven't looked) runs your calls through the regular ejb interceptor stack, supplying transactions, security, etc, and everything the ConnectionManager wants and needs to do its job. If you want more isolated tests that are still running inside jboss you can also write an mbean to do them, deploy the mbean in a test-service.xml file, and call the mbean's methods from your junit test. I'd subclass JBossTestCase, it has utility methods to help with this.

            There are a couple of examples of doing this in cvs head in ....test/jca/inflow.

            • 3. Re: Strategy for junit like testing of JCA Adapters
              Douglas Campbell Newbie

              David, and Arno thanks for the tips. I went with the junitejb for now and after figurign out how I need to deploy the whole setup, it's working well.

              That being said I have a couple question about junitejb
              1. How does one go about producing the normal output of junit like junit.textui.TestRunner provides or possibly even some of the fancier html type output. It seems as if the EJBTestRunner output configurability is limited to stacktraces in whatever console created it.

              2. where are the intercept points for configuring the test output?

              Code samples greatly appreciated.