DevPinoy.org
A Filipino Developers Community

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

insufficient test code coverage -> broken build

i agree that incorporating code coverage criteria in your build scripts is very restrictive, but you have no choice if your team is just starting out doing tdd or writing plain automated unit tests.  how can you force them to learn to write automated unit tests if you will not be pressuring them? without it, you can just watch your project's coverage percentage slowly dropping as you come close to the release phase.

we've got new developers in our company and i believe the idea of incorporating test code coverage build task for new projects should be enforced.  this way, the new ones will really learn to write tests, if not ask assistance on how to write them.  once everybody knows and understands the importance of having automated tests then you can drop this restriction, or should you?  what do you think?


Posted 05-25-2007 10:04 AM by jokiz

Comments

Jon Limjap wrote re: insufficient test code coverage -> broken build
on 05-24-2007 7:14 PM

Well I guess the real problem would lie on defining what "sufficient" code coverage is. There was this post on object mentor (blog.objectmentor.com/.../100-code-coverage)that said that "if your goal is 100% coverage, you’ll focus on that goal and not focus on writing the best tests for the behavior of your code."

So the challenge would be to strike a balance between teaching the *value* of TDD and code coverage, as well as writing good tests, so that the objective is not 100% code coverage, but instead, something like 80% code coverage but *with very good tests*

jokiz wrote re: insufficient test code coverage -> broken build
on 05-24-2007 7:44 PM

good point. i intentionally didn't define what is sufficient code coverage for me since i really don't know what is should be.

i've read that object mentor post before and i agree with his point.  

however, i know most of our developers are not really into writing automated tests and the way i see it, forcing them to write tests would mean keeping a 100% code coverage.  not so good tests are acceptable at first since we are still learning but we'll know about them not being good as we go along the way.

personally, i still have some quandaries on the ideal way to test things, setting up tests, etc.  and i still don't have anyone to tell and share these stories with, are you in? :p

Robert Locke wrote re: insufficient test code coverage -> broken build
on 05-24-2007 7:44 PM

At the risk of sounding draconian, you could insist that no code be committed to the code base unless accompanied by the appropriate test cases.  To make this more manageable, you could enforce this policy on the newer developers only.

jokiz wrote re: insufficient test code coverage -> broken build
on 05-24-2007 8:04 PM

hi robert, incorporating code coverage rule in our continuous integration setup is better than having just a policy since breaking this rule will break the build, :p.

OT: mobius company? you from downstairs, there's a mobius company in our building at net one, taguig

jop wrote re: insufficient test code coverage -> broken build
on 05-24-2007 8:55 PM

If the new developers still do not understand the value of TDD, then the only thing you can do is seduce them to the test driven way of programming :D. Most of the times, though, they are the ones that produce the most bugs. When defects arise, take advantage of the situation and let the team think of the tests that would have uncovered that bug if only the code was test driven. It is not directly helping to the "code coverage" metric but it doesn't matter. What matters is that the team learned something out of the bug. Hopefully, the guy that introduced the bug learned something, too.

There are also those developers that are test driven already but are tempted to go back their old ways because they think they've hit a hard to test code. When that happens, then you can just all agree to call up a meeting and brainstorm on the ways to test it. I think when you start doing this, you'll get meetings every few minutes. But as you go along and gain a lot of experience writing tests, the meetings should eventually dwindle. This idea came from Michael Feathers (I think) but I am unable to find a link.

Jon Limjap wrote re: insufficient test code coverage -> broken build
on 05-24-2007 9:42 PM

Not sure if I'm qualified. I myself am not putting up as much tests as I should, nor am I putting up tests firsts the way I should. :p

These things are what you miss cruizer for.

Jon Limjap wrote re: insufficient test code coverage -> broken build
on 05-24-2007 10:10 PM

I have a new post in my blog (dotnet.kapenilattex.com) that somewhat answers some aspects of your quandaries. Hope it helps :)

jokiz wrote re: insufficient test code coverage -> broken build
on 05-24-2007 11:12 PM

@jop, i'd love to have those kind of meetings.  

the idea on pointing out the recurring bugs to the one who does not write tests sounds familiar, i've done that with some of my officemates.  it's really better for them to learn that way.  

but the worse scenario (which really happens) is when some of them leave and you're stuck there afraid to incorporate a feature in their module without breaking their existing implementation without tests.

Robert Locke wrote re: insufficient test code coverage -> broken build
on 05-25-2007 9:21 PM

Yipes, I should've read your post more carefully before talking out of the proverbial you-know-what.  Yes, including coverage in the build success criteria is better than a policy (we live in PHP land where unit testing/coverage tools aren't quite up to snuff).

Do you personally insist on 100% coverage with the code you write?  If so, (and I have a feeling you do =), then  apply that standard and expect the same from your group, they will be better off for it.

OT: Yup, 8th floor.  Pay us a visit anytime. =)

jop wrote re: insufficient test code coverage -> broken build
on 05-27-2007 4:37 AM

# jokiz

I understand your situation. Someone leaves and their knowledge about the module is not encoded in test form. The leaver will be asked to create a handover "braindump" document detailing whatever it is that is needed to be explained to the pitiful guy that will takeover the application.

I think there is a better way. Rather than ask the leaver to create the document, I think it is much better to just take over the application on the very day that he filed his resignation and try to work on the application. Start adding tests and refactoring, while the person is still there and you can still ask questions. Look for the biggest files, biggest, classes, longest methods, most complicated code, and work from there. Read Micheal Feathers' book and then memorize Resharper's short-cut keys. You'll be using it a lot. :D

jokiz wrote re: insufficient test code coverage -> broken build
on 05-28-2007 3:06 AM

resharper's short cut keys?  hello, nasa dugo na rin yan!  well in our company, turn over happens in just one day sad to say.  btw, i'm currently browsing feather's book, thanks!

Lexapro weight gain. wrote Lexapro.
on 07-15-2008 7:08 AM

Lexapro side effects. Lexapro and weight gain. Lexapro. Lexapro and side effects.

Avandia. wrote Metformin more effective than avandia.
on 07-31-2008 4:24 AM

Avandia.

Effexor medication xr. wrote Effexor xr.
on 08-07-2008 9:59 PM

Effexor xr. Effexor xr emotional dullness. Effexor xr 37.5mg.


Copyright DevPinoy 2005-2008