QA/TDAI/Projects/Test Suite Integration
Integrating existing AJAX test suites into our Mochitest infrastructure is critically important to ensure that our development doesn't break future (or existing) versions of those products and sites developed on those products.
How These Work
Here is a guide to how these work in our normal mochitest setup.
- First off, these tests will be living in a <suite name> directory here
- Create an HTML page that loads in AJAX_setup.js, MochiKit_packed.js, and SimpleTest.js from the lib directory. Here is an example HTML file from the scriptaculous project. Note that it must be named test_<framework>.html.
- Check out AJAX_setup.js. Here you can see that a manifest.json file is loaded and from that, each test file is loaded into mochitest.
- Once the AJAX request stops, the next test is loaded and executed, and so on until all the tests in the manifest.json file are executed. Then SimpleTest.finish() is called.
- Run the tests first outside of Mochikit. This way you have a good idea of what will fail and what will pass.
- Ensure that you import the entire directory structure the Test Suite uses, so that relative links inside the tests work.
- There is a general page on doing this work (thought it seems a little dated) here.
- You can see how the Prototype library was added here.
- Anything with a test_ in the name is going to get executed first. So, change those names so that they are not picked up. You only want the main HTML file (the one referenced in point 2 above) to be named test_*
So what do I do
- Download the test suite
- Run it in Firefox 3
- Understand what the test files are, hopefully they are HTML
- Wrap the mochitest structure around those files (the manifest.json, the controlling HTML file etc)
- Add makefiles to each directory that adds each file in that directory to _TEST_FILES variable and uses a libs target to copy them out to the mochitest location in the object dir. There are sample makefiles throughout the tree.
- Wrap all of this effort into a patch and attach it to a bug in bugzilla.