
READING
DEVELOPING
JIRA is Atlassian's J2EE bug tracking, issue tracking and project management package.
CONTACTING MIKE
I'm always happy to hear from you. Sometimes it helps to read "About" first.
Web: (via Radio)
ICQ:191468
AIM:mcannonbrookes
MSN:mcannonbrookes
Email:mike at atlassian.com
Cell:(612) 416 106090
Blog Chalk:
|
 |
rebelutionary Mike Cannon-Brookes on Java, J2EE, OSX, Open Source, Australia, Atlassian, Bug Tracking, JIRA and more...
 |
Monday, 14 October 2002 |
|
I spent about 2 hours today trying to slowly build a mock object test suite for JIRA. Actually not a test suite, just a few tests of increasing complexity.
Some mental rules I've made for myself:
- Try as hard as you can to only test the method or class you are testing. Often this means breaking one method into two, changing method protection or at the extreme introducing new classes.
- If you can't test it via a mock - your architecture is probably too coupled! I found the 2 hours of testing very informative, I have already decoupled our architecture in a few places as a result - replacing static methods with interfaced factories and such like.
- Keep it simple, yet be flexible! I found I had to keep thinking of exactly what I was trying to test (and no more!) yet at the same time thinking whether I could simply change my code to make my testing life easier.
Rule 2 is especially interesting, because mock testing forces you to think of your code as an API - as you now have two 'clients' (your other code, and your tests). I think in the end it will lead to a much nicer architecture.
Also - our mock tests run hundreds of times faster than our Cactus ones, which is great for rapid development. It certainly seem to encourage (or rather not discourage?) you to write tests.
More rules later - the light rail has reached Glebe!
|
7:54:56 PM |
|
|
|
|
|
TOPICS
Home, J2EE, Java, OSX, Open Source, Atlassian, Australia, Blogs

WRITING
View All
LOVE THESE
Atlassian,
IDEA,
OpenSymphony,
Orion,
J2EE,
Webwork,
XDoclet,
Glue,
EXML,
OFBiz,
Google,
Apple,
OSX,
XBox,
Red Hat,
Radio
XML FEEDS

SITES I READ
|