Prioritizing unit tests using object-oriented metrics, centrality measures, and machine learning algorithms

被引:1
作者
Levasseur, Marc-Antoine [1 ]
Badri, Mourad [1 ]
机构
[1] Univ Quebec Trois Rivieres, Software Engn Res Lab, Dept Math & Comp Sci, Trois Rivieres, PQ G9A 5H7, Canada
基金
加拿大自然科学与工程研究理事会;
关键词
Object-oriented metrics; Centrality measures; Unit testing effort prediction; Machine learning classification; SOURCE CODE METRICS; EMPIRICAL-ANALYSIS; DESIGN METRICS; SOFTWARE; PREDICTION; TESTABILITY; VALIDATION; SELECTION; MODELS; FAMILY;
D O I
10.1007/s11334-024-00550-9
中图分类号
TP31 [计算机软件];
学科分类号
081202 ; 0835 ;
摘要
Nowadays, increasing complexity and size of object-oriented software systems bring new software quality assurance challenges. Unit testing is one of the main phases of the testing process, where each class (as a software unit) is early and individually tested using dedicated unit test cases. Due to limited resources and tight time deadlines constraints, unit testing often has to be done under severe pressure. As a consequence, the unit (tests) testing efforts have to be focused (prioritized). Many studies have proposed approaches based on object-oriented metrics and machine learning classifiers to predict the unit testing efforts (prioritizing unit tests). To the best of our knowledge, there is no study combining object-oriented metrics and centrality measures (network measures) for predicting the unit testing efforts (prioritizing unit tests). This paper aims basically at: (1) investigating the usefulness of centrality measures as indicators of the unit testing effort, (2) exploring how they can be combined to object-oriented metrics (already used in the literature) to improve the prediction of the unit testing efforts (prioritize unit tests), (3) exploring if the combination of object-oriented metrics and centrality measures can be used to predict different levels of the unit testing effort, and (4) exploring if the combination of object-oriented metrics and centrality measures can be used to identify a set of suitable candidate classes for unit testing (prioritizing unit tests). We investigated the performance of object-oriented metrics and centrality measures, and different machine learning algorithms in the prediction of the unit testing efforts (prioritizing unit tests). The unit testing effort of classes is addressed from the perspective of unit test cases construction. We focused particularly on the effort involved in writing the code of unit test cases. To capture the involved unit testing effort of classes, we used two test code metrics used in many studies in the literature to quantify the code of corresponding JUnit test classes. In addition, we used clustering algorithms to group software classes into different categories (levels) according to the involved unit testing effort. We performed an empirical analysis using data collected from 5 open-source Java software systems (Apache ANT, Apache Math, Apache IO, JFreeChart, and Joda Time), including 5 versions of Apache ANT (1.3, 1.4, 1.5, 1.6, 1.7), for which JUnit test cases were available. Collected data was used to train the prediction models based on the different machine learning algorithms we considered. The performance of the prediction models has been evaluated using two metrics (g-mean and AUC). We also used two techniques to validate the prediction models: tenfold cross-validation, and cross-version validation. Results show that: (1) centrality measures can be used to predict the unit testing effort (prioritize unit tests), (2) combining centrality measures and object-oriented metrics improves significantly the prediction quality, (3) combining centrality measures and object-oriented metrics was among the best-performing metrics' sets (different combinations have been investigated), (4) adding data from previous versions improves the performance of the prediction models, suggesting that the investigated prediction models are useful in a real development situation (different successive versions), and finally (5) random forest-based prediction models showed significant advantages on our dataset compared to the prediction models based on the other machine learning algorithms.
引用
收藏
页码:541 / 567
页数:27
相关论文
共 93 条
[1]  
Abaei Golnoush., 2014, Vietnam Journal of Computer Science, V1, P79
[2]   Investigating the use of random forest in software effort estimation [J].
Abdelali, Zakrani ;
Mustapha, Hain ;
Abdelwahed, Namir .
SECOND INTERNATIONAL CONFERENCE ON INTELLIGENT COMPUTING IN DATA SCIENCES (ICDS2018), 2019, 148 :343-352
[3]   Empirical analysis for investigating the effect of object-oriented metrics on fault proneness: A replicated case study [J].
Aggarwal, K.K. ;
Singh, Yogesh ;
Kaur, Arvinder ;
Malhotra, Ruchika .
Software Process Improvement and Practice, 2009, 14 (01) :39-62
[4]   Identifying refactoring opportunities in object-oriented code: A systematic literature review [J].
Al Dallal, Jehad .
INFORMATION AND SOFTWARE TECHNOLOGY, 2015, 58 :231-249
[5]  
Aljahdali S, 2016, SUPPORT VECTOR MACHI
[6]  
[Anonymous], 2009, P 5 INT C PREDICTOR, DOI [10.1145/1540438.1540446, DOI 10.1145/1540438.1540446]
[7]  
Badri L., 2011, INT J SOFTW ENG ITS, V5, P69
[8]  
Badri L, 2010, COMM COM INF SC, V117, P78
[9]  
Badri M., 2012, J. Softw. Eng. Appl., V05, P513, DOI [10.4236/jsea.2012.57060, DOI 10.4236/JSEA.2012.57060]
[10]   Predicting Unit Testing Effort Levels of Classes: An Exploratory Study based on Multinomial Logistic Regression Modeling [J].
Badri, Mourad ;
Toure, Fadel ;
Lamontagne, Luc .
PROCEEDINGS OF THE 2015 INTERNATIONAL CONFERENCE ON SOFT COMPUTING AND SOFTWARE ENGINEERING (SCSE'15), 2015, 62 :529-538