Font Size: a A A

Improving testability with stateless method extractio

Posted on:2013-07-19Degree:M.C.SType:Thesis
University:Carleton University (Canada)Candidate:Dagenais, OlivierFull Text:PDF
GTID:2458390008490380Subject:Computer Science
Abstract/Summary:
The unit testing of object-oriented classes is complicated by the presence of hidden mutable state, since the state of an instance may depend on its entire history of input. This difficulty is known as "the state problem" and causes unit tests to contain a lot of test set-up code, making them more fragile and complex. This thesis presents the stateless method extraction "testability refactoring", which is designed to overcome the state problem by extracting simple methods that operate only on their parameters, communicate results only through their return values, have no side-effects and whose functionality can be directly verified by unit tests. An empirical evaluation compares our approach to three other strategies, using three open-source projects and measuring three metrics for each combination. Our approach produces the best results on average, improving the testability of the classes under test while keeping their public interface intact.
Keywords/Search Tags:State, Testability
Related items