QA/XBL2

From MozillaWiki
< QA
Jump to: navigation, search

Get involved with XBL 2 testing, here's how:

1. Familiarize yourself with XBL and in particular the upcoming XBL 2 standard. A good primer that has some of the motivations behind XBL is the XBL 2.0 Primer for Developers. If you want to check out the XBL 2.0 spec itself, go for it!

2. Once you've got a good idea of how to use XBL, check out the Assertions. Each assertion is a statement about XBL that can be tested with a test script. Pick out an assertion that you understand and that you think have a good handle on.

3. Write some testcases. Most of the tests will be in Mochitest format. These aren't much more than webpages, more details about format are in the Format section, but you don't really need to know much about this, there's an XBL 2 Testcase Maker that gives you the template for a XBL 2 test. Each assertion can translate into multiple testcases (the ok and is statements in the Mochitests) and you may even spread these across multiple test files.

4. Submit your test. After you've written a testcase you can submit it using the Testcase Maker form. After you've got your testcase hosted (on the Testcase Maker or elsewhere), add a link to that testcase to the 'Tests' column on the Assertions page.

Testcase Format

Mochitest

Use this format for most tests (shadow tree, event handling, implementation, DOM, elements, etc.).

Mochitests are essentially webpages with a bit of extra test running functionality added. You can test an assertion using the the ok. is, or isnot functions. You will probably also want to use the AddLoadEvent event function so you can test after the binding has been attached. If you're using AddLoadEvent, you'll want to also call SimpleTest.waitForExplicitFinish() so the test doesn't finish before you have a chance to run your code. Call SimpleTest.finish() when you've run all your testcases in that file.

Leave the XBL in a separate document unless you are explicitly testing having the XBL in the same file as the bound document. Attach bindings using the CSS binding property unless you are explicitly testing other attachment methods.

Right now we're testing using the cross-browser javascript implementation of XBL 2 until we get builds of Firefox with XBL 2 (or other browsers). So you'll have to get the js implementation and include the line <script type="text/javascript" src="xbl.js"></script>. If you are using the XBL 2 Testcase Maker, you don't need to worry about this.

There is a meta tag for the assertion in each test file. just add the contents of the assertion to the content attribute of the assert.

Reftest

Use this format for testing CSS styling, selectors, and final flattened tree rendering.

More information on reftests is here: [1]

If Your Testcase Fails

If a testcase fails don't worry. Review what the assertion and the spec says and double check your logic, but there's a definite possibility that the implementation is incorrect. In particular, if you're testing the cross-browser implementation check out the implementation's feature list to see what it does and does not support yet.

If you think the logic is correct, leave the test failing and submit anyways.

Questions

If you have any questions, whether its about the assertions and the spec or about testcase writing or submitting, jump on irc.mozilla.org in #qa and ask your question (look for 'harthur', 'harth', or 'ctalbert') or email fayearthur@gmail.com.