velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Shinobu Kawai <shinobu.ka...@gmail.com>
Subject Re: Testing Velocity with JUnit.
Date Fri, 06 May 2005 23:02:29 GMT
Hi all,

My server has been down for like half an year, so I decided to put all
this in the wiki:
    http://wiki.apache.org/jakarta-velocity/TestingVelocity

On 11/9/04, Shinobu Kawai <shinobu.kawai@gmail.com> wrote:
> Hi all,
> 
> I'd like to share how I've been testing Velocity with JUnit lately.
> 
> First, I made a base TestCase class, AbstractVelocityTestCase.
> 
> http://sylow.no-ip.com/maven/site/ShinobuDemo/xref/org/ieee/shinobu/demo/velocity/AbstractVelocityTestCase.html
> This class has the properties needed to test VTL:
> - engine : The VelocityEngine to use for template processing.
> - template : The VTL String to process.
> - context : The Context to use when processing the template.
> - expected : The expected result String.
> 
> After configuring these properties, I call assertVelocity(), which
> will process the template and compare it with the expected result.
> PublicFieldUberspectTest shows an example of the general flow.
>  http://sylow.no-ip.com/maven/site/ShinobuDemo/xref-test/org/apache/velocity/tools/generic/introspection/PublicFieldUberspectTest.html
> 
> Many other example tests can be found at:
>  http://sylow.no-ip.com/maven/site/ShinobuDemo/xref-test/org/ieee/shinobu/demo/velocity/package-summary.html
> 
> For testing ViewTools, I have made AbstractVelocityMockStrutsTestCase
> which uses strutstestcase.
>  http://sylow.no-ip.com/maven/site/ShinobuDemo/xref/org/ieee/shinobu/demo/velocity/AbstractVelocityMockStrutsTestCase.html
> cf. http://strutstestcase.sourceforge.net/
> The flow of testing remains the same.
> 
> As always, any comments are welcome.  :)

Best regards,
-- Shinobu

--
Shinobu Kawai <shinobu.kawai@gmail.com>

---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


Mime
View raw message