Techno Barje



Yet another mozilla powered project! This time, a graphical unit tests editor/executer which enables you to spellcast an army of monkeys always happy to work hard on your projects and find bugs for free! asserts.png
Here is what they can do:

  • Launch any Mozilla application: Firefox, Thunderbird and any xulrunner app,
  • Use an empty profile for each test execution, or an existing one,
  • Speak fluently "assert" language: isTrue, isFalse, isDefined, equals, … etc,
  • Report you in real time test execution directly in your test source code,
  • They are always ready to work. You don’t need to restart Freemonkeys on each test execution, nor on your application reboot. Freemonkeys is an independant xulrunner app, which launch yours and then controls it remotly with a network connexion,
  • Spot easily any window, any tab and any DOM element with usefull distinctive parameters: XPath, windows attributes, zIndex order, … etc,
  • Offer a way to facilitate node identification by simply clicking on it, and seeing in real time what are selected node parameters,
  • They are able to write down some debug messages, inspect javascript objects with DOM Inspector, take screenshots of any elements,
  • Ease you some kind of tests, by providing you a simple HTTP webserver in order to simulate some websites answers,
  • They are not narrow-minded to synchronous tests but offers an assert library and some usefull API embracing asynchronous execution of your code!

Now let’s highlight some of these cool features …

Node selection

Here I was overing the tip of the day image. Freemonkeys spot it by highlighting it in red and show me all parameters which are going to be used to find this node later:
inspector.png You just have to click on it to get back to test editor and have all javascript code needed to get a reference to this node, something like this:

var top = windows.getRegistered("firefox-window", "topmost");
var tab = top.tabs.current;
var element = elements.xpath(tab, "id('frame')/tbody[1]/tr[5]/td[1]/table[1]/tbody[1]/tr[1]/td[1]/table[1]/tbody[1]/tr[1]/td[1]/img[1]");

Elements screenshots

Simply write:


And get a screenshot directly in the test editor:

Live test execution reporting

Your monkeys report each assert status in the test editor, allowing you to keep the focus on test writing and not losing time by switching from your app to your terminal, then to your code editor, your terminal and your app … etc, etc. asserts.png debug-msg.png


// Get a reference to a firefox tab
var top = windows.getRegistered("firefox-window", "topmost");
var tab = top.tabs.current;

// Start an HTTP server on port 81

// A successfull test
// Create an assert objet which is going to wait for a request on root path of our http server
var test = http.assertGetRequest("/");
// Open this page in the tab"http://localhost:81/");
// Now wait for this request

// The same test but with a non-existant page on our local server, so a failing test!
var test = http.assertGetRequest("/");"http://localhost:81/foo");

Asynchronous tests

// A usefull function which allow you to block test execution for an amount of time in ms

// The simpliest asynchronous test
wait.forTrue(function () {
  return true;

// Another, which is going to pass after 3s, with this setTimeout
var v=true;
wait.setTimeout(function() {
wait.forFalse(function () {
  return v;

// Finally, a test which will pass when the test function is going to be called ten times
// (wait for the anonymous function returns 10)
var i=0;
wait.forEquals(function () {
  return i++;;
}, 10);

How to get it ?

Source code is available on github: (LGPL licence)
If you are on windows:

And for linux and mac:

  • Download this one:
  • Extract it somewhere
  • If you don’t have xulrunner, download it from here
  • Finally, launch Freemonkeys with this command:
    /path/to/your/xulrunner/dir/xulrunner /path/to/freemonkeys/application.ini