automated test model

concept

The automated testing model can be seen as the idea of ​​automated testing framework and tool design. Automated testing is not just about writing scripts to run, but also needs to consider how to improve the efficiency of scripts, code reuse, parameterization and other issues. There are four main categories of automated testing models: linear models, modular-driven testing, data-driven, and keyword-driven.

Linear model

Each script in the linear script is independent of each other and does not generate other dependencies and calls. In fact, it is a script that simply simulates a certain operation process of the user.

Case: Automatically log in to QQ space and automatically log out


Modular Drive Test

Although each use case of the linear model can be run independently, there is a lot of repetitive code between use cases, and the development and maintenance costs are high. In fact, the repeated operation code is encapsulated into an independent public module. This part needs to be used when the use case is executed, and it can be called directly. This is the module-driven test. Such as login system, logout, screenshot function, etc.

Case: Automatically log in to Qzone and log out automatically. Encapsulate login and logout, and call it when you use it.


Called directly in the same file, you can write directly as follows:

If you need to call it in another folder, you need to write as follows:

If there is a problem with calling the module, you need to set the following:


Data Driven Testing

Although the module-driven model solves the problem of duplication of scripts, it is not suitable for the use cases that need to be tested with different data. Data-driven is the change of data to drive the execution of automated tests, and ultimately lead to changes in test results. The way of loading data can be a list, a dictionary or an external file (txt, csv, xml, excel), the purpose is to achieve the separation of data and script.

Case: Automatically log in to Qzone and log out automatically. Encapsulate login and logout, and call it when you use it. Set parameters for the username and password, and then pass in the username and password when calling.

The actual call is as follows:


Keyword Driven Testing

Changes in test results caused by changes in keywords are called keyword-driven testing. Selenium IDE is also a traditional keyword-driven automation tool. Robot Framework is a more powerful keyword-driven testing framework.


Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325421694&siteId=291194637