Freemonkeys

Freemonkeys

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:
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:
element.screenshot();
And get a screenshot directly in the test editor:
element.screenshot.png

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

HTTP API


// 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 http.start("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 tab.open("http://localhost:81/"); // Now wait for this request test.wait();

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



Asynchronous tests


// A usefull function which allow you to block test execution for an amount of time in ms
wait.during(1000);

// 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() { v=false; },3000); 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: http://github.com/ochameau/freemonkeys (LGPL licence)
If you are on windows: And for linux and mac: