struts-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig McClanahan (JIRA)" <j...@apache.org>
Subject [jira] Commented: (SHALE-133) [Shale] "Extend shale-test-framework to support rendering JSF pages outside a container"
Date Wed, 07 Jun 2006 04:56:16 GMT
    [ http://issues.apache.org/struts/browse/SHALE-133?page=comments#action_37447 ] 

Craig McClanahan commented on SHALE-133:
----------------------------------------

Are you looking for a scenario where a complete JSP page (including both template text, possibly
custom tags from other tag libraries, and JSF component tags) would be rendered in a unit
test environment, so that you could then analyze the output?  That's a pretty ambitious undertaking
... it would require essentially a complete JSP compiler, a mock container that understands
all the nuances of custom tag lifecycles (which is *very* complex in a JSP < 2.0 environment),
and -- most importantly -- you  would have to be able to mock up enough of the application's
data beans so that binding expressions on the JSF components return meaningful results.  We
do something similar to this inside Sun Java Studio Creator (my day job is being the architect
for this tool), and I can tell you from experience that it's non-trivial to provide a convincing
simulation of the container environment.

What I prefer to do for this type of testing is to do "functional" or "system integration"
tests, where the application is actually deployed into a real container.  Then, I write a
set of JUnit based tests using a library like HtmlUnit (from SourceForge) that simulates a
user filling out a form, clicking a button to submit it, and so on ... the response is then
parsed into a "DOM" tree that can be examined to make sure that the rendered pages are correct.
 This can be done at a fine-grained level to evaluate the markup created by individual JSF
components, or at a coarse grained level to ensure things like navigation are working properly.
 It also makes the actual test cases much simpler, because you don't have to set up the application
data part of the model -- you're testing the real application, with real application data.
 And, you don't have to worry about whether the simulated container behaves exactly like the
real container does (differences might hide bugs when you program to the simulated container
to get your tests to pass).  Finally, a robust application is going to need tests like this
anyway, so it would seem to be duplicate work to test complete page rendering "outside the
container."

What do you think of the suggestion of building functional tests, as described above, instead
of trying to set up a convincing simulation of the JSP page exectuion environment outside
the container?


> [Shale] "Extend shale-test-framework to support rendering JSF pages outside a container"
> ----------------------------------------------------------------------------------------
>
>          Key: SHALE-133
>          URL: http://issues.apache.org/struts/browse/SHALE-133
>      Project: Shale
>         Type: Improvement

>  Environment: Operating System: All
> Platform: All
>     Reporter: Lasse Koskela
>     Priority: Minor

>
> It would be nice to be able to render JSF pages along with standard and custom
> components in similar manner to what JspTest (http://jsptest.sf.net) provides
> for regular JSPs.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/struts/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


Mime
View raw message