The invention provides an ONU automatic testing method based on a TCL script. The method is achieved by adopting the TCL script. The method includes the following steps that firstly, an OLT conducts automatic configuration on the ONU function, whether configuration succeeds or not is judged, if configuration succeeds, the second step is executed, if configuration does not succeed, automatic error reporting is conducted, and testing is over; secondly, a network analyzer is used for conducting flow testing, whether configuration succeeds or not is judged, if configuration succeeds, the third step is executed, if configuration does not succeed, automatic error reporting is conducted, and testing is over; thirdly, an ONU testing result is obtained, and testing is over. The ONU automatic testing method based on the TCL script can replace a large amount of manual testing work, manual intervention is not needed, an ONU can be automatically, rapidly and accurately tested, the testing result is obtained, labor resources are saved, the testing efficiency is improved, and the development cycle of products is shortened.