testmob.org – Distributed Javascript Unit Testing

This is a quick post to announce Testmob.org, a site that makes running QUnit tests across multiple browsers easy.

TestMob is a distributed unit test system loosely based on John Resig’s TestSwarm. Manual unit testing Javascript across a variety of OS’s, browsers and devices is a time consuming process. TestMob reduces the amount of time necessary by allowing multiple clients to join a family to operate as one unit. Whenever any family member orders a job (a test run), all available family members begin to run the tests. Results are reported back to the boss as soon as a member completes the job.

A TestMob Test Drive

TestMob’s own unit tests can be used to see how it works. Open two or more browsers to https://testmob.org/family/testfamily. In one browser, enter https://testmob.org/test/index.html into the Job Address input box and click “start job”.

Results on Testmob

Test results will flow in as they become available.

Using TestMob in your site

Adding TestMob to your site’s unit tests is easy, but there are some important prerequisites. First, TestMob only works with QUnit at the moment. Second, your site’s unit tests must be accessible to all family members. This means all members of the family must either be on your intranet or that the tests are accessible from a public URL. Finally, the unit test page must be viewable from within an iframe. If you use the X-Frame-Options header, it must be set to ALLOW while you are testing.

  • Add the following script as the last statement in your unit test page’s body:
  • Open up a browser which will act as the “boss”. The boss does not run tests but initiates a job and collects results.
  • Open https://testmob.org and start a family.
  • Open up a second browser which will act as an “associate”. Associates do jobs.
  • Open https://testmob.org. Join the same family as the boss.
  • Return to the boss. Enter the “Job Address” (unit test address) . Start the job.
  • Watch the results flow in.

Where’s the code?

All of the code can be found on GitHub at https://github.com/stomlinson/testmob. Review and code contributions are appreciated, especially in the areas of Jasmine and Mocha support.

Leave a Comment

Post comment

What is Persona?