To resolve the problem of a large amount of automated test scripts and test data files, through the test tool QTP, data-driven and keyword-driven testing mechanism, a test automation framework based on three layer data-driven mechanism is designed, including the design of the TestSet managing test case files, the design of the TestCase storing test cases and the design of the TestData storing test data.Through controlling the test scale and applying the test data pool, reconfigurable and optimization of test scripts are designed. The methods above can decouple the test design and the script development, make test cases and data show a more humane design, make test scripts and test data on the business level optimized and reusable, and make the number of script files and the test data files reache a minimum, which reduces the occupied space.