当前位置:网站首页>[test development] automatic test selenium (I)
[test development] automatic test selenium (I)
2022-06-13 03:39:00 【Bryant tapping the code】
【 Test Development 】 automated testing selenium piece ( One )
What is automated testing
Automated testing refers to the automation of software testing , Run the application or system in the preset state , Preset conditions include normal and abnormal , Finally, evaluate the operation results . The process of transforming human driven test behavior into machine execution .
Common automated test tools : QTP、selenium、Rational Robot 、jmeter、appium、soapui、Loadrunner wait
selenium It's a web Automated testing tools for , Many students who study automatic learning function begin to choose selenium , Compared to it QTP There are many advantages :
- free , There's no need to crack it any more QTP And it's a big headache
- small , For different languages, it's just a package , and QTP Need to download and install 1 More than a G The program .
- This is also the most important point , No matter how familiar you used to be C、java、ruby、python、 Or both C# , You all Can pass selenium Complete automated testing , and QTP Only support VBS
- Support for multiple platforms :windows、linux、MAC , Support for multiple browsers :ie、ff、safari、opera、chrome
- Support the execution of distributed test cases , Test cases can be distributed to different test machines for execution , Equivalent to points The function of the hair machine .
The difference between automation tools and automation frameworks ?
Automated testing framework can generally be divided into two levels , The upper layer is to manage the development of the whole automatic test , Perform... And maintenance , In a relatively large project , It plays an important role , It can manage the entire automated test , Including the sequence of automated test case execution 、 Maintenance of test scripts 、 And centralized management of test cases 、 Test report and test task, etc . The lower layer is mainly the development of test scripts , Make full use of relevant testing tools , Build test driven , And complete the test business logic .
How to implement automation
Applicable objects of automated testing :
Prerequisites for implementing automated testing : Demand changes infrequently 、 Project cycle long enough 、 Automated test scripts are reusable
- Projects with frequent demand changes , Automated scripts cannot be reused , Maintenance costs are too high , Low cost performance
- The project cycle is short , The automatic script is not used much after preparation , Low cost performance
- Projects with strong interaction , Projects requiring human intervention , Automation cannot be implemented
Suitable for automation projects :
4. Product type project . Product based projects , The new version is an improvement on the old version , Items with little function , The old project must be tested repeatedly, but the new function must be tested again . Regression testing is the strength of automated testing , It can be a good way to verify whether you have introduced new defects , Whether the old defects have been corrected . To some extent, automated testing tools can be called regression testing tools .
5. Mechanical and frequent testing . You need to enter the same... Each time 、 A lot of data , And in a project The operation cycle is relatively long .
When to implement ?
If our automation implementation fails , Obviously , We did the job at an inopportune time . Suggest : Predictable requirements do not affect the design of automated test cases 
How to implement automated testing
Simply speaking , The concrete implementation of automated testing , It should include the following seven processes .
- analysis : Overall grasp the system logic , Analyze the core architecture of the system .
- Design : Design test cases , Test cases should be clear enough , Wide coverage and excellent
- Realization : Implementation script , There are two requirements. One is to assert , The second is the rational use of parameterization .
- perform : Executing scripts is far from as simple as we think . We need to carefully analyze the causes of exceptions during script execution .
- summary : Analysis of test results , And the summary of testing process is the key to automatic testing .
- maintain : The maintenance of automated test scripts is a difficult but necessary problem .
- analysis : In the process of automated testing, deeply analyze the coverage risk of automated use cases and the cost of script maintenance .
Direction of development
- Automate the execution of scripts , Maintenance and result analysis
- Automated scripting
- Design of automatic test scheme , Frame selection
- Coding implementation of automatic test framework
- Design of automatic testing framework
The skills needed to automate testing
- Understand the basic business
- Understand the technical framework of the business
- Understand functional testing
- Know a programming language
- I know the database 、 operating system
- Learn about common test frameworks
- …
What is? selenium
Selenium yes ThroughtWorks The company has a strong open source Web Functional testing tool series , Support for multiple platforms 、 Multi browser 、 Multi language to realize automatic test ,Selenium2 Will browser native API Encapsulated into WebDriver API, You can directly operate the elements in the browser page , Even operate the browser itself ( screenshots , Window size , start-up , close , Installing a plug-in , Configure certificates and so on ), So it's like a real user is doing it .
Support multiple development languages :ruby,python,java,perl,c# etc. , meanwhile Selenium The test runs directly in the browser , It's like a real user doing it by hand . Supported browsers include IE、Chrome and Firefox etc. .
Selenium From the previous 1.0(RC(Remote Control)) Evolved to the present Selenium2(Selenium1+WebDriver).
Selenium 2.0( also called Selenium WebDriver) The main new feature of is the integration of WebDriver.WebDriver Used to be Selenium1( also called Selenium RC) competitors .Selenium RC Run... In a browser JavaScript application , and WebDriver Control the browser directly through native browser support or browser extension .
The reason for the merger , Here's why :
- WebDriver It's solved Selenium The shortcomings of being ( such as ,
Bypass JS The sandbox); - Selenium It's solved WebDriver The problem is ( for example
Support for a wide range of browsers); - Selenium The main contributors of all feel that merging projects is the best way to provide users with the best framework .
In short :selenium
A brief introduction webdriver How it works :
- After launching the browser ,selenium-webdriver Will bind the target browser to a specific port , The browser will be used as webdriver Of remote server.
- client ( That is, the test script ), With the help of ComandExecutor send out HTTP Request to sever End ( Communication protocol :The WebDriver Wire Protocol, stay HTTP request Of body in , Will WebDriver Wire Under the agreement JSON Format string to tell Selenium What do we want browsers to do next ).
- Sever End needs to rely on native browser components , conversion Web Service The command for is browser native To complete the operation .

边栏推荐
- LVS四层负载均衡集群(5)LVS概述
- Druid query
- Environmental pollution, enterprises, highways, fixed assets, foreign investment in all prefecture level cities in China - latest panel data
- User and permission configuration in SQL Server database to ensure database security
- Summary of rust language practice
- MySQL auto sort function deny_ rank() over()、rank() over()、row_ Num() over() usage and differences
- The latest collation of the number of years of education per capita in the country and provinces -1989-2020- includes the annual original data, calculation process and result summary
- The latest summary of key topics of journal C in 2022 - topic scope, contribution method and journal introduction
- Simulink code generation: table lookup module and its code
- Complex network analysis capability based on graph database
猜你喜欢
![[azure data platform] ETL tool (3) - azure data factory copy from local data source to azure](/img/c3/e4b118a378ce8d884163aa1709a7f5.jpg)
[azure data platform] ETL tool (3) - azure data factory copy from local data source to azure

MASA Auth - SSO与Identity设计
![[azure data platform] ETL tool (6) -- re understanding azure data factory](/img/b5/da5dc9815fb9729fb367f2482913b7.jpg)
[azure data platform] ETL tool (6) -- re understanding azure data factory

Spark Optimization -- differences and policy selection of RDD cache (cache, persist, checkpoint)

Prefecture level city - air flow coefficient data - updated to 2019 (including 10m wind speed, boundary height, etc.)

Feign based remote service invocation

Azure SQL db/dw series (10) -- re understanding the query store (3) -- configuring the query store

Brief introduction: distributed cap theory and base theory
![[200 opencv routines by youcans] 201 Color space conversion of images](/img/99/36ba75cda08fd816dce83eaeea9e8d.png)
[200 opencv routines by youcans] 201 Color space conversion of images

Window and various windowfunctions in Flink
随机推荐
An error is reported in the JDBC connection database: connection to 139.9.130.37:15400 referred
Video playback has repeatedly broken 1000w+, how to use the second dimension to create a popular model in Kwai
[azure data platform] ETL tool (6) -- re understanding azure data factory
LeetCode185. All employees with the top three highest wages in the Department (MySQL)
Economic panel topic 1: panel data of all districts and counties in China - more than 70 indicators such as population, pollution and agriculture (2000-2019)
MySQL learning summary 7: create and manage databases, create tables, modify tables, and delete tables
look on? What is the case between neo4j and ongdb?
LVS四层负载均衡集群(4)负载均衡的主要方式
Spark optimization - Troubleshooting
【youcans 的 OpenCV 例程200篇】201. 图像的颜色空间转换
Complex network analysis capability based on graph database
Multi thread writing method and the making of slot machine
Spark core concepts: Master, worker, driver program, executor, RDDS
Masa auth - SSO and identity design
Doris outputs numbers in currency format. The integer part is separated by commas every three digits, and the decimal part is reserved for two digits
MySQL learning summary XIII: detailed explanation of if, case, loop, while & cursor of process control
LVS四層負載均衡集群(5)LVS概述
Scala method and function notes
Use of Oracle PL-SQL
Doris data aggregation