This is a quick post to announce Testmob.org, a site that makes running QUnit tests across multiple browsers easy.
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".
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.