Structural software testing is an essential stage in the software development lifecycle, where achieving high coverage and fault detection remains a significant challenge. Manual testing is costly and inefficient for a program with a large number of modules and functions. Automated test data generation addresses this issue, but its effectiveness depends on the optimization strategies used. This study introduces a novel hybrid optimization algorithm that combines the Gray Wolf Optimizer (GWO) and Particle Swarm Optimization (PSO) to cover deep paths of the program and generate efficient test data. By balancing exploration and exploitation through the proposed hybrid PSO-GWO approach, this method adapts well to programs of varying size and complexity. The proposed method was evaluated on 26 standard benchmark programs. Experimental results demonstrate its superior performance, achieving 88.37% coverage, which is higher than the state-of-the-art methods, and a mutation score of 67.45%, reflecting improved fault detection capability. Moreover, it produces fewer test cases and executes an average of 1257.7 s, approximately half the time required by GA, GWO, and PSO individually. In this study, the symmetric and asymmetric structural aspects of program control flow and execution paths are analyzed to generate automated tests. The suggested deep path coverage technique uses optimization principles based on symmetry to achieve effective and reliable structural testing of software. Overall, the proposed hybrid algorithm delivers test data that is smaller, faster, and more effective. The proposed method is a reliable and efficient test generator compared to the state-of-the-art methods.