University of Oulu

Usage of test- driven development in open source projects

Saved in:
Author: Hanhela, Jari
Organizations: 1University of Oulu, Faculty of Information Technology and Electrical Engineering, Department of Information Processing Science, Information Processing Science
Format: ebook
Version: published version
Access: open
Online Access: PDF Full Text (PDF, 3.5 MB)
Persistent link:
Language: English
Published: Oulu : J. Hanhela, 2015
Publish Date: 2015-05-26
Physical Description: 50 p.
Thesis type: Master's thesis
Tutor: Hedberg, Henrik
Reviewer: Turhan, Burak
Hedberg, Henrik
The aim of this thesis is to provide an understanding of the use of test-driven development (TDD) in unit testing level in open source software (OSS) projects. TDD is a software development approach relying in short development cycles. Test-first approach, in which software tests are written first and then just enough code to pass them, is a central part of TDD. This way tests and production code are developed synchronously together supporting quality assurance processes in OSS projects which are sometimes reported to suffer from insufficient testing. To get an understanding of the use of TDD in OSS projects, 2500 OSS projects were downloaded from GitHub and an automatic script was developed to analyse the projects and particularly test files which have one precise target file. These tests were divided in to three categories depending on if the tests were committed before, with or after their target files. It turned out that 74% (1822 out of 2500) projects contained at least one test file. 52% (1292) of all projects contained at least one test file with one precise target file and which was committed to the project’s repository either before or with its target file. 561 projects contained at least 10 tests with a single target and of which at least 50% were committed before or with their target files. These 561 projects are 22% from all projects and nearly one third (31%) of projects containing tests. Furthermore, it turned out that only half of all tests committed before or after their target files were committed by the same author who also committed the production code. Naturally tests committed with the production code were added by the same committer. Based on the results it seems that a distinct minority of the downloaded projects are certainly following the test-first aspect of TDD in the sense that tests are added to the project’s repository before the production code, although it is possible that tests are made first and only committed later with the target file. Since majority of the tests were committed with the target file, it can be assumed that most of them were created at least closely together. Thus, the most important finding in this study is that there is evidence of the open source community's commitment to creating tests for their code.
see all

Copyright information: This publication is copyrighted. You may download, display and print it for your own personal use. Commercial use is prohibited.