1. A method, executed by at least one central processing unit (CPU), for automatically generating unit test cases for a computer program that can reproduce runtime problems, wherein the runtime problems comprises unexpected exceptions and violations of predefined behavior rules, the method comprising the steps of: specifying one or more specific target program units selected from one or more target program units in the program; specifying one or more specific runtime problems, wherein the one or more specific runtime problems comprises runtime problems that occur during testing of the one or more specific target program units; modifying the computer program according to the one or more specific target program units in the program and the one or more specific runtime problems, the modified computer program is configured to detect the one or more specific runtime problems and record execution paths and contexts; test executing the modified program; and automatically generating unit test cases according to the one or more specific runtime problems occurring during the execution of the one or more specific target program units.