DevPinoy.org
A Filipino Developers Community

>>> First two to make 3 wins! <<<

working around a project with minimal unit tests

coming from a project with number of unit tests in it (hundreds i believe), it's hard to work around our current project without it.  we're near the release of the project and we still have 31 unit and integration test cases for the .NET client application.  the count does not include my own set of unit tests since they are in vba code embedded in an excel workbook which is the output of our application (i'm using test code modules using debug.assert statements). 

there are times when one of my teammates (who was also involved in the said previous project) is afraid to commit.  it was mainly because we don't have proper unit tests to backup the implemented and functioning feature set. 

there was a time when i joined them to fix some bugs at crunch time and its a PITA to run the app just to be able to test the functionality and go back to the usual debugging mode.  you can't introduce test cases when time is not on your side or you'll surely get home late.  i have never attempted it and just promise to include some afterwards but i think i really never did (:p).

but not to undermine the 31 test cases, they were able to filter out around ten failed commits, thanks to out continuous integration setup.  most of them are persistence tests and i'm thankful that they do have some minor role/use in our project (i think i wrote six of them, :p).


Posted 01-30-2007 9:40 PM by jokiz

Comments

jop wrote re: working around a project with minimal unit tests
on 02-01-2007 10:49 PM

Tough luck. I too was involved in a project that does not in a project where the team members are "hostile" to agile practices. I wrote tests for my code and created a continuous integration server that only I use.  Programmers are very territorial: programmers are not allowed to modify code that they do not own. More so on parts that they have already tested manually.

Things changed when, one by one, the team members slowly get assigned to other projects (or other companies). I have inherited the whole codebase, and with that the responsibility of making the application work.

Adding tests to a finished (but buggy) application is hard work. Especially when the business logic is embedded in the stored procedures. I have no choice but to generate rows of data for the stored procedures to process. That is not the fastest thing in the world. But by the time I'm finished with the project (which also happens to be my last day in the company), I've already written about half a thousand tests and it takes more than 5 hours to run them all.

So what is my point? Add at least one test a day. By the end of one week, your 31 tests have risen to 36, and you now have a few more places that can be safely refactored. Read Micheal Feather's book: Working Effectively with Legacy Code and go look for the chapters on refactoring code without tests.

Good luck!

jokiz wrote re: working around a project with minimal unit tests
on 02-04-2007 1:26 AM

half a thousand tests which runs in 5 hours! wow!  you never told me that you also have a CI server on that company.  

jokiz wrote Persistence tests
on 03-14-2007 7:12 PM

We have been using NHibernate for most of our apps here in our company and having persistence tests for


Copyright DevPinoy 2005-2008