How should a perfect automated testing framework be written?

 1. What is an automated testing framework ?

An automated testing framework is an infrastructure built to provide an execution environment for automated test cases or scripts. An automated testing framework helps in the efficient development, execution, and reporting of automated test cases.

advantage:

· Code reuse

·  Improve test efficiency

·  Higher test coverage

·  Low maintenance cost

Detect and log  bugs earlier

Second, the basic composition of the framework

1. Configuration file management:

Generally, a configuration file is required to control some environmental information and switches. The configuration file can be txt/xml/yaml/properties/ini. Generally, .propertis is used more in JAVA , and the ini file is usually selected for Python .

2. Separation of business logic code and test script

If the code and script are in the same class file, then code refactoring and reuse are not used at all. After the code and use case files are separated, it will be clearer, and more people can develop scripts, which is convenient for debugging.

3. Report and log file output

How many cases have been executed and what the results of the cases are, all of which need to be displayed in a report. Generally, a third-party plug-in is used to realize this function. Many report formats are html, simple and clear style. Log output is also very important. If an error occurs and the script fails to execute, use the log to quickly locate the location of the problem.

4. Encapsulation of custom libraries

Many functions need to be called repeatedly, which can be written as a public method and placed under the toolkit for easy calling each time, such as the encapsulation of browser engine classes and basepage.py.

5. Management and execution of scripts

For example, the unit test framework unittest in Python has a very high usage rate.

6. Third-party plug-ins

Sometimes, some functions need to be better realized with the help of third-party plug-ins, such as AutoIT (to realize file upload and download). There is also the use of third-party report plug-ins to generate test reports based on html format.

7. Continuous integration

git, svn, ant, maven, jenkins, we will integrate this into jenkins to achieve continuous integration and execute test scripts with one click.

3. Popular automated testing frameworks

Robot Framework

Robot Framework is the best choice if you want to use python automation testing framework for test automation. Robot Framework is based on Python, but Jython (Java) or IronPython (.NET) languages ​​can also be used for scripting use cases.

·  Robot Framework uses a keyword-driven approach to make test case creation easy.

·  Robot Framework can also test MongoDB, FTP, Android , Appium, etc.

·  It has a lot of testing libraries, including Selenium WebDriver library and other commonly used tools.

·  Robot Framework has many APIs that help make it as extensible as possible.

WebdriverIO

WebdriverIO is an automated testing framework based on Node.js. It has an integrated test runner that can run automated test cases for web applications as well as native mobile apps . Moreover, WebdriverIO can run on both the WebDriver protocol and the Chrome Devtools protocol, making it very effective for both Selenium Webdriver-based cross-browser testing or Chromium-based automation. Since WebDriverIO is open source, test engineers have access to a bunch of plugins for their automation needs.

Finally, I would like to thank everyone who has read my article carefully. Reciprocity is always necessary. Although it is not a very valuable thing, you can take it away if you need it:

These materials should be the most comprehensive and complete preparation warehouse for [software testing] friends. This warehouse has also accompanied tens of thousands of test engineers through the most difficult journey, and I hope it can help you! Partners can click the small card below to receive  

Guess you like

Origin blog.csdn.net/okcross0/article/details/132320815