velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Shinobu Kawai <>
Subject Testing Velocity with JUnit.
Date Tue, 09 Nov 2004 13:03:26 GMT
Hi all,

I'd like to share how I've been testing Velocity with JUnit lately.

First, I made a base TestCase class, AbstractVelocityTestCase.
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.

Many other example tests can be found at:

For testing ViewTools, I have made AbstractVelocityMockStrutsTestCase
which uses strutstestcase.
The flow of testing remains the same.

As always, any comments are welcome.  :)

Best regards,
-- Shinobu Kawai

Shinobu Kawai <>

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message