selenium简介_什么是Selenium? Selenium简介

selenium简介

什么是Selenium? (What is Selenium?)

Selenium is a free Open source functional Testing tool used for testing web applications on multiple browsers and multiple operating systems (Platforms). It is used for Functional and Regression Testing. Testing done by the selenium tool is usually referred to as Selenium Testing.

Selenium是免费的开源功能测试工具,用于在多个浏览器和多个操作系统(平台)上测试Web应用程序。 它用于功能和回归测试。 用Selenium工具完成的测试通常称为Selenium测试。

Selenium成分 (Selenium Components)

Selenium is not just a single tool but is a combination of different suites of software. Selenium has four components.

Selenium不仅是单个工具,而且是不同软件套件的组合。 Selenium有四个成分。

  1. Selenium IDE (Integrated Development Environment)

    Selenium IDE(集成开发环境)
  2. Selenium RC (Remote Control) – deprecated now

    Selenium RC(远程控制)–已弃用
  3. Selenium WebDriver

    Selenium WebDriver
  4. Selenium Grid

    Selenium网格
selenium简介_什么是Selenium? Selenium简介

Selenium Components

Selenium成分

SeleniumIDE (Selenium IDE)

Selenium Integrated Development Environment (IDE) is the simplest framework in the Selenium suite. It is a browser plugin to record and playback the operations performed on the browser. Selenium IDE plugins are available for Chrome and Firefox browsers. It doesn’t support the programming features. Selenese is the language which is used to write test scripts in Selenium IDE.

Selenium集成开发环境(IDE)是Selenium套件中最简单的框架。 它是一个浏览器插件,用于记录和回放在浏览器上执行的操作。 Selenium IDE插件可用于Chrome和Firefox浏览器。 它不支持编程功能。 Selenese是用于在Selenium IDE中编写测试脚本的语言。

Selenium IDE的好处 (Benefits of Selenium IDE)

  1. Very use to use and install

    非常有用的使用和安装
  2. Has built-in test results reporting module

    内置测试结果报告模块
  3. No programming experience is required

    无需编程经验
  4. It is used to create and execute Test cases using Firefox or Chrome browsers

    它用于使用Firefox或Chrome浏览器创建和执行测试用例
  5. The user can easily record the Test scripts

    用户可以轻松记录测试脚本
  6. The user can edit the Test scripts

    用户可以编辑测试脚本
  7. The user can create Test Suites.

    用户可以创建测试套件。

Selenium IDE的缺点 (Drawbacks of Selenium IDE)

  1. It doesn’t support iteration statements

    它不支持迭代语句
  2. No support for conditional statements

    不支持条件语句
  3. It doesn’t support error handling

    它不支持错误处理
  4. It does not support Database testing

    它不支持数据库测试
  5. Available only in Firefox and Chrome

    仅在Firefox和Chrome中可用
  6. It doesn’t generate a detailed Test Reports summary.

    它不会生成详细的测试报告摘要。

SeleniumRC (Selenium RC)

Selenium RC is a testing tool used for web applications testing. It supports programming using RC. Using RC, we can test out applications in multiple browsers and also in multiple operating systems.

Selenium RC是用于Web应用程序测试的测试工具。 它支持使用RC进行编程。 使用RC,我们可以在多个浏览器和多个操作系统中测试应用程序。

Selenium RC has complex architecture hence slow in automation test execution. In Selenium RC, we need to launch a separate application called Selenium RC Server before we can start testing. Selenium RC server acts as a middleman between selenium commands and your browser. Selenium RC has been officially deprecated, you should use WebDriver or IDE to test your web applications.

Selenium RC具有复杂的体系结构,因此自动化测试执行速度较慢。 在Selenium RC中,我们需要先启动一个名为Selenium RC Server的单独应用程序,然后才能开始测试。 Selenium RC服务器充当Selenium命令和浏览器之间的中间人 。 Selenium RC已被正式弃用,您应该使用WebDriver或IDE来测试您的Web应用程序。

selenium简介_什么是Selenium? Selenium简介

Selenium RC

SeleniumRC

Selenium WebDriver (Selenium WebDriver)

Selenium WebDriver is a web application testing tool introduced by eliminating the drawbacks of IDE and RC. It is simple in architecture and also easy to understand and use.

Selenium WebDriver是一个Web应用程序测试工具,通过消除IDE和RC的缺点而引入。 它的体系结构简单,也易于理解和使用。

Selenium WebDriver架构 (Selenium WebDriver Architecture)

selenium简介_什么是Selenium? Selenium简介

Selenium WebDriver

Selenium WebDriver

  1. It is a well-designed object-oriented API developed to automate web and mobile software applications testing process

    它是经过精心设计的面向对象的API,旨在自动执行Web和移动软件应用程序测试过程
  2. It is faster than Selenium RC

    比Selenium RC快
  3. Selenium WebDriver directly talks to the browser

    Selenium WebDriver直接与浏览器对话
  4. It’s API is more concise than Selenium RC

    它的API比Selenium RC更简洁
  5. It cannot readily support new browser, but RC can

    它不能轻易支持新的浏览器,但是RC可以
  6. It doesn’t have a built-in command for automatic generation of test results

    它没有用于自动生成测试结果的内置命令
  7. It doesn’t support window base apps

    它不支持基于窗口的应用程序
  8. It needs outside support for report generation activity like dependence on TestNG or Jenkins.

    它需要外部支持报告生成活动,例如对TestNG或Jenkins的依赖。

Selenium网格 (Selenium Grid)

Selenium Grid is used to run Automation tests on multiple browsers across multiple operating systems, machines simultaneously. It supports Parallel Testing. It is used only for Test Execution.

Selenium Grid用于在多个操作系统,计算机上的多个浏览器上同时运行自动化测试。 它支持并行测试。 它仅用于测试执行。

特征 (Features)

  • Allows simultaneous running of tests in various web browsers, environments and machines

    允许在各种Web浏览器,环境和机器中同时运行测试
  • Saves time enormously

    大大节省时间
  • It speeds up the test suite completion time as it is capable of running various tests in parallel

    由于能够并行运行各种测试,因此可以加快测试套件的完成时间
  • Perform cross browser testing.

    执行跨浏览器测试。

何时使用Selenium Grid (When to use Selenium Grid)

You should use Selenium Grid when you want to do either one or both of the following:

如果要执行以下一项或两项操作,则应使用Selenium Grid:

When you run your tests against various browsers, operating systems, and machines all at the same time. This will ensure that the application you are testing is fully compatible with a wide range of browser operating system combinations.
Save execution time of your test suites. If you set up Selenium Grid to run, say, 5 tests at a time, then you would be able to finish the whole suite around 5 times faster.

当您同时针对各种浏览器,操作系统和计算机运行测试时。 这将确保您正在测试的应用程序与各种浏览器操作系统组合完全兼容。
节省测试套件的执行时间。 如果您将Selenium Grid设置为一次运行5个测试,那么您将能够以大约5倍的速度完成整个套件。

Selenium支持的平台 (Platforms supported by Selenium)

Selenium works with different Operating systems, browsers, programming languages and Testing Frameworks.

Selenium可与不同的操作系统,浏览器,编程语言和测试框架一起使用。

操作系统 (Operating Systems)

  • Microsoft Windows

    微软Windows
  • Macintosh

    苹果机
  • Linux

    的Linux

浏览器 (Browsers)

  • Mozilla Firefox

    火狐浏览器
  • Google Chrome

    谷歌浏览器
  • Internet Explorer

    IE浏览器
  • Safari

    苹果浏览器
  • Opera etc.

    歌剧等

编程语言 (Programming Languages)

  • Java

    Java
  • C#.Net

    C#.Net
  • Perl

    Perl
  • Python

    Python
  • Ruby

    Ruby
  • PHP

    PHP

测试框架 (Testing Frameworks)

  • C#.Net – NUnit

    C#.Net – NUnit
  • Java – JUnit or TestNG

    Java – JUnit或TestNG
  • Python – unittest, pyunit

    Python –单元测试,pyunit
  • PHP – Behat + mink

    PHP – Behat +水貂

Selenium的优点 (Advantages of Selenium)

  1. It is an Open Source Software, you can check out its source code from its GitHub Repository.

    这是一个开源软件,您可以从其GitHub Repository中检出其源代码。
  2. It supports multiple Programming languages

    它支持多种编程语言
  3. It supports multiple Operating systems

    它支持多种操作系统
  4. It supports multiple browsers

    它支持多种浏览器
  5. It supports parallel testing.

    它支持并行测试。

Selenium的缺点 (Disadvantages of Selenium)

  1. It supports only web based applications and does not support windows based applications

    它仅支持基于Web的应用程序,不支持基于Windows的应用程序
  2. It is difficult to test Image related applications

    测试与图像相关的应用程序很困难
  3. It does not support built-in Report facility

    它不支持内置的报告功能
  4. It is difficult to use

    很难使用
  5. Newly added features may not work properly

    新添加的功能可能无法正常工作
  6. It does not support to test Captcha and Barcode readers

    它不支持测试验证码和条形码阅读器
  7. No ready vendor technical support available from anybody

    没有任何人提供现成的供应商技术支持
  8. Tester should have high programming language knowledge to write Selenium Automation Test Scripts.

    测试人员应该具有较高的编程语言知识,才能编写Selenium Automation测试脚本。

Selenium优于QTP的优势 (Advantages of Selenium over QTP)

Selenium and QTP, both of them are automation testing tools:

Selenium和QTP都是自动化测试工具:

  1. Selenium is an open source tool while QTP is a commercial tool

    Selenium是一种开源工具,而QTP是一种商业工具
  2. Selenium is used to test only web-based applications. However, QTP can be used to test a wide variety of applications like web-based and windows based applications

    Selenium仅用于测试基于Web的应用程序。 但是,QTP可用于测试各种应用程序,例如基于Web的应用程序和基于Windows的应用程序
  3. Selenium supports scripting in multiple languages like Java, Python, .Net, Perl, Ruby, and PHP while in QTP only VB scripting is supported.

    Selenium支持多种语言的脚本编写,例如Java,Python,.Net,Perl,Ruby和PHP,而在QTP中仅支持VB脚本编写。

References: Selenium IDE, Selenium WebDriver,

参考: Selenium IDESelenium WebDriver

翻译自: https://www.journaldev.com/25395/what-is-selenium-introduction-to-selenium

selenium简介