Just-In-Time Quality Assurance with Assistance of Automated Defect Prediction and Code Testing
Software testing and defect prediction are widely recognized quality assurance activities that can contribute to the effectiveness and efficiency of Just-In-Time Software Quality Assurance (JIT-SQA) by automating processes and reducing software maintenance costs. However, most studies treat them separately, with limited exploration of how defect prediction can guide testing and how testing can support prediction. Existing methods are not tailored for JIT-SQA and often ignore change-specific characteristics such as concept drift and verification latency, leading to unstable defect prediction. Moreover, test annotations on recent code changes are rarely used to update models, missing an opportunity to improve accuracy. Beyond this, effectively leveraging test-annotated samples remains an open research question. On the one hand, these samples frequently suffer from one-sided label noise, as instances that are not identified as defective during testing may still contain defects. On the other hand, defect-inducing changes are relatively infrequent, leading to a significant class imbalance issue. Therefore, exploring how to utilize test annotations to mitigate class imbalance and enhance prediction robustness presents a critical challenge. To fill this research gap, we propose an automatic JIT-SQA framework that incorporates defect prediction and testing processes collaboratively. Specifically, we direct testing activities through defect prediction models and design a novel update mechanism that integrates waiting time with testing feedback to update the predictor in real time. Moreover, we further design a reinforcement learning-based dynamic selection mechanism to mitigate the instability in defect prediction performance over time. Our framework facilitates mutual guidance between automatic testing and defect prediction, leveraging shared knowledge within the JIT-SQA system. This integration holds significant potential for producing high-quality software within modern development timelines. Notably, this study is the first to investigate the integrated application of these two quality assurance activities within a unified framework for JIT-SQA throughout the software development process. We conducted experiments using both statically typed (Java) and dynamically typed (Python) languages by integrating various testing techniques. The results indicate that, after implementing the novel update and dynamic selection mechanisms, our framework significantly outperforms simple integrated frameworks of defect prediction and testing. Specifically, the Recall improves by 21.6%, 10.5%, and 6.3% compared with the testing-integrated versions of ODaSC, ECo-HumLa, and HumLa, respectively, while the F1 score improves by 13.2%, 7.0%, and 5.1%. At the same time, in terms of guiding testing activities, the total number of tests is reduced by 2.9%, 19.5%, and 24.8% compared with the same baselines. These findings demonstrate that our framework not only mitigates the adverse effects of concept drift, verification latency, and class imbalance in code evolution scenarios but also effectively guides testing to reduce resource consumption.
Read more