7 Replies - 1003 Views - Last Post: 14 March 2014 - 06:43 AM

#1 cfoley  Icon User is offline

  • Cabbage
  • member icon

Reputation: 2005
  • View blog
  • Posts: 4,171
  • Joined: 11-December 07

Leaving the camp site cleaner -- how clean?

Posted 12 March 2014 - 01:17 PM

Working through a list of features, one asks you to confirm some functionality. The class under question has no tests written for it. You inspect it and think the functionality is OK, and write a couple of tests to make sure. They pass so you can consider that part of the feature done.

The issue here is the class is still largely untested. The tests you wrote took it to about 10% test coverage. Do you take an hour to write more tests or do you move on to the next feature?

What do you do?

Move on to the next feature: turn to page 12
Write a test for each method to get the coverage up: turn to page 15
Look for edge cases for the methods and test them: turn to page 17

Is This A Good Question/Topic? 0
  • +

Replies To: Leaving the camp site cleaner -- how clean?

#2 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 9220
  • View blog
  • Posts: 34,624
  • Joined: 12-June 08

Re: Leaving the camp site cleaner -- how clean?

Posted 12 March 2014 - 01:32 PM

It sort of depends on a few things.. if I have the time I would try and clean up the coverage, but if not I would make a reminder for my wall and then either pawn it off on a less busy dev or get to it when I have some free time.
Was This Post Helpful? 0
  • +
  • -

#3 DarenR  Icon User is online

  • D.I.C Lover

Reputation: 463
  • View blog
  • Posts: 3,175
  • Joined: 12-January 10

Re: Leaving the camp site cleaner -- how clean?

Posted 12 March 2014 - 01:33 PM

prob make 1 large test and try to catch all the exceptions
Was This Post Helpful? 0
  • +
  • -

#4 tlhIn`toq  Icon User is online

  • Please show what you have already tried when asking a question.
  • member icon

Reputation: 5529
  • View blog
  • Posts: 11,845
  • Joined: 02-June 10

Re: Leaving the camp site cleaner -- how clean?

Posted 13 March 2014 - 05:55 PM

There is a lot to be said for what you would do in a perfect world. When you find its coordinates share with the rest of us. But in the real world those descisions often come down to money in one way or another.

What is the company mandate and what affects my pay raises and promotions more?
  • If I finish 5 bug tickets a day does that make my statistics look good and me a supercoder? If so then I do what it says and move on.
  • Or is there someone actually LOOKING at my work and realizing that I go above and beyond the minimum requirement and spec of the ticket? If truly caring about the quality of my craft coincides with improved respect translating to a better position with the company and I'm not jeopardizing deadlines, then I go with my heart and put in the extra time & effort.


How much time is scheduled for this sprint or ticket? When is the delivery deadline to QA? How far ahead or behind delivery is the project right now? If the build has to be done in 2 hours and I have 90 minutes of work just to improve this one class and 4 other tickets are going to get missed, then I rush to do them all.

This post has been edited by tlhIn`toq: 13 March 2014 - 05:56 PM

Was This Post Helpful? 0
  • +
  • -

#5 AdamSpeight2008  Icon User is offline

  • MrCupOfT
  • member icon


Reputation: 2263
  • View blog
  • Posts: 9,467
  • Joined: 29-May 08

Re: Leaving the camp site cleaner -- how clean?

Posted 13 March 2014 - 06:25 PM

Unless explicitly directed to, do not touch another man's co.. ..de.
Was This Post Helpful? 0
  • +
  • -

#6 tlhIn`toq  Icon User is online

  • Please show what you have already tried when asking a question.
  • member icon

Reputation: 5529
  • View blog
  • Posts: 11,845
  • Joined: 02-June 10

Re: Leaving the camp site cleaner -- how clean?

Posted 13 March 2014 - 06:30 PM

View PostAdamSpeight2008, on 13 March 2014 - 07:25 PM, said:

Unless explicitly directed to, do not touch another man's co.. ..de.


In some environments its expected. There are 50+ developers at my company. If there is a bug it is given to someone that should be able to fix it. Often that means seeing what the original coder missed that created the bug in the first place. Its rather like proofreading your own work. Someone else will see the mistakes faster and easier that you will.
Was This Post Helpful? 0
  • +
  • -

#7 AdamSpeight2008  Icon User is offline

  • MrCupOfT
  • member icon


Reputation: 2263
  • View blog
  • Posts: 9,467
  • Joined: 29-May 08

Re: Leaving the camp site cleaner -- how clean?

Posted 13 March 2014 - 09:37 PM

View PosttlhIn`toq, on 14 March 2014 - 02:30 AM, said:

If there is a bug it is given to someone that should be able to fix it. Often that means seeing what the original coder missed that created the bug in the first place.


If there is a bug report, and you are assigned it. Then OK then touch the code and fix it.

I was referring to not changing existing (no matter how bad it is), without there being a bug report first.
File a bug report first, then when it get assigned to you, then fix it.

This post has been edited by AdamSpeight2008: 13 March 2014 - 09:38 PM

Was This Post Helpful? 0
  • +
  • -

#8 Skydiver  Icon User is offline

  • Code herder
  • member icon

Reputation: 3579
  • View blog
  • Posts: 11,130
  • Joined: 05-May 12

Re: Leaving the camp site cleaner -- how clean?

Posted 14 March 2014 - 06:43 AM

Interesting discussion!

Steering back a little bit to the original question: Assuming there was time available, do you also start writing unit tests to cover the other code that you didn't touch but directly or indirectly calls the code that you touched? What if your unit tests reveal that there is a problem? Do you tweak the unit test to accept the incorrect answer? Or do you just disable the unit test and comment the reason why it is disabled, and put in a bug/todo entry into the backlog? Or do you go touch your code again to assert or throw an exception when it gets bad data from the other section of code?
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1