Skip to end of metadata
Go to start of metadata

Other References

You might want to review these first...

Unit Testing

Testing a simple macro is simple!

SimpleMacroTest.java
SimpleMacro.java

It gets more complex when you depend on hard-to-setup objects, but JMock or EasyMock can easily fake such objects:

HelloUserMacroTest.java
HelloUserMacro.java
AuthenticatedUserThreadLocal.getUser()
I'm assuming that AuthenticatedUserThreadLocal.getUser() works as expected, and so not unit-testing a 3rd-party library

Testing velocity templates make the scope of the unit-test larger (integration? component? ui test?), and though they make testing more difficult, it's not impossible or terribly hard. (see Lasse Koskela's Test Driven: Practical TDD and Acceptance TDD for Java Developers, particularly 5.3.2, Test-driving Velocity templates)

To be continued...

Integration Testing

Labels:
None
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.
  1. Feb 26, 2009

    Great notes, Dan! Keep 'em coming; they are very handy!

  2. Aug 13, 2009

    Anonymous

    This is very helpful. Thank you for posting it.