With the rapid development of China train operation and control system, validity and safety of behavioral functions of the system have attracted much attention in the railway domain. In this paper, an automated test sequence optimization method was presented from the system functional requirement specification of the high-speed railway. To overcome the local optimum of traditional ant colony algorithm, the maze algorithm is integrated with the ant colony algorithm to achieve the dynamical learning capacity and improve the adaptation capacity to the complex and changeable environment, and therefore, this algorithm can produce the optimal searching results. Several key railway operation scenarios are selected as the representative functional scenarios and Colored Petri Nets (CPN) is used to model the scenarios. After the CPN model is transformed into the extensible markup language (XML) model, the improved ant colony algorithm is employed to generate the optimal sequences. The shortest searching paths are found and the redundant test sequences are reduced based on the natural law of ants foraging. Finally, the Radio Blocking Center (RBC) test platform is designed and used to validate the optimal sequence. Testing results show that the proposed method is able to optimize the test sequences and improve the test efficiency successfully.