You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cactus-user@jakarta.apache.org by Vincent Massol <vm...@octo.com> on 2001/12/19 21:50:18 UTC

JMS support in Cactus (WAS RE: [junit] Using JUnit or Cactus for testing JMS)

Alan,

Cactus does not currently support unit testing of JMS applications. At
the current time, it only has an HTTP injector. However, I am also
interested in unit testing JMS listeners, especially EJB Message-Driven
Beans. I'm planning to include a JMS injector (i.e. the ability to send
a JMS message in the beginXXX() method of a test case) and have a Cactus
MDB redirector which would make available the Message object to your
test case, in the same spirit as what Cactus currently does for
Servlets/Taglibs/Filters.

Thus a typical test case would be :

Public MyTestCase extends MDBTestCase
{
[...]
   public void beginXXX(JMSRequest request)
   {
      // set up the message to send
      [...]
   }

   public void testXXX()
   {
      MyMDBBean mdb = new MyMDBBean();
      mdb.onMessage(message);
      // perform asserts
   }
[...]
}

In summary :
- the focus is on unit testing MDB, not in testing the JMS server
- it is focused on testing MDB, not generic JMS listeners
- a subsequent version might provide a generic JMS listener redirector
(i.e. not a MDB)

What do you think ? Would you like this ?

Thanks
-Vincent

> -----Original Message-----
> From: Alan Pearlman Spencer [mailto:aspencer@mobileaware.com]
> Sent: 22 November 2001 09:43
> To: junit@yahoogroups.com
> Subject: RE: [junit] Using JUnit or Cactus for testing JMS
> 
> I suppose you are correct.
> I already have these tests. The way the DE as you call it
> sends messages is a function of how it is configured and I
> have tests for the "local" version that just uses Java calls.
> 
> I think what I am doing is moving into a system type test...
> 
> Thanks for the reference to Mock etc. I am a little unsure about
> these as we are using JUnit for unit and system/integration
> testing (differentiating these clearly) and I can (hopefully)
> have my unit tests not need mock objects and make sure the system
> tests cover this. Thoughts? We will be using HttpUnit and/or
> Cactus for the system tests. We define system tests to be ones
> the require the application to be deployed in a container
> and running...
> 
> Thanks,
> Alan.
> 
> -----Original Message-----
> From: Manu [mailto:mamago@bigfoot.com]
> Sent: 21 November 2001 19:08
> To: junit@yahoogroups.com
> Subject: RE: [junit] Using JUnit or Cactus for testing JMS
> 
> 
> I have not used JMS, therefore I can only guess...
> 
> What you want to test is the 'Decision Engine' (DE), right? Then, why
> don't you test the DE?
> 
> Approach:
> Write a couple of tests that use known 'Reject' and 'Accept' messages.
> If
> a test case allows a 'Reject' message through (no need to use the
whole
> JMS system, just put the pre-constructed message through the
appropriate
> procedure call), the test has failed. The opposite is also true: if an
> 'Accept' message is rejected, the test fails.
> 
> You could also test the 'Destination (To) Engine' (TE). Create a
couple
> of messages for some known destinations, and check that the chosen
> destination for the given message has been chosen. Otherwise, the test
> fails.
> 
> (If the DE and TE are combined into one method, try combining the test
> cases: known recepient/'Reject'/'Accept' pair. Otherwise, look into
> separating both procedures, although this may not be practical.)
> 
> In creating these tests, it might help to know about Mock Objects, or
> other alternatives (Object Mother, etc.). See the NG archives for
> pointers.
> 
> Regards,
> 
> Manuel Amago.
> mailto:mamago@bigfoot.com
> 
> > -----Original Message-----
> > From: Alan Pearlman Spencer [mailto:aspencer@mobileaware.com]
> > Sent: 21 November 2001 10:20
> > To: Cactus Users List; junit@yahoogroups.com
> > Subject: [junit] Using JUnit or Cactus for testing JMS
> >
> >
> > Hi All,
> > I was wondering if you could help me with something...
> > I am trying to write Unit/System tests...
> 
> 
> To unsubscribe from this group, send an email to:
> junit-unsubscribe@yahoogroups.com
> 
> 
> Your use of Yahoo! Groups is subject to
> http://docs.yahoo.com/info/terms/
> 
> 
> 
> ------------------------ Yahoo! Groups Sponsor
---------------------~-->
> Universal Inkjet Refill Kit $29.95
> Refill any ink cartridge for less!
> Includes black and color ink.
> http://us.click.yahoo.com/E11sED/MkNDAA/ySSFAA/NhFolB/TM
>
---------------------------------------------------------------------~->
> 
> To unsubscribe from this group, send an email to:
> junit-unsubscribe@yahoogroups.com
> 
> 
> Your use of Yahoo! Groups is subject to
http://docs.yahoo.com/info/terms/
> 




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>