BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News Google Open Sources Testacular, a JavaScript Test Runner

Google Open Sources Testacular, a JavaScript Test Runner

This item in japanese

Lire ce contenu en français

Google has open sourced Testacular, a JavaScript test runner based on Node.js. The tool can be used to test all major web browsers, can be integrated with CI tools, and it works with any code editor.

Testacular runs JavaScript code tests on various desktop or mobile device browsers, locally, on a device or on a continuous integration server. Testacular supports Chrome, ChromeCanary, Safari, Firefox, IE, Opera, PhantomJS, and knows how to capture the browsers using default paths which can be overridden in the launcher configuration files. Testacular is just a test runner being able to work with various testing frameworks, having adapters for Jasmine, Mocha and AngularJS. It can also be integrated with Jenkins or Travis for running continuous integration tests.

One of the power features of this testing tool is the ability to monitor a set of files for changes and immediately initiate tests on a saved file without the user having to leave the text editor. The test results are usually displayed at the command line and not within the code editor, making Testacular able to work basically with any JavaScript editor. For better results, it can be integrated with WebStorm which provides stack trace for errors and unit test debugging support.

In order to run, Testacular needs Node.js and a configuration file containing information regarding the files to be tested, those to be ignored, base path, web server port, logging level, etc. (A configuration file sample.)

Regarding its performance, Vojta Jína, a Google engineer, has demoed running about 1,500 AngularJS tests in WebStorm against Chrome Canary and Chrome in less than 5 seconds.

Jína wrote that Testacular was inspired by JS Test Driver, but they decided to write a different test runner due to the “many problems [they had] with JSTD”, wanting “a simple tool just for executing JavaScript tests that is both stable and fast. That's why we use the awesome Socket.io library and Node.js.”

Rate this Article

Adoption
Style

BT