背景
Web自動化測試越來越被重視, 因為現在Web已經是工程化的狀態。 如何通過工具測試, 保證Web開發的質量,提升開發效率,是Web工具的誕生的來由。
Web測試分為以下幾個方面:
1、 界面測試 測試界面是否正常,這是前端測試最基礎的環節。
2、 功能測試 測試功能操作是否正常,由於涉及交互,這部分測試比界面測試會更復雜
3、 性能測試 頁面性能越來越受到關注,並且性能需要在開發過程中持續關注,否則很容易隨着業務迭代而下降。
4、 安全性測試 測試Web界面和WebServer的安全性, 這里有專業工具(Nessus WebInspect)。不是本文調研點。
5、 單元測試 這個測試在其它語言領域已經比較成熟, 在Web領域對一些只適應用一些通用性較強的庫和框架。
6、 易用性測試 測試Web界面是否容易被用戶使用。一般人為參與更加直接有效,不推薦工具。
7、 兼容性測試 測試多種瀏覽器訪問的正常性。
部分分類來源於:
http://www.open-open.com/lib/view/open1436021333747.html
調研
下面結合測試功能點,匯總各種測試需求以及測試工具。
分類 | 工具 | URL | 描述 |
界面測試 | PhantomCSS | https://github.com/Huddle/PhantomCSS | Visual/CSS regression testing with PhantomJS CSS regression testing. A CasperJS module for automating visual regression testing with PhantomJS 2 or SlimerJS and Resemble.js. |
界面測試 | page-monitor |
https://github.com/fouber/page-monitor | capture webpage and diff the dom change with phantomjs |
功能測試 | phantomjs | http://phantomjs.org/ | PhantomJS is a headless WebKit scriptable with a JavaScript API. It has fast and native support for various web standards: DOM handling, CSS selector, JSON, Canvas, and SVG. 對於web測試、界面、網絡捕獲、頁面自動化訪問等等方面可以說是信手拈來。百度在此平台上做了不少實踐。 |
功能測試 | casperjs | http://casperjs.readthedocs.io/en/latest/ http://casperjs.org/ |
casperjs是對PhantomJS的封裝,提供了更加易用的API, 增強了測試等方面的支持。 |
功能測試 | SlimerJS |
http://www.slimerjs.org/index.html | SlimerJS is similar to PhantomJs, except that it runs on top of Gecko, the browser engine of Mozilla Firefox, instead of Webkit, and is not yet truly headless. |
功能測試 | TestCafe |
https://testcafe.devexpress.com/ | Functional Web Testing MADE EASY |
性能測試 | Phantomas | https://github.com/macbre/phantomas | PhantomJS-based web performance metrics collector and monitoring tool |
單元測試 | Karma和Jasmine |
http://blog.fens.me/nodejs-karma-jasmine/ | Nodejs領域: Jasmine做單元測試,Karma自動化完成單元測試 https://jasmine.github.io/2.5/introduction Sinon -- 打樁框架Mocha -- 測試框架Chai -- 測試框架 |
單元測試 | QUnit | http://qunitjs.com/ | QUnit is a powerful, easy-to-use JavaScript unit testing framework. It's used by the jQuery, jQuery UI and jQuery Mobile projects and is capable of testing any generic JavaScript code, including itself! |
兼容性測試 | selenium | www.seleniumhq.org | selenium可以自動化的獲取多個瀏覽器下的截圖,前端工程師來說還可以借助Node的webdriver (http://webdriver.io/)來輕松開發測試腳本。還可以用:http://nightwatchjs.org/ |
兼容性測試 | dalekjs | http://dalekjs.com/ |
Automated cross browser testing with JavaScript!
Exterminate all the bugs!
|
自動化測試管理工具(Test Runner): http://karma-runner.github.io/1.0/index.html (google angular出品)