Dependency Injection and Mock on Software and Testing
Independent thesis Advanced level (degree of Master (Two Years)), 20 credits / 30 HE creditsStudent thesis
Software testing has been integrated within software development life cycle due to its importance in assuring software quality, software safety, and customers' satisfaction. However, problems in software testing are prominent among software developers as system grows in size and complexity. Dependency injection becomes an appealing solution for developers with its practicality to improve software design, improve testability, and enable mock testing technique. The study aims to discover the extent to which the dependency injection facilitates software design and software testing. In addition, the effect of mock practice on testing is also assessed.
Metrics for investigation are defined and measured on various aspects of two systems. The two systems are selected and developed based on the same user requirements, development technologies, and methodologies. By comparing the two systems against the investigated metrics, we aim to reveal whether the dependency injection improve the code design. Then four test suites from both systems are evaluated in relation to testability.
The results demonstrate that the dependency injection does not seem to improve the code design if comparing on the selected metrics. Even though it does not score better, its effect is evident in other software aspects. The testability of the two systems is similar and suffers from the same problem. Meanwhile, mock helps assist software testing and improve testability. The effect of mock technique can be witnessed, especially when it is applied with other test techniques. Explanations and discussions on these findings are addressed in the paper.
Place, publisher, year, edition, pages
2014. , 96 p.
dependency injection, mock, software testing, testability, software metrics
Information Systems, Social aspects
IdentifiersURN: urn:nbn:se:uu:diva-226214OAI: oai:DiVA.org:uu-226214DiVA: diva2:726176
Subject / course
Master programme in Information Systems
2014-06-04, H325, Ekonomikum, 15:15 (English)
Sjöström, Jonas, Ph.D.