March 12, 2013
Along the way, we realized that our approach to testing this code within the LinkedIn ecosystem - primarily based on Selenium integration tests - was insufficient. We needed unit tests to help catch bugs earlier in the development cycle and to better protect us against regressions.
- It must support multiple testing libraries (QUnit, Jasmine, etc).
- It must support test driven development and continuous integration, using real browsers.
- Writing tests must be as frictionless as possible.
- Unit test authors must be able to easily improve and extend the tool.
Multiple testing libraries
Teams across LinkedIn use several testing libraries, including Mocha, QUnit , and Jasmine. We knew that our solution must support all of these users, as well as accommodate new libraries in the future.
From the very beginning we built in the concept of library adaptors. New adaptors can easily be written to support any test library desired, and Venus.js ships with adaptors for Jasmine, QUnit, and Mocha.
Multiple testing environments
Venus.js supports running tests in four ways:
- Manually: start Venus.js, then navigate to a URL with any browser on any device.
- PhantomJS: Venus.js can be instructed to use the headless, webkit based PhantomJS to run tests quickly.
- Selenium Grid: for continuous integration, we wanted to leverage our existing Selenium Grid implementation to manage browsers and VMs. Venus.js will work with any standard implementation of Selenium Grid or Selenium RC.
- Sauce Labs: if you do not manage your own Selenium Grid, a cloud based solution may be perfect for you. Out of the box, Venus.js integrates with Sauce Labs' API for running tests. Note: this feature is in testing and will make it to our stable release soon.
Easy to install and use
A process that is hard to follow is a process that no one follows. We knew that the process of writing tests must be straightforward and fit in smoothly with the workflow of our developers.
Venus.js installs easily as a command line tool, using npm.
When writing tests, we wanted to avoid complicated config files and directory structures. To combat filesystem red-tape, Venus.js allows you to specify your test library and dependencies directly from your test code, using comment-based annotations.
Try it out!
We are happy to make Venus.js available as an open source project under the Apache 2.0 License. Please visit venusjs.org to learn more and to start using Venus.js today!