Why do software developers practice test-driven development?

Master Thesis


Permanent link to this Item
Journal Title
Link to Journal
Journal ISSN
Volume Title

University of Cape Town

This dissertation describes research that has been undertaken to understand factors influencing software developers' intention to perform test driven development (TDD). Unit tests are a form of testing, where tests are written for small units of software being developed. TDD is a practice where these tests are written before the functionality is written, so as to guide the design of the code for the functionality, as well as to ensure test coverage for all functionality. There has been some research conducted to understand TDD by looking at its effects on both the outcomes and the practice of software development. It has been found to increase quality by decreasing defects, while also increasing the maintainability and the changeability of the code. On the other hand, some research has also found it to increase time spent on completing tasks. Despite this, to the best of the researcher's knowledge, there hasn't been research done to understand the behavioural components of TDD, and in particular, why developers choose to practice TDD. A conceptual model based on the Theory of Planned Behaviour (TPB) is described and used as a lens to understand intention. TPB proposes that intention to perform a behaviour (TDD in this case) is influenced by three factors: attitude towards the behaviour, subjective norm, and perceived behavioural control. This dissertation seeks to build onto this model for the purpose of understanding TDD, and proposes the following determinants of the influences of intention: attitude is influenced by attitude towards time taken, differences in quality, maintainability and developer efficiency; subjective norm is influenced by the perceived perception of the environment regarding changes in quality, time taken, and maintainability of the code. Lastly, perceived behavioural control is posited to be made up of perceived difficulty of TDD, and how much experience a developer has. This model is then tested based on data collected from a n online survey distributed around the world. 779 responses were collected from developers in various countries around the world. The majority of the respondents to practice TDD, allowing us to gain greater insight into why those that practice TDD actually do so. Because the study is a psychographic study, perceptions were understood from the developers using an ordinal Likert scale. To analyse this data in order to prove the hypotheses, Chi -¬‐ square tests with contingency tables, Kruskal -¬‐ Wallis tests and ordinal logistic regression were used as statistical methods. It is found the data collected does not conform to the model, and recommendations are made for a future study to form a more comprehensive model.