What is a unit testing framework
Unit testing refers to testing the smallest unit of software (method, function, class, etc.), commonly used unit testing framework:
Java:Junit、TestNg
python:Unittest、Pytest
In automated testing, one use case is one method, so the unit testing framework is also applicable to automated testing.
The role of unit testing frameworks
Organize and execute test cases
According to the actual test needs, from a large number of test cases, select the appropriate test cases for batch execution, such as: smoke test case set, regression test case set, etc.
test judgment
Any test needs to judge the actual result and the expected result, and the unit test framework provides a wealth of assertion methods.
Record test results: test case pass rate, execution time, failure case details, etc.
Automated testing is to let the code execute the test. To implement automated testing smoothly, it is necessary to minimize manual intervention, reduce script development costs and maintenance costs, and improve testing efficiency.
A good testing framework is to enable people who don't understand code to implement automated testing through this framework .
The relationship between automated testing framework and unit testing framework
The unit test framework will be used in the automated test framework. A complete automated test framework requires the help of many other tools to achieve its goals, reduce script development costs, facilitate maintenance and management, improve test efficiency, etc., such as:
Selenium: realize the operation of the browser, etc.
unittest: organizes batch execution of use cases, etc.
PO design pattern: Improve code reusability, improve script writing and maintenance efficiency
Data-driven: Realize the separation of data and code
Keyword-driven: data-driven upgrade, reducing the development cost and difficulty of automation scripts
There are also logs, configuration files, etc.