The invention belongs to the technical field of software development and software testing, and discloses a method for generating an automatic test case based on traffic recording, which comprises: 1, a step of recording the traffic of a tested system, acquiring http protocol elements of the traffic, and storing analyzed data in a database according to a self-defined format; 2, a step of case model design, namely a step of performing model design based on multiple scenes to establish a model library, playing back recorded traffic stored in a database, matching recorded user-defined format data of the http protocol elements with models in the model library, generating test scenes, and storing the test scenes as a test case set; and 3, a step of generating an automatic test script based on the test case set, reading out each test scene in the case set one by one, calling an automatic generation case function module, and automatically generating a test case script. The problem that scene verification is incomplete is solved, repeated execution can be achieved, and the authenticity and diversity of interface request data are saved.