Optimizing Test Case Selection Using Reinforcement Learning in Regression Testing
摘要
Software testing is one of the most critical and resource-intensive phases of the software development lifecycle, particularly in regression testing, where frequent updates necessitate re-execution of large test suites. Optimizing test case selection and prioritization is vital to reduce testing costs while maintaining software quality. This study introduces a novel reinforcement learning (RL)-based approach, leveraging Q-learning, to dynamically prioritize and optimize regression test cases. The proposed method models the testing environment using user and tester interaction logs, mapping them into a state-action space. A reward function assigns values to test cases based on fault detection capability, coverage, and execution efficiency. The Q-learning agent iteratively updates its policy to maximize cumulative rewards, dynamically prioritizing test cases with the highest likelihood of detecting faults. The approach was validated through fault-seeding experiments on five Android applications spanning healthcare, real estate, job portals, mobile POS systems, and virtual assistants. Results showed significant improvements in fault detection rates (up to 91%) and reductions in test suite redundancy compared to traditional methods like random prioritization and t-SANT. This study highlights the efficacy and adaptability of reinforcement learning in regression testing, paving the way for further research into automated test case optimization in large-scale software systems.