6

A google scholar search turns up numerous papers on testability, including models for computing testability, recommendations for how ones code can be more testable, etc.

They all come with the assertion that more testable code is more stable, however I can't find any studies which actually demonstrate this.

I tried looking for studies evaluating the effect of testable code vs. quality, however the closest I can find is Improving the Testability of Object Oriented Systems, which discusses the relationship between design flaws and testability.

Is testable code is actually more stable? And more importantly, how strong is this relationship?

Please back up your answers with references or evidence to back up your claim.

For example, there is a lot of study regarding the relationship of cyclomatic complexity and defect rate. Troster finds a correlation of r = .48

There are metrics for "testability", such as code coupling. I'm looking for research conclusions relating these to defect rate. Ideally I would love a graph plotting some measure of testability vs. defect rate.

11
  • 3
    @RobertHarvey It seems self-evident. I believe it. You believe it. But there is something to be said for questioning everything.
    – Michael
    Commented Nov 28, 2012 at 22:42
  • 5
    @RobertHarvey: You have 5 hours of dev time. Should you spend it refactoring the code to make it more stable, or use it fixing existing bugs? I don't think the answer is self-evident.
    – Xodarap
    Commented Nov 29, 2012 at 0:45
  • 4
    You cannot measure how stable code is without testing it. The more you can test it the more certain you are of its stability (or instability as it may be). The more you test it, the higher the probability that factors causing instability will be ironed out, which results in more stable code.
    – zzzzBov
    Commented Nov 30, 2012 at 19:15
  • 6
    You should define what you mean by stable. I could be interpreted to mean that there are few bugs in the code or that the code is less likely to change. It could also be interpreted to mean other things. Testability is also something that is loosely defined and may be in some part subjective.
    – Gilles
    Commented Nov 30, 2012 at 19:20
  • 3
    There are many metrics associated with testability and defect rates - coupling, cohesion, fan-in, fan-out, lines of code, cyclomatic complexity, the CK metrics, the Halstead metrics. Searching for many of these and "defects" shows numerous studies in which the correlation between the metric and defects is discussed (some more than others).
    – Thomas Owens
    Commented Nov 30, 2012 at 19:32

1 Answer 1

1

In the revised 1995 edition of "The Mythical Man-Month", by Fredericks Brooks, JR., Brooks says that in the following book:

Jones, C., Assessment and Control of Software Risks. Engle-
wood Cliffs, N.J.: Prentice-Hall, 1994. p. 619.

... Casper Jones "offers data that show a strong correlation between lack of systematic quality controls and schedule disasters."

Maybe in that Jones' book you will find the research conclusions you are looking for since "schedules disasters" are in part, Brooks dixit, caused by lack of productivity influenced by an inefficient proccess of defect detection and correction.

Hope it helps.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.