Influence of Clean Code on Unit Testing
Laneva, Tatiana (2020)
Laneva, Tatiana
2020
All rights reserved. This publication is copyrighted. You may download, display and print it for Your own personal use. Commercial use is prohibited.
Julkaisun pysyvä osoite on
https://urn.fi/URN:NBN:fi:amk-2020052814942
https://urn.fi/URN:NBN:fi:amk-2020052814942
Tiivistelmä
Agile methodology is widely used in today's Software Development. One of the stages of Agile Development is Maintainance. It highly influences the overall cost of Development. Maintainability of the Software can be improved in the Implementation stage by introducing Unit testing. Another way to improve maintainability is by applying principles and practices of Clean code. This parallelism in the aspect of improving maintainability yields further investigation of how clean code principles influence the testing process.
This thesis investigates the effect of applying Clean code principles on Unit testing. One of the key metrics of the quality of Unit testing is code coverage. This research aims to prove the hypothesis that code coverage can be improved by applying Clean code principles. Two questions were answered: 1) How the code coverage of ad hoc code is different from the code coverage of the Clean code?; 2) How well ad hoc evolving written code can be tested?
Case study research method is applied. Two cases are created. For the first case code writ-ten in an ad-hoc approach is used, for the second case, Clean code is used. Experienced software developers were asked to write unit tests for these two cases. Code coverages are measured, and the written tests are reviewed for both cases.
It is observed that the Clean code approach achieves higher code coverage compare to ad hoc approach code coverage. Moreover, it is concluded that the existence of the embedded functionality in the ad hoc approach leads to difficulties in the testing process.
This thesis investigates the effect of applying Clean code principles on Unit testing. One of the key metrics of the quality of Unit testing is code coverage. This research aims to prove the hypothesis that code coverage can be improved by applying Clean code principles. Two questions were answered: 1) How the code coverage of ad hoc code is different from the code coverage of the Clean code?; 2) How well ad hoc evolving written code can be tested?
Case study research method is applied. Two cases are created. For the first case code writ-ten in an ad-hoc approach is used, for the second case, Clean code is used. Experienced software developers were asked to write unit tests for these two cases. Code coverages are measured, and the written tests are reviewed for both cases.
It is observed that the Clean code approach achieves higher code coverage compare to ad hoc approach code coverage. Moreover, it is concluded that the existence of the embedded functionality in the ad hoc approach leads to difficulties in the testing process.