文档章节

自动化端对端测试框架-Protractor How It Works

dhb_oschina
 dhb_oschina
发布于 2016/04/24 10:37
字数 391
阅读 48
收藏 1

How It Works

Protractor is an end-to-end test framework for AngularJS applications. Protractor is a Node.js program that supports the Jasmine and Mocha test frameworks.

Selenium is a browser automation framework. Selenium includes the Selenium Server, the WebDriver APIs, and the WebDriver browser drivers.

Protractor works in conjunction with Selenium to provide an automated test infrastructure that can simulate a user’s interaction with an Angular application running in a browser or mobile device.

Protractor Components Diagram

When working with Protractor, it’s important to keep the following in mind:

  • Protractor is a wrapper around WebDriverJS, the JavaScript bindings for the Selenium WebDriver API (before writing any tests, skim through the WebDriverJS Users Guide).

  • WebDriver commands are asynchronus. They are scheduled on a control flow and return promises, not primitive values (see The WebDriver Control Flow).

  • Your test scripts send commands to the Selenium Server, which in turn communicates with the browser driver. Read on for more details.

Process Communication

A test using Selenium WebDriver involves three processes - the test script, the server, and the browser. The communication between these processes is shown in the diagram below.

WebDriver test Processes Diagram

The Selenium Server takes care of interpreting commands from the test and forwarding them to one or more browsers. Communication between the server and the browser uses the WebDriver Wire Protocol, a JSON protocol. The command is interpreted by the Browser Driver.

With Protractor, the test script is run using Node.js. Protractor runs an extra command before performing any action on the browser to ensure that the application being tested has stabilized. For example, let's look at the following snippet of test code.

element(by.css('button.myclass')).click();

This will result in three commands being sent to the Browser Driver


© 著作权归作者所有

dhb_oschina
粉丝 10
博文 221
码字总数 190651
作品 0
程序员
私信 提问
搭建和学习Angularjs官方示例angular-phonecat项目

一、简介 最近需要学习angularjs,可是官方的网站在中国不是很友好,访问不是很方便。 还好找到了下面的一个更齐全点的官方示例angular-phonecat项目的教程网站PhoneCat 入门教程 App 导言 ...

dhb_oschina
2016/04/22
2.3K
0
自动化端对端测试框架-Protractor Reference 2

Timeouts Because WebDriver tests are asynchronous and involve many components, there are several reasons why a timeout could occur in a Protractor test. Timeouts from Protractor......

dhb_oschina
2016/04/24
132
0
自动化端对端测试框架-Protractor Setup

Setting Up Protractor Prerequisites Node.js Protractor is a Node.js program. To run Protractor, you will need to have Node.js installed. Check the version of node you have by ru......

dhb_oschina
2016/04/24
175
0
自动化端对端测试框架-Protractor Test

Getting Started To get started quickly, begin with the Tutorial which provides a step by step overview of how to install Protractor, create test files, set up config files, and ......

dhb_oschina
2016/04/24
213
0
自动化端对端测试框架-Protractor Reference 3

Upgrading from Jasmine 1.3 to 2.x First, please read Jasmine's official upgrade documentation. In your conf file Specify that you want to use jasmine2.x: exports.config = { // S......

dhb_oschina
2016/04/24
114
0

没有更多内容

加载失败,请刷新页面

加载更多

面向对象编程

1、类和对象 类是对象的蓝图和模板,而对象是实例;即对象是具体的实例,类是一个抽象的模板 当我们把一大堆拥有共同特征的对象的静态特征(属性)和动态特征(行为)都抽取出来后,就可以定...

huijue
今天
8
0
redis异常解决 :idea启动本地redis出现 jedis.exceptions.JedisDataException: NOAUTH Authentication required

第一次安装在本地redis服务,试试跑项目,结果却出现nested exception is redis.clients.jedis.exceptions.JedisDataException: NOAUTH Authentication required错误,真是让人头疼 先检查一...

青慕
今天
17
0
Spring 之 IoC 源码分析 (基于注解方式)

一、 IoC 理论 IoC 全称为 Inversion of Control,翻译为 “控制反转”,它还有一个别名为 DI(Dependency Injection),即依赖注入。 二、IoC方式 Spring为IoC提供了2种方式,一种是基于xml...

星爵22
今天
26
0
Docker安装PostgresSql

Docker安装PostgresSql 拉取docker镜像 # docker pull postgres:10.1010.10: Pulling from library/postgres9fc222b64b0a: Pull complete 38296355136d: Pull complete 2809e135bbdb: Pu......

Tree
今天
9
0
内容垂直居中

方法一: 采用上下 padding 形式,将内容放置在垂直居中 .line { padding: 2% 0; text-align: center; height: 5px;} <div class="line"> 内容垂直居中</div> 方法二: 采......

低至一折起
今天
21
0

没有更多内容

加载失败,请刷新页面

加载更多

返回顶部
顶部