jakarta-cactus-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Leos Literak <liter...@seznam.cz>
Subject how to test jsp?
Date Sat, 14 Dec 2002 17:12:58 GMT
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'd like to stay with jsp, as they are easy to develope.
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());

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));

This approach is very simple and it is backward compatible
with current scenerio. 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.
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. 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.

I'd appreciate any comments to my approach and advices for
JSP execution. How to open that URL.



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