Olivier Scherrer

Olivier is a Front End Developer at Lab49, London, a strategy, design and technology consulting firm that creates advanced solutions for the world’s leading investment banks, asset managers and exchanges. He has a strong experience in developing real-time HTML5 applications.
He's the author of Emily and Olives, two JavaScript frameworks that allow to easily create powerful web applications on top of node.js, with high UI performance and low memory footprint.
Olivier is a Front End Developer at Lab49, London, a strategy, design and technology consulting firm that creates advanced solutions for the world’s leading investment banks, asset managers and exchanges. He has a strong experience in developing real-time HTML5 applications.
He's the author of Emily and Olives, two JavaScript frameworks that allow to easily create powerful web applications on top of node.js, with high UI performance and low memory footprint.View Olivier Scherrer on LinkedIn
  • ask me anything
  • GitHub podefr
  • Emily
  • Olives
  • rss
  • archive
  • Setting up a test environment featuring Jasmine BDD, require.js, jsTestDriver and node.js

    Testing is an important part of a project. While developing Emily I had to set up an environment that would automate testing for several cases.

    As I followed a full TDD process for developing Emily, I needed a way to get instant tests results. But Emily is designed to be executed in a browser, as well as in a node.js environment, and I wanted to pass the same tests for both.

    So I started to look for a testing framework that would run in any JavaScript runtime and Jasmine appeared to be the perfect fit. It doesn’t rely on the DOM and it has the right documentation and tools for a quick and easy setup.

    I npm installed an adapter for running the tests under node.js, managed to find a reporter for readable tests results in the shell and automated the task in my build process.

    Everything went pretty well until I got stuck with running the specs with jsTestDriver when my modules under tests are loaded with require.js. JsTestDriver is needed for testing Emily’s modules in browsers.

    I found a solution, thanks to two things:

    • I wrapped the specs into AMD/commonJS modules
    • The modules under tests are all loaded before the specs are executed 

    Then I was able to run the same specs regardless of the environment.

    The final step was to make the specs available for anyone to run. The goal here is to allow for developers to test Emily into their target environments by sharing a public HTML page that runs Jasmine against the built framework.

    I’ve created a repository on github to showcase the whole solution. There’s a walkthrough in the wiki for reproducing the steps. Please feel free to comment and/or fork to improve the environment.

    Here’s the link: https://github.com/podefr/jasmine-reqjs-jstd

    And you, how do you test your code?

    Source: github.com
    • March 28, 2012 (1:19 am)
    • 1 notes
    • #Jasmine BDD
    • #require.js
    • #jsTestDriver
    • #JavaScript
    • #tests
    1. podefr posted this
© 2012–2013 Olivier Scherrer