Evaluating the Quality of Test Code against Feature Code on Popular Javascript Libraries

Vidroha Debroy and Ranran Feng

Keywords

Software Quality, Maintainability, Test Code, Javascript

Abstract

A large number of web applications today leverage freely available third-party JavaScript libraries. However, in doing so, there is an increased reliance on not just the core library or feature code, but also any accompanying test code – so that regressions can be found when the feature code is modified, new tests can be written for proposed extension code using the existing tests as a sample, etc. Thus, it is crucial that both the feature and the test code, that comprise a distributable library, be of high quality. We empirically investigate whether this is the case in practice by virtue of a case study, conducted on 10 large, popular and freely available JavaScript libraries, that compares the quality of test code against that of feature code, using several static quality metrics (size in terms of Source/Compiled Lines of Code, Commenting Ratio, Cyclomatic Complexity, Maintainability Index and Difficulty Measure). Our results are intriguing in that while they support some expectations: we find that feature code is more extensively commented than test code; we also find that more test code is actually written (in terms of compiled lines of code) than the feature code being tested; and yet on average the test code is of a higher quality based on its complexity, maintainability and difficulty.

Important Links:



Go Back