Return-Path: Delivered-To: apmail-jakarta-cactus-user-archive@apache.org Received: (qmail 27922 invoked from network); 14 Dec 2002 21:01:59 -0000 Received: from exchange.sun.com (HELO nagoya.betaversion.org) (192.18.33.10) by daedalus.apache.org with SMTP; 14 Dec 2002 21:01:59 -0000 Received: (qmail 2656 invoked by uid 97); 14 Dec 2002 21:03:11 -0000 Delivered-To: qmlist-jakarta-archive-cactus-user@jakarta.apache.org Received: (qmail 2640 invoked by uid 97); 14 Dec 2002 21:03:11 -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 2628 invoked by uid 98); 14 Dec 2002 21:03:10 -0000 X-Antivirus: nagoya (v4218 created Aug 14 2002) From: "Vincent Massol" To: "'Cactus Users List'" Subject: RE: how to test jsp? Date: Sat, 14 Dec 2002 20:59:57 -0000 Organization: OCTO Technology Message-ID: <000501c2a3b3$c3112770$0200a8c0@octovma> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook, Build 10.0.4024 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 In-Reply-To: Importance: Normal X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N Hi Leo, > -----Original Message----- > From: news [mailto:news@main.gmane.org] On Behalf Of Leos Literak > Sent: 14 December 2002 17:13 > To: cactus-user@jakarta.apache.org > Subject: how to test jsp? > > Hi all, > > I am new to cactus and I read all doc, though I wonder, > how to test jsp. I dont want to test tag library, but > execution of jsp. > > My situation: > > I am developing j2ee application and all my tests > are plain old jsp's, where I lookup interfaces and perform > all tests. Now my boss wants me to use cactus and automate > these tests. I like your boss ... :-) > > I'd like to stay with jsp, as they are easy to develope. You must the first one I hear saying that JSP are easy to develop! ;-) > Also they're reloading is great. So I created class > holding common testing methods, one is > > public static void setUnitTestResult(HttpServletResponse response, > boolean result) { > response.setHeader(UNIT_TEST_RESULT,new Boolean(result).toString()); > } ok. What is your test client (i.e. the part that will read the header and decide whether the test was successful or not)? It looks like you are using the same kind of approach as Cactus is using. > > I wanted to execute jsp from ServletTestCase and in > endTestJSP(WebReponse) to test that header value: > > public void endJSP(com.meterware.httpunit.WebResponse r) { > String result = r.getHeaderField(BaseServerTestCase.UNIT_TEST_RESULT); > assertNotNull("Unit test result is missing!",result); > assertEquals("Unit test failed!",Boolean.TRUE,new Boolean(result)); > } ok. I understand what you want to do. Note: you don't need HttpUnit integration for just testing the header. It will work but it means you're actually only using the client side part of Cactus (i.e. only a small portion of it). Thus Cactus is only providing you the bridge with the JUnit Test Runner. The Cactus Redirector is actually more a handicap than a help for what you want to do. The problem is that for each jsp test you'll have to write a Cactus/JUnit testXXX() test, which is a pain I think. Of course, you could write a generic testXXX() that will generically call each of your JSPs but your tests will appear as only a single test for JUnit and it will be a bit awkward. > > This approach is very simple and it is backward compatible > with current scenerio. It looks complex to me... :-) If you want to use Cactus I would drop your JSPs and instead use Cactus ServletTestCase. Java classes can also be reloaded by most containers so that shouldn't be an issue. > I would like to be able to develope > jsp with browser interaction and when it is ready, just > add it into ServletTestCase for automated build process. Not sure what you mean here by browser interaction. > I am open to advices for better approach. > > My problem is, that there is no single line in documentation > describing, how to open URL with jsp. This is Servlet/JSP API, not Cactus! Even though, it is documented in Cactus... (see below). > Doc for ServletTestCase > relies on fact, that you are instantiating servlet class, > which will not work with jsp. And JspTestCase seems to me > focused on tag library, and there is no way to execute jsp. Hum.. You said you read all the doc... Have you read this one: http://jakarta.apache.org//cactus/howto_jsp.html which explains what you can do with Cactus for testing JSPs! > > I'd appreciate any comments to my approach and advices for > JSP execution. How to open that URL. > > Thanks! > > Leo -Vincent -- To unsubscribe, e-mail: For additional commands, e-mail: