Do you know the design principles of the 2023 automated testing framework? Come and see!

1. Code specifications

As the business advances, the testing framework will inevitably involve secondary development of code. Therefore, code writing should comply with general specifications, code naming should comply with industry standards, and the code hierarchy should be clear. Especially in large-scale projects and multi-person collaborative projects, if the code is not well standardized, the code of the entire framework will be mixed in style, obscure and difficult to understand, and subsequent maintenance will be difficult, eventually becoming "ancestral code" that no one dares to touch.

2. The module is clear and explicit

Modularization is to logically divide the test framework into several different modules. As shown in the following modular layered test framework, users can tailor it according to the actual situation.

The advantage of modularity is that it is reusable and easy to replace and modify.

Taking the above figure as an example, assuming that the test report module used to be Allure, and now we want to replace it with a self-developed test report that is more relevant to our business, we only need to replace the report module.

However, if the test framework is not divided into modules and the test reports are coupled in the framework code, it will lead to the problem that the test reports cannot be switched, or the switching cost is too high, and it will be more painful to change.

现在我也找了很多测试的朋友,做了一个分享技术的交流群,共享了很多我们收集的技术文档和视频教程。
如果你不想再体验自学时找不到资源,没人解答问题,坚持几天便放弃的感受
可以加入我们一起交流。而且还有很多在自动化,性能,安全,测试开发等等方面有一定建树的技术大牛
分享他们的经验,还会分享很多直播讲座和技术沙龙
可以免费学习!划重点!开源的!!!
qq群号:110685036

3. Strong versatility

Universally applicable to different operating systems. For example, the testing framework is not only applicable to Windows operating systems, but also to MacOS and Linux systems. The more universal it is, the wider the audience of the testing framework will be.

It can solve the same general problem. For example, the test framework has an underlying method for operating pop-up boxes, so whether it is an Alert box, a confirmation box, or an interactive box that allows user input, the test framework should be able to recognize and operate it.

4. Maintainable and scalable

(1) Maintainability

For a test framework to be easy to maintain, the code must be standardized and the modules must be clear. In addition, the code style of the entire test framework should be unified, easy to read, and easy to understand. In short, it is necessary to make it easy to locate and modify when there is a problem with the framework; more importantly, even if multiple people collaborate on this framework, the framework code must look like it was written by the same person.

(2) Scalability

Scalability means that the framework can be easily expanded when requirements change. If the test framework cannot be expanded, it will not be able to solve new problems brought about by business development, which means that the life of the test framework will be short.

5. Error handling mechanism, efficient solution

During the test run, it is inevitable that errors will occur due to various reasons. At this time, the test framework must have the ability to handle errors. Error handling mechanisms are generally divided into two types: stop operation and error recovery.

6. The system log is clear and convenient for debugging.

In addition to the error handling mechanism, the system's operation logs can also help you quickly identify the root cause of the problem. Therefore, the usual logs must be clear and detailed, and it is best to have context, so that you can effectively debug based on the logs and quickly locate the cause of the error.

7. Support test environment switching

From development to launch, a product will undergo testing in several test environments, such as dev environment, integrated test environment, pre-production environment, production environment, etc. Therefore, the testing framework must be able to run a set of scripts in multiple environments, support environment switching, and perform automated configuration (including system configuration, test data configuration, etc.) according to the environment.

8. Support external data driver

Dynamically generate test cases based on external input data and display them separately in the test report. The test framework will parse these test cases with different data but the same steps and operations into different independent test cases during operation, and display them one by one in the test report after the test run is completed.

Dynamically switch running use cases based on external input data. Different test purposes require different test cases, so the automated testing framework will label each test case, and then automatically select test cases with specific labels to run as needed.

9. Support sequential, concurrent and remote operation

When you have thousands or even tens of thousands of test cases, sequential testing will take a lot of time. In order to get test results quickly, the test framework should support sequential, concurrent, and remote execution, which can shorten the overall execution time of test cases.

10. The report is complete and detailed

Test reports are an important part of QA work and are usually issued at the end of a project or a sprint.

Although, in actual work, we often hear people complain that test reports are too cumbersome and do not produce any direct value, but complete and detailed test reports can not only describe what QA has done, but also see the entire project Whether the life cycle runs smoothly or not, and what is the quality of the software.

11. Solve currently unresolved problems

"Don't reinvent the wheel" is the first principle of tool creation. From a functional perspective, a framework is recognized because it either solves a problem that cannot be solved currently, or the solution is better than the current one.

For example, Selenium/WebDriver was first known because it was open source and cross-platform; later Selenium/WebDriver's replacement, Cypress, was known because it also had the ability to run within the browser and provide its own Mock.

Therefore, whether your framework can be recognized depends on whether it has unique functional characteristics. This is a label that distinguishes it from other frameworks and is also a trump card to fill the gap in the market.

12. Version control, retrospective review

What is version control? In fact, it means bringing the code under the management of a version control system (such as Git). So why does the testing framework need version control?

With version control, different versions of your test code can appear in different branches. Otherwise, you can only maintain one version of the code at a time, which is very inconvenient.

With version control, not only collaborative development and version switching become very easy, but users can also understand the development context of the framework by viewing changes between versions.

13. Continuous integration, taking the overall situation into account

The previous principles are based on the perspective of testing itself, while "continuous integration" is based on the entire company's business and requires you to work with the entire development team to complete it. At the same time, this is a reflection of your promotion to "senior".

The testing framework should be easily integrated into the company's continuous integration system and trigger tests through the continuous integration system.

Finally, I would like to thank everyone who read my article carefully. Looking at the increase in fans and attention, there is always some courtesy. Although it is not a very valuable thing, if you can use it, you can take it directly!

Software Testing Interview Document

We must study to find a high-paying job. The following interview questions are from the latest interview materials from first-tier Internet companies such as Alibaba, Tencent, Byte, etc., and some Byte bosses have given authoritative answers. After finishing this set I believe everyone can find a satisfactory job based on the interview information.
 

Insert image description here

Guess you like

Origin blog.csdn.net/jiangjunsss/article/details/132906547