Authors: Balvir Singh Thakur, Devanshi
Abstract: Regression testing is a vital part of software testing. Executing all test cases from large test suites without considering their historical failure behaviour may lead to time-consuming and inefficient execution. Running the test cases that are more prone to failure first can improve this process. In this paper, an AI-based test case prioritisation approach for the automated testing framework based on TestNG using machine learning and historical test execution data is proposed. The proposed approach extracts execution-based features like total test runs, number of failures, failure rate, average execution time and recent failure information and uses a Random Forest classifier to identify high-risk test cases. The predicted risk information is then used to produce an ordered list of the test suite, ordered by priority. The approach was tested on 70 TestNG test cases with 20 previous executions compared to a normal execution order and an alphabetically ordered static baseline using the Average Percentage of Faults Detected (APFD) metric. The experimental results show that the AI-prioritized execution order results in an APFD of 0.7100, compared to 0.5643 for the normal order and 0.5729 for the static priority order, improvements of 25.82% and 23.94%, respectively. The results show that taking into account historical failure behaviour in machine learning-based test prioritisation can improve the early detection of failing test cases and provide a more risk-aware execution strategy for regression testing.