Do you really know how to automate tests? Automated testing technology selection choice

automated testing framework

When learning automated testing or practicing automated testing, we must be familiar with a noun, that is, "automated testing framework", and some people also call tools such as Selenium and Appium "automated testing framework", so in the end How to understand the automated testing framework?

A framework in software engineering specifically refers to a support structure with certain constraints designed to solve an open problem. Based on this structure, it is possible to expand and insert more components (upgrades) according to specific problems, so as to construct a complete problem-solving solution more quickly and conveniently.

According to the definition of the above framework extended to the field of automated testing, we can define the automated testing framework to include the following functions:

(1) Log component

Record and manage logs to facilitate locating problems, such as Log4j, logging modules, etc.;

(2) Test report

Manage and generate test reports, get test results quickly, such as Allure, HtmlReport, etc.;

(3) Test static resources

Such as configuration files and other static resource management referenced to realize the separation of configuration and test scripts;

(4) Test case management and execution

Such as Java language system TestNG, Junit, Python language system UnitTest, Pytest, etc.;

(5) Test data management

Save use case parameterized data, such as Excel, yaml, csv format files can be used to separate test scripts from test data;

(6) Common module (Common)

Save use case public methods and common operations;

(7) Driver module (Driver)

The underlying execution automation test engine, such as Selenium Webdriver web-side test library, Appium client mobile-end test library, Requests/REST-assured interface test library.

Other accessibility features:

In addition to the basic components of the above-mentioned automated testing framework, the automated testing framework can also have more other auxiliary functions, such as parallel execution, failure retry, exception handling, and building through continuous integration platforms (such as Jenkins).

In general, a complete automated testing framework should have high scalability, maintainability, and stability. For example, Selenium and Appium only have some functions of the above frameworks, so when we choose an automated testing framework, it is more a combination of multiple tools/libraries, such as: Selenium+TestNG+Allure+Jenkins, Appium+TestNG+Allure+Jenkins etc.

Test framework technology selection

Currently common types of automated testing include interface automation and UI automation. There are many choices of automated testing tools/frameworks for interface and UI levels on the market. Before making technology selection, we must first analyze the structure and type of the project. If the project is mainly provided to other services in the form of interfaces, we can use interface automation. For projects with both backend and frontend, UI automation is adopted on the basis of quality assurance at the interface automation level.

interface automation

At present, the interface automation testing technologies on the market are very mature. The following introduces several mainstream technologies:

(1) Jmeter+Ant/Maven+Jenkins

Jmeter is developed by Java and open source, and provides a visual interface. Integrate the Maven or Ant plug-in through the Jenkins continuous integration platform, and then build the Jmeter script through Maven or Ant to meet the continuous integration of automated testing. If you are familiar with the Java language, you can also do secondary development of Jmeter.

(2) Postman+Newman+Jenkins

Postman is an interface testing tool that many testers will choose to use, and many developers will also use it to debug the interface. It is easy to use and powerful. Newman can support the command line to call Postman test case execution, and can also use the Jenkins platform combined with newman for continuous integration.

(3) Robotframework+RequestsLibrary+Jenkins

Robotframework (RF for short) is a keyword-driven test framework, which is mainly called by encapsulating keywords. Interface testing can be performed using the RequestsLibrary test library. RF can also write automated test cases without knowing a programming language.

(4) Java+REST-assured+TestNG+Jenkins

REST-assured in the Java language system is currently the most popular interface testing framework. Based on the BDD syntax style, it is very simple to write interface test cases. It has built-in very powerful functions such as hamcrest assertion and Gpath response analysis. Using the TestNG test framework we Can manage and execute test cases.

(5) Python+Requests+Pytest+Jenkins

In the Python language system, the requests module is encapsulated based on the standard library urllib and supports almost all its features. It is currently the most popular python language interface testing library. Pytest also belongs to the third-party unit test library in python, which is more powerful than the standard library Unittest.

web automation

At present, the most mainstream web automation framework is Selenium. Its built-in Selenium Webdriver component can support automated testing of multiple browsers through the JSON wire protocol, including Chrome, Firefox, IE, Safari, etc. Automated testing tools such as Selenide and Katalon are built and encapsulated based on Selenium, and their internal core is Selenium Webdriver.

Java language technology stack:

Java+Selenium+TestNG+Jenkins

Python language technology stack:

Python+Selenium+Pytest+Jenkins

Mobile automation

The most widely used mobile terminal should be Appium. Appium is an open source automated testing framework that supports automated testing of Web App, Native App, and Hybrid App on Android and IOS. Appium is based on Selenium Webdriver and adds mobile-related APIs.

Java language technology stack:

Java+App+TestNG+Jenkins

Python language technology stack:

Python+Selenium+Pytest+Jenkins

continuous integration

Automated testing is an important part of continuous integration. When developing and deploying new or updated functions, the continuous integration platform runs automated tests to quickly provide quality and regular feedback. The current mature continuous integration platform is none other than Jenkins.

Guess you like

Origin blog.csdn.net/a448335587/article/details/130091277