How to design an automated testing framework?

A mature test framework is mainly composed of 4 parts: basic module, management module, operation module and statistics module

Basic module

The underlying core library   generally refers to the third-party library used to operate the application under test, such as Selenium/WebDriver on the Web side. Such as Requests on the API side

Page objects in the object library PO mode

Reusable components such as some general tool methods, login modules, and file processing modules

The configuration file includes the configuration of the test environment and the configuration of the application such as pytest.ini

management module

Test Data Management

How is test data managed?

Test file management

A test case should correspond to three files, namely: Page class file (xxxPage, according to the PO model), test class file (testxxxPage) and object library file (xxxPageYml)

run module

Test case scheduling  The test framework should be able to organize and schedule test case generation and execution on demand, such as filtering test cases by tags, files, and folders.

Sequential execution, concurrent execution, and remote execution

error recovery mechanism 

The continuous integration support    test framework should be able to integrate with the CI system at low cost, including specifying the operating environment through user input parameters, and automatically generating test reports after the test is completed.

Statistics module

testing report

 The test report should be comprehensive, including overall information such as statistics on the number of test cases, success/failure percentage of test cases, and total execution time of test cases. Among them, for a single test case, it should also include information such as the test case ID, test case running results, test case running time, the module to which the test case belongs, system screenshots at the time of test failure, and test logs.

log module

The test framework should include complete log files to facilitate troubleshooting and positioning when errors occur.

notification module

Email, WeChat, DingTalk notification

Test Framework Design Principles

Guess you like

Origin blog.csdn.net/seanyang_/article/details/132061574