The invention provides a dynamic rerouting automatic test method and system based on an ASON (Automatically Switched Optical Network), and relates to the field of automatic test. The method comprisesthe following steps: step S1, deploying an optical switch between any two adjacent network elements in a network topology, setting a control machine to control the optical switch, and an error code analyzer of a web master and monitoring services, and initializing all configurations; step S2, automatically generating and testing a breakpoint in the next step and an expected route test corresponding to the breakpoint by the control machine through the current route read by the web master, and controlling the breakpoint to generate routing switching by the control machine through the optical switch; step S3, after each route switching is successful, selecting at least one optimal expected route in the expected route set by the control machine, and comparing with a route after switching; andstep S4, repeating steps S2 and S3 until the test is completed. According to the dynamic rerouting automatic test method based on the ASON provided by the invention, the test step is dynamically generated according to the current test condition, and the automatic test of the dynamic route is realized, thus various disadvantages caused by manual test are avoided, and the accuracy of a test result is improved.