构建Headless 的 E2E 测试

为什么要构建 Headless 的 E2E 测试

1
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 的测试
1
2
3
4
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.

性能测试与持续集成

目的

  • 将性能测试与持续集成挂接起来
  • 性能测试: JMeter
  • 持续集成: Jenkins

E2E测试之Headless browser容器化

目的

1
We recommend against using PhantomJS for tests with Protractor. There are many reported issues with PhantomJS crashing and behaving differently from real browsers.

Docker

安装

1
docker pull webnicer/protractor-headless

API开发神器-Postman

Postman helps you develop APIs faster.

豪华午餐

Postman

Postman

构建、管理、文档化API

Newman(我真的不是MP3)

如此Tricky的测试场景,你应该怎么办

什么是Tricky的测试场景?

Tricky的测试场景

测试场景

Scenario testing is a software testing activity that uses scenarios: hypothetical stories to help the tester work through a complex problem or test system. The ideal scenario test is a credible, complex, compelling or motivating story the outcome of which is easy to evaluate.

Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×