DEV Community

Santosh Desani
Santosh Desani

Posted on

Is it really a defect ?

You find out (once the code is in prod) that one of the methods/class you wrote is missing some tests & log an issue to add those missing tests. Do you log it as defect, because your tests claimed to test everything but now you have some untested code in prod, or is it just an enhancement?

Want to know Dev Community's thoughts on this one.

Top comments (7)

Collapse
 
ahferroin7 profile image
Austin S. Hemmelgarn

That depends, does the code that wasn't tested happen to work correctly?

If so, then enhancement, because in that case you're not technically fixing anything, you're just making sure it doesn't break in the future, so there's no customer visible problem being fixed.

If not, then a defect, but specifically attached to the ticket for the code that isn't working. Without fixing one, there's not really point in fixing the other, so they should be on one ticket.

In either case, I'd question the sanity of making the classification such low granularity, as in the first case it's not really an enhancement for users (it's an internal improvement), and in the second it's not really a defect by itself.

Collapse
 
sdesani profile image
Santosh Desani • Edited

If so, then enhancement, because in that case you're not technically fixing anything, you're just making sure it doesn't break in the future, so there's no customer visible problem being fixed.

The code works correctly.

If not, then a defect, but specifically attached to the ticket for the code that isn't working. Without fixing one, there's not really point in fixing the other, so they should be on one ticket.

The code works. The thought process I heard around this was - We are missing some tests, so there is code in prod which is untested and hence it should be a defect as we don't know if it will continue to work or break.

I have personally believed that a defect is when the functionality is broken or not functioning as expected. Be it because of broken code in prod or missing some code path itself. The tests are not part of functionality. Tests contribute to the quality of the code and makes sure the expected functionality is met but tests itself are not the functionality. So if tests are broken or are missed it should never be a defect.

Collapse
 
ahferroin7 profile image
Austin S. Hemmelgarn

The code works. The thought process I heard around this was - We are missing some tests, so there is code in prod which is untested and hence it should be a defect as we don't know if it will continue to work or break.

That thought process is technically correct, except that a missing test is a defect in the process, not the code itself. That's part of my reasoning for commenting that any issue tracker that doesn't allow any more granularity than enhancement versus defect is poorly designed.

That's also why I'm of the opinion that if a missing/broken test let some actual user-visible issue make it into production, adding/fixing that test should be a mandatory part of fixing the issue itself.

Collapse
 
varjmes profile image
james

Neither, I'd log it as technical debt. It's not a bug no, but "enhancement" isn't for tests. Enchancement is more non critical improvements or "nice to have" things, like a button to copy a snippet instead of making the user select the text, right click etc

Collapse
 
sdesani profile image
Santosh Desani

+1
I would log it as anything else but not as defect.

Collapse
 
avalander profile image
Avalander

I'd just log it as technical debt.

Collapse
 
sdesani profile image
Santosh Desani

+1