Usage of test- driven development in open source projects
Hanhela, Jari (2015-05-13)
Hanhela, Jari
J. Hanhela
13.05.2015
© 2015 Jari Hanhela. Tämä Kohde on tekijänoikeuden ja/tai lähioikeuksien suojaama. Voit käyttää Kohdetta käyttöösi sovellettavan tekijänoikeutta ja lähioikeuksia koskevan lainsäädännön sallimilla tavoilla. Muunlaista käyttöä varten tarvitset oikeudenhaltijoiden luvan.
Julkaisun pysyvä osoite on
https://urn.fi/URN:NBN:fi:oulu-201505211608
https://urn.fi/URN:NBN:fi:oulu-201505211608
Tiivistelmä
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.
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.
Kokoelmat
- Avoin saatavuus [34329]