Confirmed users
3,816
edits
No edit summary |
No edit summary |
||
| Line 4: | Line 4: | ||
Here is a guide to how these work in our normal mochitest setup. | 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 [http://mxr.mozilla.org/mozilla/source/dom/tests/mochitest/ajax/ here] | # First off, these tests will be living in a <suite name> directory [http://mxr.mozilla.org/mozilla/source/dom/tests/mochitest/ajax/ here] | ||
# Create an HTML page that loads in [http://mxr.mozilla.org/mozilla/source/dom/tests/mochitest/ajax/lib/AJAX_setup.js AJAX_setup.js], [http://mxr.mozilla.org/mozilla/source/dom/tests/mochitest/ajax/lib/MochiKit_packed.js MochiKit_packed.js], and [http://mxr.mozilla.org/mozilla/source/dom/tests/mochitest/ajax/lib/SimpleTest.js SimpleTest.js] from the lib directory. Here is an [http://mxr.mozilla.org/mozilla/source/dom/tests/mochitest/ajax/scriptaculous/test_Scriptaculous.html?force=1 example HTML file] from the scriptaculous project. | # Create an HTML page that loads in [http://mxr.mozilla.org/mozilla/source/dom/tests/mochitest/ajax/lib/AJAX_setup.js AJAX_setup.js], [http://mxr.mozilla.org/mozilla/source/dom/tests/mochitest/ajax/lib/MochiKit_packed.js MochiKit_packed.js], and [http://mxr.mozilla.org/mozilla/source/dom/tests/mochitest/ajax/lib/SimpleTest.js SimpleTest.js] from the lib directory. Here is an [http://mxr.mozilla.org/mozilla/source/dom/tests/mochitest/ajax/scriptaculous/test_Scriptaculous.html?force=1 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. | # 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. | ||
# Tests continue to load until we finish the manifest. This is facilitated by our code that is added to the end of a javascript file in the global scope of the framework. You can see the implementation of this code in [http://mxr.mozilla.org/mozilla/source/dom/tests/mochitest/ajax/scriptaculous/src/unittest.js#566 scriptaculous], and here you can find it in [http://mxr.mozilla.org/mozilla/source/dom/tests/mochitest/ajax/prototype/test/lib/unittest.js#552 prototype]. You can see that the only difference is made in regard to the method in which the results are tracked from these suites. | # Tests continue to load until we finish the manifest. This is facilitated by our code that is added to the end of a javascript file in the global scope of the framework. You can see the implementation of this code in [http://mxr.mozilla.org/mozilla/source/dom/tests/mochitest/ajax/scriptaculous/src/unittest.js#566 scriptaculous], and here you can find it in [http://mxr.mozilla.org/mozilla/source/dom/tests/mochitest/ajax/prototype/test/lib/unittest.js#552 prototype]. You can see that the only difference is made in regard to the method in which the results are tracked from these suites. | ||
| Line 15: | Line 15: | ||
* There is a general page on doing this work (thought it seems a little dated) [http://developer.mozilla.org/en/docs/Add_AJAX_Tests_To_Mozilla here]. | * There is a general page on doing this work (thought it seems a little dated) [http://developer.mozilla.org/en/docs/Add_AJAX_Tests_To_Mozilla here]. | ||
* You can see how the Prototype library was added [http://ejohn.org/blog/testing-prototype-with-firefox-3/ here]. | * You can see how the Prototype library was added [http://ejohn.org/blog/testing-prototype-with-firefox-3/ 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 == | == So what do I do == | ||