Create Journals
Update Journals

Journals
Find Users
Random

Read
Search
Create New

Communities
Latest News
How to Use

Support
Privacy
T.O.S.

Legal
Username:
Password:

darren (webgeek) wrote,
@ 2009-01-12 11:21:00
Previous Entry  Add to memories!  Add to Topic Directory  Tell a Friend!  Next Entry

    Current mood:okay

    Testing testing, one, two, one two
    I'm getting really into unit testing in the current project. Before xmas I was working on adding to the model of an existing application; I was given one particular corner to work on. And alongside coding the model I had to add to our NUnit tests, this wasn't quite test driven development (write the tests, write the model) but it was close (write the first iteration of the model, use NUnit as a test harness)

    Writing the tests was especially fun because this corner of the model had a fair bit of business logic in it, hence I had to try to out-think myself and test all possible corners of the business logic. It's quite fun trying to out-think oneself. It's also most satisfying working on test when you see everything go green*. In fact I think that's a point worth noting for any project manager: programmers like to see their code "pass", it satisfies our need for achievement, unit testing is therefore easy to get developers to take up so it's an easy way of getting those developers to do more testing :-)

    That was all at the end of last year. I'm writing about it now because last Friday I had to extend the business logic in that corner of the model. Importantly the modification only affected a portion of the model - specifically to extend the date range considered when searching certain types of data - which meant I had to be careful that my update didn't affect the ranges of the searches.

    And that is exactly where unit testing and test driven development is perfect: I added four more tests that checked the new range of the new code to check different scenarios and then pressed the button. That all of the previous test stayed green told me that my new code hadn't broken anything, that my new tests went red told me I needed to fill in the code - the fails were NotImplemented exceptions. Hence I could keep my mind on just one task, to get the new code working**. Cool.



    * A reason whilst continual integration and building is so satisfying

    ** Which I got working on the second attempt.


(Read comments)

Post a comment in response:

From:( )Anonymous- this user has disabled anonymous and non-friend posting. You may post here if webgeek lists you as a friend.";
 
Username:  Password: 
Subject:
No HTML allowed in subject
 

No Image
 

 Don't auto-format:
Message:

Notice! This user has turned on the option that logs IP addresses of anonymous posters.

Allowed HTML: <a> <abbr> <acronym> <address> <area> <b> <bdo> <big> <blockquote> <br> <caption> <center> <cite> <code> <col> <colgroup> <dd> <dd> <del> <dfn> <div> <dl> <dt> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr> <i> <img> <ins> <kbd> <li> <li> <map> <marquee> <ol> <p> <pre> <q> <s> <samp> <small> <span> <strike> <strong> <sub> <sup> <table> <tbody> <td> <tfoot> <th> <thead> <tr> <tt> <u> <ul> <var> <xmp>
© 2002-2008. Blurty Journal. All rights reserved.