READING


Favourite & Recent

 
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:
Click here to send an email to the editor of this weblog. (via Radio)
ICQ:
191468
AIM:
mcannonbrookes
MSN:
mcannonbrookes
Email:
mike at atlassian.com
Cell:
(612) 416 106090
Blog Chalk:
blogchalk: Mike/Male/21-25. Lives in Australia/Sydney/Glebe and speaks English. Spends 80% of daytime online. Uses a Fast (128k-512k) connection.


 
BUILT USING

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:

  1. 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.
  2. 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.
  3. 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  comment []   
 



October 2002
Sun Mon Tue Wed Thu Fri Sat
    1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31    
Sep   Nov


TOPICS

Home, J2EE, Java, OSX, Open Source, Atlassian, Australia, Blogs

this site is a java.blog


WRITING

View All


LOVE THESE


XML FEEDS

Subscribe to "rebelutionary" in Radio UserLand.

Click to see the XML version of this web page.


SITES I READ