构建Headless 的 E2E 测试

为什么要构建 Headless 的 E2E 测试 A headless browser is a great tool for automated testing and server environments where you don't need a visible UI shell. For example, you may want to run some tests against a real web page, create a PDF of it, or just inspect how the browser renders an URL. 结合上面的原因,我们还可以 Headless结合 E2E 测试,可以让E2E 测试在非 GUI 的操作系统中运行 可以集成至 CI 环境中。让版本得到快速验证 Chrome Headless 的选取 Mac/Linux 的Chrome从59版本后,已经支持 Healess 模式的运行。Windows 的从60版本开始支持 所以选择一个你想要的 Chrome 版本,便可以进行 Headless 的测试 chrome \ --headless \ # Runs Chrome in headless mode. --disable-gpu \ # Temporarily needed if running on Windows. https://www.chromestatus.com # URL to open. Defaults to about:blank. ...

March 2, 2018 · 2 min · Yuanjie

Layout测试

Web页面Layout测试,一直是测试人员比较头疼的事情。原因有 当前市面中设备的分辨率千差万别 浏览器版本众多,工作量很大 如何使用高效的方式来测试Web Layout是否能正常,下面来看下Galen是如何帮助我们的 Galen的特点 开源项目,License基于Apache License, Version 2.0 可测试页面布局、响应式设计,支持功能测试 基于Selenium,对Selenium Grid支持很好,可直接在Sauce Labs和 BrowserStack 支持并行测试,减少测试时间 语法简洁 ...

November 28, 2016 · 3 min · Yuanjie

Android UI自动化测试神器-Espresso录制

Espresso Test Recorder的好处 直接录制与APP的所有交互操作 支持在录制过程中添加断言 可直接生成可回放的测试脚本,基本不需要做任何修改 原文地址: Create UI Tests with Espresso Test Recorder,以下为正文 注意: Espresso Test Recorder在AndroidStudio 2.2 Beta版本之后才有。 Espresso Test Recorder可以在不写一行代码的情况下创建UI测试。通过录制一个测试场景,你可以记录设备的交互并在APP的部分快照中添加断言来验证元素。Espresso Test Recorder会保存录制并自动生成对应的UI测试,并可直接运行来测试你的APP。 Espresso Test Recorder编写的测试基于Espresso Testing framework,API在Android Testing Support Library。Espresso API鼓励你创建基于用户操作的简洁且可信赖的UI测试。通过使用expectations、interactions和assertions而不是底层APP的Activity和Views,这样的结构防止了测试的脆弱性并优化测试运行速度。 ...

November 25, 2016 · 7 min · Yuanjie

PageObject分离E2E测试

PageObject 老马关于PageObject的定义 It should allow a software client to do anything and see anything that a human can PageObject到底是个啥 将针对Page的所有操作进行统一封装,如: 输入框中输入内容、点击按钮等 ...

November 24, 2016 · 3 min · Yuanjie

E2E测试之Headless browser容器化

目的 E2E测试执行过程中不依赖UI界面 可在*nix系统中运行 为什么不用PhantomJS,Protractor官方不推荐使用PhantomJS来测试 We recommend against using PhantomJS for tests with Protractor. There are many reported issues with PhantomJS crashing and behaving differently from real browsers. Docker 安装 下载系统所需要的安装包,下载地址:https://www.docker.com/products/docker 注册https://hub.docker.com/账号 使用pull来获取docker 镜像protractor-headless,此过程会比较慢,耐心等待 docker hub地址:https://hub.docker.com/r/webnicer/protractor-headless/ git hub地址:https://github.com/jciolek/docker-protractor-headless docker pull webnicer/protractor-headless ...

August 1, 2016 · 3 min · Yuanjie

Protractor End to End Testing

Protractor Protractor is an end-to-end test framework for AngularJS applications. Protractor runs tests against your application running in a real browser, interacting with it as a user would. 是什么 基于Node.js的程序 使用Jasmine测试框架测试接口,针对AngularJS的应用程序 官网: http://angular.github.io/protractor/#/ Github: https://github.com/angular/protractor 功能 模拟真实的用户操作行为 针对AngularJS中的Element不需要做特殊的处理,普通HTML元素也同样支持 智能等待,不需要为页面中的加载和同步显示做特殊的等待时间处理 ...

April 28, 2016 · 4 min · Yuanjie