jakarta-cactus-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Leos Literak <liter...@centrum.cz>
Subject Re: how to test jsp?
Date Sat, 14 Dec 2002 18:19:52 GMT
 > From what you have described you are looking for a functional test 
environment, not a unit test environment. HTTPUnit might be more in line 
with your requirements. Cactus is designed to test the components of a 
web application --  mostly servlets, filters, tags. If you are just 
wanting to test that a JSP gets executed/built properly, use HTTPUnit.

thanks for hint. I am not 100% sure, I am going right way.
The stuff from JSP could be moved to ServletTestCase, but
I would lose possibility to open test in browser, as I can
now with JSP.

JSP is in fact typical unit test:

try {
   MessageTemplatePK templatePK = template.getPrimaryKey();
   template2 = templateLocalHome.findByPrimaryKey(templatePK);
   out.println("<li>Template found by primary key");
} catch (Exception) {
   out.println("<b>FAIL:</b> Template not found by primary key!");

My approach is rather hack or workaround, which degrades it
to true/false scenerio. I am very new to cactus and it is
hard to really understand it. I would welcome many examples
of typical use cases, so I could find my one.

 > What you have described, however, suggests that you have at least 
some business logic in your view (JSP) and might want to consider moving 
that functionality up the hierarchy a bit.
 > As far as your needs are concerned, read the following for more info:
 > http://jakarta.apache.org/cactus/mockobjects.html

I will.

As I think about it and with today's investigation and attempts, it
would be best to move test logic of jsp to ServletTestCase. But I would
miss jsp development simplicity and execution from browser :-(

Hint for developers: what about to create cactus.webui.TestRunner? :-)


Leos Literak
http://AbcLinuxu.cz - tady je tucnakum hej!

To unsubscribe, e-mail:   <mailto:cactus-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:cactus-user-help@jakarta.apache.org>

View raw message