You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Shinobu Kawai <sh...@gmail.com> on 2004/11/09 14:03:26 UTC
Testing Velocity with JUnit.
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 Kawai
--
Shinobu Kawai <sh...@gmail.com>
---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org
Re: Testing Velocity with JUnit.
Posted by Shinobu Kawai <sh...@gmail.com>.
Hi Clifton,
> That's pretty slick! Can I share this with the Javalobby community? I'm
> always looking for new stuff to post there and this is a good testing
> facility that many (like myself) would benefit from.
No problem. It's always nice to know that I'm doing good for someone. ;)
Best regards,
-- Shinobu Kawai
--
Shinobu Kawai <sh...@gmail.com>
---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org
Re: Testing Velocity with JUnit.
Posted by "Clifton C. Craig" <cc...@icsaward.com>.
Shinobu,
That's pretty slick! Can I share this with the Javalobby community? I'm
always looking for new stuff to post there and this is a good testing
facility that many (like myself) would benefit from.
Clifton C. Craig, Software Engineer
Intelligent Computer Systems - A Division of GBG
2101 Embassy Drive
Lancaster, PA 17603
Phone: 717-295-7977 ext. 621
Fax: 717-295-7683
ccc@icsaward.com
ccraig@gbg.com
Shinobu Kawai 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 Kawai
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org
Re: Testing Velocity with JUnit.
Posted by Shinobu Kawai <sh...@gmail.com>.
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 <sh...@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 <sh...@gmail.com>
---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org