The invention relates to the technical field of
artificial intelligence and
automatic testing, and particularly discloses an AI-based
automatic testing method and device. The method comprises the following steps: capturing and recording complete execution historical information in a process of executing a test task by an AI agent, and serializing and storing the complete execution historical information as reusable cache data; before the test is executed, the validity of the cache is judged through a multi-dimensional
verification mechanism including
data integrity, timeliness, functionality and the like; when the cache
verification is passed, a result is quickly obtained based on the cache data playback test process; when cache
verification is not passed or execution fails, triggering an AI agent to perform new reasoning and steps to generate and update cache data; and meanwhile, a caching strategy is dynamically adjusted according to
test case changes and resource conditions. The device comprises a test executor, an AI agent manager, an intelligent cache manager and a dynamic
cache management module, and all the modules work cooperatively to improve the
test efficiency, reduce the calling cost of a large
language model and enhance the stability of a test result. The method is suitable for Web / APP
automatic testing, cross-platform testing, CI / CD process testing and other scenes, the execution efficiency can be remarkably improved, the cost is reduced, and
resource utilization is optimized.