Return-Path: Delivered-To: apmail-jakarta-cactus-user-archive@apache.org Received: (qmail 73472 invoked from network); 26 Sep 2002 17:34:56 -0000 Received: from unknown (HELO nagoya.betaversion.org) (192.18.49.131) by daedalus.apache.org with SMTP; 26 Sep 2002 17:34:56 -0000 Received: (qmail 5368 invoked by uid 97); 26 Sep 2002 17:35:37 -0000 Delivered-To: qmlist-jakarta-archive-cactus-user@jakarta.apache.org Received: (qmail 5330 invoked by uid 97); 26 Sep 2002 17:35:36 -0000 Mailing-List: contact cactus-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Cactus Users List" Reply-To: "Cactus Users List" Delivered-To: mailing list cactus-user@jakarta.apache.org Received: (qmail 5318 invoked by uid 98); 26 Sep 2002 17:35:35 -0000 X-Antivirus: nagoya (v4218 created Aug 14 2002) From: "Larry Tambascio" Subject: Re: Multi Step Tests - Better HttpUnit Integration To: "Cactus Users List" X-Mailer: CommuniGate Pro Web Mailer v.3.5.9a Date: Thu, 26 Sep 2002 13:34:51 -0400 Message-ID: In-Reply-To: <002101c26577$0bdfb8c0$230410ac@sappling> MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1"; format="flowed" Content-Transfer-Encoding: 8bit X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N Steve, See comments below. Hope some of them help, or give you ideas. Good luck!! -Larry On Thu, 26 Sep 2002 12:07:18 -0400 "Steve Appling" wrote: >What Cactus buys me is the ability to have a test running >in the container >with an instance of my servlet. After all of the setup >(which is what I am >using HttpUnit for) I can make asserts about the internal >state of my >Servlet. I don't have a way of doing this by just >looking at the servlet's >response with HttpUnit. Agreed. > >It may be possible to preset the state of my system >before this one call, >but it would be extremely complicated. The particular >servlets under test >rely on other parts of the web application being set up. Wouldn't those be setup within the container on startup? > Some of those >parts are outside of my control and do not have a >convenient mechanism to >initialize them to a particular state. It seems that the >most reliable way >of running my test in the actual context that the code >will execute under >when in production is to actually generate the required >pre-requisite >requests. Until one of those other parts changes or breaks, and then your test fails. What you're doing is fantastic integration or functional testing. It's not unit testing your servlet. (Oh, I hope I didn't open the "what is unit testing vs. functional testing" can of worms/debate.) It actually sounds like we're in similar boats, Steve. My project has complicated setup. The only way to instantiate the controller servlet is through the web-app container (Tomcat in my case). When I focused on what I minimally needed to test my piece of code, I found that there really wasn't as much needed for setup as I had feared. I instantiate my operations/actions and required beans in the setUp or testXxx methods, and then specifically invoke them. I'm sure there are more differences than similarities, however, between our situations. Perhaps some testing helper classes could facilitate environment setup?? What about those preliminary servlets?? Do you have tests for them?? It seems like there should be a starting servlet that simply needs the container/application up and running (and little else beyond maybe user login info). Start with that. Get a test case for that servlet that initializes the environment, and then move on to the next. You are running your Cactus servlet redirector in the same container as your application, right? Then it should have everything that all the other servlets have available to them. I don't mean to oversimplify or minimize your plight, but manually setting up the environment can be messy, especially if alot is needed. Your HttpUnit solution could well be the simplest way of setting up the context. That doesn't necessarily make it the best. Sorry I couldn't be of more help. > > >----- Original Message ----- >From: "Larry Tambascio" >To: "Cactus Users List" >Sent: Thursday, September 26, 2002 11:48 AM >Subject: Re: Multi Step Tests - Better HttpUnit >Integration > > >> Hi Steve, >> >> It sounds to me like what you really need is HttpUnit. >> I'm unsure what Cactus is buying you. What I have >> usually done is to setup the session as though all your >> preceding requests and responses have been made. My >>guess >> is that it would take about the same amount of code to >> setup all the session values as it does to do the >>HttpUnit >> web conversation thing. Finding out what those all are >> could be tedious, but it would make your tests cleaner >>and >> faster, IMHO. >> >> -Larry > > > >-- >To unsubscribe, e-mail: > >For additional commands, e-mail: > > -- To unsubscribe, e-mail: For additional commands, e-mail: