In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/03 Report--
Pay attention to Jiawei Technology and gain New knowledge of Operation and maintenance
This paper mainly aims at the introduction of the Selenium automated testing framework, which only involves the introduction of the overall function and the main points of the framework, as well as the basic technical requirements for the use of the premise. As a reference for developers and testers getting started.
This article refers to: the latest technical specifications and related materials of the Selenium framework
Brief introduction
Selenium is also an open source framework released using the Apache License 2.0 protocol. Selenium is also a complete set of Web application test system tools, which includes:
Selenium's core Selenium Core is based on JsUnit and is written entirely by JavaScript, so it can run on any browser that supports JavaScript
Recording of tests (Selenium IDE)
Write and run (Selenium Remote Control) (3.x removed)
Parallel processing for testing (Selenium Grid)
Selenium2.X includes the WebDriver and SeleniumRC (compatible with previous versions). Selenium3.X contains only WebDriver and SeleniumRC has been removed.
The overall product structure of Selenium is as follows: (after 3.x, SeleniumRC is removed)
Selenium IDE:
Is an entry-level tool for building scripts, is actually a plug-in to FireFox, with an easy-to-use interface. It has a recording function, can record the actions performed by the user, and can be exported as reusable scripts. If you have no programming experience, you can quickly familiarize yourself with Selenium commands through Selenium IDE. There is not much practical use of this tool. Selenium-core uses HTML to write test scripts, and you can also use Selenium-IDE to record scripts, but currently Selenium-IDE is only available in FireFox.
Selenium-RC (Selenium3.X removal):
Selenium-remote control abbreviation, is to use a specific language to write test classes. SeleniumRC supports many different languages to write automated test scripts, and accesses the application through the SeleniumRC server as a proxy server, so as to achieve the purpose of testing. It mainly includes the following two parts:
The ClientLibraries library is mainly used to write test scripts to control the library of SeleniumServer.
SeleniumServer is responsible for controlling browser behavior. SeleniumServer consists of three parts: Launcher,Http Proxy and Core. Among them, SeleniumCore is embedded into the browser page by Selenium Server, in fact, SeleniumCore is a collection of JavaScript functions, that is, through these JavaScript functions, we can use the program to operate on the browser. Launcher is used to launch the browser, load Selenium Core into the browser page, and set the browser's proxy to SeleniumServer's HttpProxy.
WebDriver:
After Selenium2.x introduced the concept of WebDriver, it provides a completely different way to interact with browsers. That is to use the browser's native API, encapsulated into a more object-oriented SeleniumWebDriver API, directly manipulate the elements in the browser page, and even manipulate the browser itself (screenshot, window size, start, close, install plug-ins, configure certificates, etc.). Since the native API of the browser is used, the speed is greatly improved, and the stability of the call is given to the browser manufacturer itself, which is obviously more scientific. However, some of the side effects are that there are some differences in the operation and rendering of Web elements among different browser vendors, which directly leads to different implementations of Selenium WebDriver according to browser vendors. For example, Firefox has a special FirefoxDriver,Chrome, a special ChromeDriver, and so on. (even AndroidDriver and iOS WebDriver)
Selenium Grid:
Realize the parallel processing of the test.
The way and process of testing based on Selenium
Selenium RC method (later version 3.x removes this method):
The test case establishes a connection to the Selenium-RC server through a Http request
Selenium RC Server drives a browser, loads Selenium Core into the browser page, and sets the browser's proxy to Selenium Server's Http Proxy
The execution use case sends a Http request to Selenium Server, Selenium Server parses the request, and then sends a JS command through Http Proxy to inform Selenium Core to perform the action of operating the browser and inject JS code
Selenium Core executes the received instructions and operates
Send a http request when the browser receives a new request
After receiving the Http request sent by the browser, Selenium Server reorganizes the Http request to get the corresponding Web page
The Http Proxy in Selenium Server returns the received page to the browser.
WebDriver (current mainstream method):
Selenium 2.x has remained until the launch of SeleniumRC, probably for forward compatibility. Selenium 3.x completed the removal of SeleniumRC.
Selenium2.X adds WebDriver to keep RC forward compatible. The WebDriver project was created by Simon Stewart, which is a very convenient automated testing tool. The way WebDriver handles different browsers is significantly different from that of RC. RC is handled by JavaScript no matter what browser it is, while WebDriver is the most acceptable language for browsers to handle. For example, in IE, C++ is the most suitable, in Firefox, JavaScript is the most suitable, and so on. By flexibly choosing the most appropriate language to deal with multiple browsers, we can avoid the security restrictions of some browsers on JavaScript. And WebDriver not only has these capabilities, it can also call the operating system API, especially when users need to simulate the mouse and keyboard for real page operations.
WebDriver:AndroidDriver,ChromeDriver, FirefoxDriver, HtmlUnitDriver, EventFiringWebDriver,InternetExplorerDriver, IPhoneDriver, IPhoneSimulatorDriver, RemoteWebDriver are now supported.
Selenium Grid (the current mainstream method):
The traditional Grid-free mode can only be tested on one machine. Selenium can be executed in the above two ways, the first is that each machine is consistent, and the second is that you can specify a specific browser or operating system to execute.
Requirements for automated test scripting
Premise familiar: HTML / XML/...
Premise familiar with: XPath (XML path language http://www.runoob.com/xpath/xpath-tutorial.html)
Development language: Java/Python/C#/PHP/ … At least be familiar with one development language
FIT mode: Selenium script (JS): command usage.
Driver mode: proficient use of libraries (different languages have different clients): methods, functions, etc.
The pattern of Selenium WebDriver + TestNG framework (TestNG is a new framework for testing Java applications) can be adopted.
Establish the specification for test case scripting (for WebDriver pattern)
Jenkins can be used to integrate Selenium Grid + WebDriver, and Selenium Report plug-ins.
The way the test results report is presented
Test report templates to be combined with other frameworks, such as TestNG test results report, ReportNg, etc.
Jenkins integrates selenium, which can be exported using selenium report plug-in
Can be combined with self-developed test results to show the processing platform, associated with the task platform.
Integration cost and method
Need to learn Selenium scripts and related technologies
Based on the WebDriver pattern of Selenium, the compilation of test cases requires data as a development language (mainstream mode).
If you combine TestNG, you need to be familiar with Java.
We can use the integrated mode of Jenkins + Selenium + TestNG + Selenium report (ReportNG) to automate the testing of Web applications. In the research and development of DevOps products, Selenium can be used for automated testing of WEB applications.
For more information, please refer to the official documents and related materials on the Internet.
Selenium+ Blue Whale, can realize automatic dialing and testing of application functions. Click on the article to see how it is implemented. "sharing | automatic dialing and testing of application functions based on BlueKing platform"
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.