Other References
You might want to review these first...
- Testing your Plugin using the Atlassian Plugin SDK

- Testing your plugin

- The tests in the Confluence Chart Plugin
are an extremely helpful reference. - http://www.mundoreves.com/display/HOME/2009/01/29/Confluence+plugin+integration+testing

- Integration Testing of Confluence Plugins
(CustomWare)
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
2 Comments
comments.show.hideFeb 26, 2009
Cody Burleson
Great notes, Dan! Keep 'em coming; they are very handy!
Aug 13, 2009
Anonymous
This is very helpful. Thank you for posting it.