[Web Automation Testing] Getting Started 01 - Introduction to the Framework

First, the purpose

As an unavoidable "hot potato" in the field of software automation testing, web automated testing is usually the first choice for learning among test practitioners. Compared with the automation of C/S architecture, B/S has its own limitations. Many advantages have been ignored, including industry development trends, R&D model characteristics, and testing tool support. Its overall complete ecosystem has far exceeded the testing value of the C/S architecture. So let’s talk about the past and present of web automated testing in detail.

2. Description

The technology stack used in this article is Selenium+Python. Because it is not difficult to program, the overall idea is based on object-oriented programming concepts. Therefore, as long as everyone’s coding language foundation is not weak, it can be completely replaced.

3. The difference between manual testing and automated testing

Before formally introducing web automation testing, let's first talk about some differences and cognitions between manual and automated testing. Many students in majors or those who have just entered the testing industry will have this understanding. Compared with manual testing, automated testing has a higher technical content, the salary of the position is better, and the position is less replaceable. Bloggers can only say half-and-half about this view. For students who have little actual work experience and actual project experience, even if automation has a higher technical content, it is recommended that everyone start with manual testing. I won’t go into details. The most practical thing for everyone is your core competitiveness. So for testing, what is the core competitiveness of testing? business! It must be business, but why is it business?

Imagine that if you have strong technical skills but average business skills, even if you can write very efficient code, you cannot get close to the business of the product or project. Even so, the scripts or frameworks you write will be useless. . You must ask other colleagues who understand the business to help you review or modify it, but on the other hand, if you have a strong business understanding and a good grasp of the product's functions and design, you will be successful in both test case design and experience testing, and you can often do it. Discover some product problems, defects and even loopholes in the design scenario that others cannot detect. Coding is a hard skill that can be honed through a lot of practice, but business requires not only understanding, but more often extension and innovation. Why is it said that testing should be conducted by people in the entire company who understand the product and project? It is because they understand the use of its functions, the matching of business scenarios, and the pain points of requirements better than anyone else. This even needs to exceed the understanding of the product manager. So it will never be the technology that determines how far a test can go in its path within a company, but the business.

As for the difference between the two, based on the above point of view, to do a good job in manual testing, these four points must be met: 1. Business understanding ability 2. Thinking logical ability 3. Communication ability 4. Basic testing ability, if you can’t do it well From these four points, I dare to say that your manual testing ability is definitely not good. To do a good job in automation, in addition to achieving the above four points, you also need to improve your coding capabilities, thinking changes, framework design and other capabilities. It can be seen that the difference between automation and manual work is not only different in the way of implementation and execution, but also a step-by-step process. Therefore, the blogger still recommends that if you want to automate, it is best to start with manual business testing.

4. Framework selection

Speaking of web automated testing frameworks, there are already many mature testing frameworks on the market, such as QTP, selenium, AutoRunner, Robot Framework, watir, RFT and so on.

QTP is a relatively old automated testing framework. There were still many teams and companies using it before 2012. The scripts are relatively simple and easy to understand, but on the other hand, the restrictions are also relatively large. The language can only support VBS and the cost is high. , the framework's object support is not flexible enough.

Selenium is still one of the most mainstream web automation testing frameworks. It is free and open source and supports cross-platform. The key is that test execution can be run directly in the browser to simulate the user's real operations.


AutoRunner can support a rich technical framework and uses Java as a scripting language. It supports a relatively complete ecosystem and uses keyword reminders, keyword highlighting, and keyword drivers. Supports synchronization points, check points, parameterization, and data-driven parameterization. It is more suitable to use it for functional testing, regression testing, system testing, construction testing, etc.


Robot Framework supports python, keyword-driven, data-driven, and custom keywords. Test cases in the framework can be written in a variety of formats, and test reports can be automatically generated. There is no need for third-party library support like other software.


Watir uses ruby ​​as the scripting language and can now support multiple cross-platform browsers. As an open source framework, watir has many limitations and shortcomings compared to selenium, such as the inability to record scripts and the ability to bounce js. Box support is not very friendly etc.


RFT was launched by IBM. This is a framework not only used for web automation testing. It can also test HTML, Java, Windows, .NET, Visual Basic, Silverlight, Eclipse, Siebel, Flex, Ajax, Dojo, GEF and PowerBuilder applications. But it is not open source, it requires a fee, and it does not support many object libraries. It is good if it is used for learning.


So how to choose a testing framework that suits you among these various frameworks? We can start from two points. First, evaluate your own abilities, what kind of coding language you are good at, and even whether you have a coding foundation. In view of the characteristics of the above frameworks, for example, those who have no coding ability can give priority to frameworks with script recording functions; and for example, those who are good at Java can choose frameworks that have better Java support. The other is to evaluate your own test object (product or project), what kind of technology stack is used to implement the test object, the frequency and scale of page changes or iterations, etc. If our selection criteria are evaluated based on the above two aspects, there is a high probability that we can choose an automated testing framework that suits our project or product.

5. How Selenium works

Before describing the working principle of Selenium in detail, let’s take a look at a simple working principle diagram:

The client in the picture is actually the source code we wrote using python. Because selenium does not have a graphical interface, we will just look at the client. It can become the Selenium business function we implement using source code.

The driver is our webdriver. Everyone should know that our source code cannot directly instruct the browser to perform corresponding operations. Our code must establish a communication session with the browser through the provided API. With this session, the script can drive the browser to perform the specific business operations required for your test.

As a browser, browser is the interface object through which we finally present business operations. The characteristic of selenium is that it can be operated directly in the browser to simulate the user's real business actions. After receiving the http request simulated by the code, the browser will parse it, implement the specific operations (actions) required by the business in the browser interface, respond to the request, and inform the requester whether the operation is successful.

In summary, the overall process is that the code script we write calls selenium, and then selenium calls a specific API to perform business operations on the browser. The browser notifies the script or IDE of the results of the business operations.

Finally, I would like to share with you some of my learning materials:

The above content should be the most comprehensive and complete preparation warehouse for software testing friends. In order to better organize each module, I also referred to many high-quality blog posts on the Internet. and projects, trying not to miss every knowledge point. Many friends relied on these contents to review and got offers from major manufacturers such as BATJ. This warehouse has also helped many software testing learners. I hope it can also help you. .

Follow my WeChat official account below to get it for free! ↓ ↓ ↓ ↓ ↓

Guess you like

Origin blog.csdn.net/weixin_56331124/article/details/132667513