In order to improve the test efficiency of PLC program,a test path generation method was proposed for PLC program based on UML state diagram.This method uses anti-ant colony algorithm to generate test path,which can avoid the explosion problem caused by too many test paths.The test path was obtained by artificial ant searching for vertice that has not been traversed or has the smallest pheromone,ensuring that the number is moderate while satisfying adequacy coverage criterion for test path.Through test case,the feasibility and effectiveness of the method were verified,which can avoid duplication with other texts.