Software testing process normally expects to detect defects as many as possible with minimum cost. In order to reduce the modeling complexity, most works generally assume that all defects are independent of each other. However, in practical testing processes, defects are normally correlated. The software failure severity caused by different defects may also be distinctive. Making full usage of the relationships between correlated defects, it is argued, is beneficial to improve software testing efficiency. This paper proposes a new approach by making usage of the relationship between defects. Firstly, the defects correlation matrix is constructed, and the synthetic balancing weights are designed based on defect correlation coefficient, rebate and detecting rate. Next, the optimal testing problem is converted into a weighted routing problem and a composite optimization algorithm is provided to effectively construct a minimum spanning tree to find an optimal test strategy. Meanwhile, a new defect removing strategy is designed in accordance with the characteristic of the correlated defects to eliminate defects more efficiently. Simulation results show that the proposed approach has higher effectiveness in terms of defect identification rate and system rewards.