Experiments and reviews of various ui testing frameworks
mkdir ui-testing
cd ui-testing
echo '{ name:ui-testing}' > package.json
npm install --save-dev selenium-webdriver
npm install --save-dev browserstack-webdriver
npm install --save-dev wd
npm install --save-dev webdriverio
npm install --save-dev kommando
npm install --save-dev nightwatch
npm install --save-dev karma
npm install --save-dev leadfoot
npm install --save-dev intern
npm install --save-dev jscoverage
npm install --save-dev blanket
git remote add origin https://github.com/ainthek/ui-testing.git
echo node_modules > .gitignore
Texts come from their web sites
The official WebDriver JavaScript bindings from the Selenium project
BrowserStack WebDriver JavaScript bindings with keep alive support
WebDriver/Selenium 2 node.js client
Selenium 2.0 bindings for NodeJS
Most of the Selenium WebDriver Wire Protocol is already implemented and wrapped in useful commands.
Adding helper functions, or more complicated sets and combinations of existing commands is simple and really useful
WebdriverIO works in combination with most of the TDD and BDD test frameworks in the JavaScript world.
A node.js bindings implementation for selenium 2.0/webdriver
UI automated testing framework powered by Node.js. It uses the Selenium WebDriver API.
Configurable cross browser functional / acceptance test launcher (using Webdriver)
Spectacular Test Runner for JavaScript.
A simple tool that allows you to execute JavaScript code in multiple real browsers.
The main purpose of Karma is to make your TDD development easy, fast, and fun
Intern. A next-generation code testing stack for JavaScript.
Intern is a complete test stack for JavaScript designed to help you write and run consistent, high-quality test cases for your JavaScript libraries and applications. It can be used to test any JavaScript code.
Its functional testing capabilities can even be used to test non-JavaScript Web and mobile apps, if you really want.
A seamless JavaScript code coverage library.
a javascript coverage tool, can be used in node dev, and browser side js dev
generated Mon Feb 16 09:52:00 CEST 2015
Included here is not comparable, some of them are full stack things some of them are modules reused by others etc...
However the numbers tell something (TODO: separate and chart)
module | downloads in the last month |
---|---|
selenium-webdriver | 376786 |
browserstack-webdriver | 2055 |
webdriverio | 9485 |
wd | 89889 |
kommando | 132 |
webdrvr | 163 |
nightwatch | 24375 |
karma | 797169 |
leadfoot | 8162 |
intern | 7937 |
testardo | 211 |
mocha | 1553315 |
jscoverage | 16533 |
blanket | 45635 |
name | version | description |
---|---|---|
esprima | 1.2.4 | ECMAScript parsing infrastructure for multipurpose analysis |
falafel | 0.3.1 | transform the ast on a recursive walk |
xtend | 3.0.0 | extend like a boss |
name | version | description |
---|---|---|
keep-alive-agent | 0.0.1 | a keep-alive agent for http and https |
name | version | description |
---|---|---|
chai | 1.9.1 | BDD/TDD assertion library for node.js and the browser. Test framework agnostic. |
charm | 0.2.0 | ansi control sequences for terminal cursor hopping and colors |
diff | 1.1.0 | A javascript text diff implementation. |
digdug | 1.2.1 | Dig Dug. A simple abstraction library for downloading and launching WebDriver service tunnels. |
dojo | 2.0.0-dev | Dojo core is a powerful, lightweight library that makes common tasks quicker and easier. Animate elements, manipulate the DOM, and query with easy CSS syntax, all without sacrificing performance. |
istanbul | 0.2.16 | Yet another JS code coverage tool that computes statement, line, function and branch coverage with module loader hooks to transparently add coverage when running tests. Supports all JS coverage use cases including unit tests, server side functional tests |
leadfoot | 1.2.1 | Leadfoot. A JavaScript client library that brings cross-platform consistency to the Selenium WebDriver API. |
nodemod | ||
source-map | 0.1.33 | Generates and consumes source maps |
name | version | description |
---|---|---|
coffee-script | 1.9.0 | Unfancy JavaScript |
debug | 1.0.3 | small debugging utility |
ejs | 1.0.0 | Embedded JavaScript templates |
escape-string-regexp | 1.0.2 | Escape RegExp special characters |
optimist | 0.3.1 | Light-weight option parsing with an argv hash. No optstrings attached. |
uglify-js | 2.4.15 | JavaScript parser, mangler/compressor and beautifier toolkit |
xfs | 0.1.8 | extends fs module, easy way to manipulate file system, support both sync functions and async functions |
name | version | description |
---|---|---|
chokidar | 0.12.6 | A neat wrapper around node.js fs.watch / fs.watchFile / fsevents. |
colors | 0.6.2 | get colors in your node.js console like what |
connect | 2.26.6 | High performance middleware framework |
di | 0.0.1 | Dependency Injection for Node.js. Heavily inspired by AngularJS. |
glob | 3.2.11 | a little globber |
graceful-fs | 2.0.3 | A drop-in replacement for fs, making various improvements. |
http-proxy-examples | 0.0.0 | packages required to run the examples |
http-proxy | 0.10.4 | A full-featured http reverse proxy for node.js |
lodash | 2.4.1 | A utility library delivering consistency, customization, performance, & extras. |
log4js | 0.6.22 | Port of Log4js to work with node. |
mime | 1.2.11 | A comprehensive library for mime-type mapping |
minimatch | 0.2.14 | a glob matcher in javascript |
optimist | 0.6.1 | Light-weight option parsing with an argv hash. No optstrings attached. |
q | 0.9.7 | A library for promises (CommonJS/Promises/A,B,D) |
rimraf | 2.2.8 | A deep deletion module for node (like rm -rf ) |
socket.io | 0.9.16 | Real-time apps made cross-browser & easy with a WebSocket-like API |
source-map | 0.1.43 | Generates and consumes source maps |
useragent | 2.0.10 | Fastest, most accurate & effecient user agent string parser, uses Browserscope's research for parsing |
name | version | description |
---|---|---|
address | 0.0.3 | Get current machine IP, MAC and DNS servers. |
async | 0.8.0 | Higher-order functions and common patterns for asynchronous code |
cabbie | 0.0.9 | A webdriver client |
chai-as-promised | 4.1.1 | Extends Chai with assertions about promises. |
chai | 1.10.0 | BDD/TDD assertion library for node.js and the browser. Test framework agnostic. |
coffee-script | 1.9.0 | Unfancy JavaScript |
cucumber | 0.4.7 | The official JavaScript implementation of Cucumber. |
freeport | 1.0.4 | Find a free port. |
glob | 3.2.11 | a little globber |
jasmine-node | 1.14.5 | DOM-less simple JavaScript BDD testing framework for Node |
leadfoot | 1.2.1 | Leadfoot. A JavaScript client library that brings cross-platform consistency to the Selenium WebDriver API. |
lodash | 2.4.1 | A utility library delivering consistency, customization, performance, & extras. |
mocha | 1.18.2 | simple, flexible, fun test framework |
nesh | 1.5.1 | An enhanced, extensible shell for Node.js |
optimist | 0.6.1 | Light-weight option parsing with an argv hash. No optstrings attached. |
saucelabs | 0.1.1 | A wrapper around Sauce Labs REST API |
selenium-webdriver | 2.41.0 | The official WebDriver JavaScript bindings from the Selenium project |
wd | 0.2.27 | WebDriver/Selenium 2 node.js client |
webdrvr | 2.41.0-0 | NPM wrapper for Selenium Webdriver including Chromedriver / IEDriver / IOSDriver / Ghostdriver |
name | version | description |
---|---|---|
dojo | 2.0.0-alpha4 |
name | version | description |
---|---|---|
ejs | 0.8.8 | Embedded JavaScript templates |
grunt | 0.4.5 | The JavaScript Task Runner |
minimatch | 0.2.14 | a glob matcher in javascript |
mkpath | 0.1.0 | Make all directories in a path, like mkdir -p |
optimist | 0.6.1 | Light-weight option parsing with an argv hash. No optstrings attached. |
name | version | description |
---|---|---|
adm-zip | 0.4.4 | A Javascript implementation of zip for nodejs. Allows user to create or extract zip files both in memory or to/from disk |
tmp | 0.0.24 | Temporary file and directory creator |
xml2js | 0.4.4 | Simple XML to JavaScript object converter. |
name | version | description |
---|---|---|
archiver | 0.12.0 | a streaming interface for archive generation |
async | 0.9.0 | Higher-order functions and common patterns for asynchronous code |
lodash | 2.4.1 | A utility library delivering consistency, customization, performance, & extras. |
q | 1.0.1 | A library for promises (CommonJS/Promises/A,B,D) |
request | 2.46.0 | Simplified HTTP request client. |
underscore.string | 2.3.3 | String manipulation extensions for Underscore.js javascript library. |
vargs | 0.1.0 | practical variable argument handling |
name | version | description |
---|---|---|
archiver | 0.6.1 | Creates Archives (ZIP) via Node Streams. |
async | 0.9.0 | Higher-order functions and common patterns for asynchronous code |
chainit | 2.1.1 | Turn an asynchronous JavaScript api into an asynchronous chainable JavaScript api. |
css-parse | 1.7.0 | CSS parser |
css-value | 0.0.1 | CSS value parser |
deepmerge | 0.2.7 | A library for deep (recursive) merging of Javascript objects |
pragma-singleton | 1.0.3 | Singleton design pattern implementation which easy to use |
q | 1.1.2 | A library for promises (CommonJS/Promises/A,B,D) |
request | 2.34.0 | Simplified HTTP request client. |
rgb2hex | 0.1.0 | lightweight rgb/rgba to hex parser |
url | 0.10.2 | The core url packaged standalone for use with Browserify. |
wgxpath | 0.23.0 | Wicked Good XPath |
index | blanket | browserstack-webdriver | intern | jscoverage | karma | kommando | leadfoot | nightwatch | selenium-webdriver | wd | webdriverio |
---|---|---|---|---|---|---|---|---|---|---|---|
address | X | ||||||||||
adm-zip | X | ||||||||||
archiver | X | X | |||||||||
async | X | X | X | ||||||||
cabbie | X | ||||||||||
coffee-script | X | X | |||||||||
colors | X | ||||||||||
connect | X | ||||||||||
css-parse | X | ||||||||||
css-value | X | ||||||||||
cucumber | X | ||||||||||
debug | X | ||||||||||
deepmerge | X | ||||||||||
di | X | ||||||||||
diff | X | ||||||||||
digdug | X | ||||||||||
dojo | X | X | |||||||||
ejs | X | X | |||||||||
escape-string-regexp | X | ||||||||||
esprima | X | ||||||||||
examples | X | ||||||||||
falafel | X | ||||||||||
freeport | X | ||||||||||
glob | X | X | |||||||||
graceful-fs | X | ||||||||||
grunt | X | ||||||||||
http-proxy | X | ||||||||||
chai | X | X | |||||||||
chai-as-promised | X | ||||||||||
chainit | X | ||||||||||
charm | X | ||||||||||
chokidar | X | ||||||||||
istanbul | X | ||||||||||
jasmine-node | X | ||||||||||
keep-alive-agent | X | ||||||||||
leadfoot | X | X | |||||||||
lodash | X | X | X | ||||||||
log4js | X | ||||||||||
mime | X | ||||||||||
minimatch | X | X | |||||||||
mkpath | X | ||||||||||
mocha | X | ||||||||||
nesh | X | ||||||||||
nodemod | X | ||||||||||
optimist | X | X | X | X | |||||||
pragma-singleton | X | ||||||||||
q | X | X | X | ||||||||
request | X | X | |||||||||
rgb2hex | X | ||||||||||
rimraf | X | ||||||||||
saucelabs | X | ||||||||||
selenium-webdriver | X | ||||||||||
socket.io | X | ||||||||||
source-map | X | X | |||||||||
tmp | X | ||||||||||
uglify-js | X | ||||||||||
underscore.string | X | ||||||||||
url | X | ||||||||||
useragent | X | ||||||||||
vargs | X | ||||||||||
wd | X | ||||||||||
webdrvr | X | ||||||||||
wgxpath | X | ||||||||||
xfs | X | ||||||||||
xml2js | X | ||||||||||
xtend | X |
Far from being finished....
Intern web site contains some comparisons of the frameworks, however it is missing some important players and features. So I will add some here:
Subjective Rankings:
3-good
2-ok
1-poor
0-none
feature | selenium-webdriver | kommando | intern |
---|---|---|---|
Standalone Server | 1 | 3 | 1 |
Documentation - Local run | 3 | 3 | 1 |
REPL | 0 | 2 | ? |
How much manual work is needed to run tests against browsers that require selenium-server-standalone-*.jar. Download, configure and instantiate support in each 'framework'.
-
(cons) 'To run the tests, you will need to download a copy of the ChromeDriver and make sure it can be found on your PATH.'
-
(cons) They don't event updated docs (nor npm nor wiki) after implementation of direct Firefox support.
-
However after some downloading of related and compatible version for each of your OSes, you can have it running in lt; 30 mins for all browsers you need.
TODO: download sample code sample
- why using pretty old 'selenium-version': '2.41.0' in the example config ?
- based on this blog post you must download all manually as well
Actually 'installing' Selenium, Chromedriver, IEDriver and PhantomJS is not node by kommando, but by vebrdvr module.
to automate download of Standalone Server and Drivers
TODO:
Here I ry to evaluate how much time and browsing it took to start first functional test in local browser. Intern is in disadvantage here, their docs cover bit more so orientation is more difficult.
running sample from npm readme with native FF support they have now, took under 10 seconds, if you have FF installed.
Running REPL and starting browser (FF, chrome, Opera) right after install requires no reading of any docs. This is the main purpose of the kommando module (even if implemented using vebdrvr).
$ ./node_modules/.bin/kommando --runner repl --browser chrome
Starting Selenium server ...
Selenium server started at: http://192.168.x.x:49408/wd/hub
Run tests using "browserName=chrome"
"kommando" / "kommando.browser" provide access to the running browser instance
kommando>
After 30 minutes of quick searching, I have found this topic: Running-your-own-WebDriver-server. After another 30 minutes I have still no functional testing sample running. Another 30mins, cloned tutorial, downloaded full tutorial cannot make tests/functional to run, no errors, just not run.
Gave up, asking for help
Update: 2015/02/10 - reading the answer (Thank) and googling I have found this http://www.sitepen.com/blog/2014/04/23/dojo-faq-how-can-i-run-dojo-tests-locally-with-intern/ article. After not believing this is really what intern offers, I have 'managed' to start server MANULLLY with actually typing the word 'java' (GRRRRRR, just compare wit the bare selenium-webdriver, which 'they' do not consider to be a test framework , and after previous positive KARMA, seems unbelievable achievement..
After "pruning my environment" (as vaguely suggested in article), to my guessed minimum:
{ browserName: 'firefox' }
or
{ browserName: 'chrome' }
and having test-code:
define([
'intern!object',
], function (registerSuite) {
registerSuite({
name: 'minimal demo',
'of getting google': function () {
return this.remote.get('http://www.google.com');
}
});
});
and running:
(GRRRRRR) java -jar $SELENIUM_SERVER_JAR -port 4444
and
node_modules/.bin/intern-runner config=tests/intern
I have finally seen 'flash' of google.com webpage , after series of blinking URLs.... Success withing 48 hours in not bad. Or ? Going to sleep (today).
- support of coverage reporting using 5 years old tj's node-jscoverage
- tj claims in README.txt that node module jscoverage npm module DOES NOT WORK
- jscoverage npm module
- it has 16158 downloads in the last month
- and git gub repo seems more recent even if not active
- readme covers instruction how to test
- tj's version does not uninstall on OSX 10.9.5
- a lot of outdated? infos on web, including this one http://seejohncode.com/2012/03/13/setting-up-mocha-jscoverage/
Finally I have decided to ignore mochas docs and tj's repo and tried very simple one minute setup and example:
npm install --save-dev jscoverage
mocha -r jscoverage -R spec tests/mocha/test.js
Coverage result
✓ tests/mocha/test.js line[100%] branch[100%]
⁍ lib/module.js line[ 66%] branch[100%]
1 passing (5ms)
After trying tests on my other Win (MINGW) machine, neeeded to quickly patch jscoverage.
And also received link from boneskull about blanket, so will try it.
Testing blanket on windows (MINGW) ends with no conevarge stats at all, quick look at the node+mocha detection reveals why:
if (args[0] === 'node' &&
args[1].indexOf(join('node_modules','mocha','bin')) > -1 &&
blanketRequired){
//using mocha cli
module.exports = blanketNode(null,true);
So probably I'm going again for Fork-reconfigure-package.json-Fix-Pull-Request-Hope cycle ? Same as with jscoverage ?
Not today ;-(