The invention discloses an automatic testing method which is base on an application program interface, which relates to a measuring and testing technique which is based on a test instrumentation, and is put forward for solving miscellaneous testing methods which are based on test instrumentation at present. The proposal which is adopted comprises assuring test application program interface API and call instruction thereof which are supported by each test instrumentation in a testing system, setting marks for each test API, establishing test API base, testing the corresponded relationship between the test API base which is recorded with test API mark, test API and test API call instruction and test instrumentation, choosing a tested term, generating local test script according to the test API mark, executing and analyzing the test script, assuring the test API and call instruction thereof, sending the test API call instruction to the test instrumentation according to the corresponded relationship between the test API and the test instrumentation, calling the test API by the test instrumentation, and executing the corresponded test procedure of the test API. The invention achieves simple operation and low maintenance cost.