mochitest-browser and mochitest-chrome have traditionally used the SimpleTest APIs. I'm not aware of the benefits that Assert.jsm provides, but do we really want to diverge these APIs with mochitest-plain? I'm _pretty_ sure that the answer is no for mochitest-chrome at least. Can you please help me understand why we're making this change to mochitest-chrome at least?

Thanks!
Ehsan

On 2014-06-02, 6:37 AM, Mike de Boer wrote:
Dear unit test writers,

As a happy few of you might already know, we introduced a standalone, versatile 
class of assertion methods with Assert.jsm[1], which implements the CommonJS 
Unit Testing specification version 1.1[2].

These methods were already available to you in the global `Assert` namespace in 
XPCShell-test, Mochitest-browser and Mochitest-chrome tests.

Since last Friday[3], each assertion method in Assert.jsm is available in the 
global scope of a unit test as well.
Now we can say that the ‘old’ XPCShell-test assertion methods are deprecated in 
favour of the Assert.jsm ones.

Here’s a short table of what this means in practice:

   * do_check_eq(a, b) —>  equal(a, b)
   * do_check_neq(a, b) —> notEqual(a, b)
   * do_check_true(expr) —> ok(expr)
   * do_check_false(expr) —> ok(!expr)
   * do_check_null(expr) —> equal(expr, null)
   * do_check_matches(a, b) —> deepEqual(a, b) (undocumented XPCShell-test 
feature)

Please note that we did NOT replace all occurrences with the Assert.jsm 
equivalents, we merely marked them as ‘deprecated’ in the docs[4].

We’re planning to do the same for Mochitest-browser tests in bug 1018226.

Now, dear writer and reviewer of unit tests, I’d like to ask if you could take 
note of this change and apply it to new tests that’ll land in the tree.

Finally, I’d like to thank Gregory Szorc, Ted Mielczarek, Blair McBride and 
many others who helped getting this change worked out, integrated and so on.

But we’re not done yet! There are more things we can do to make reading, 
writing and tracing tests easier and more fun!


Have fun,

Mike.


[1] 
https://developer.mozilla.org/en/docs/Mozilla/JavaScript_code_modules/Assert.jsm
[2] http://wiki.commonjs.org/wiki/Unit_Testing/1.1
[3] https://bugzilla.mozilla.org/show_bug.cgi?id=1014482
[4] 
https://developer.mozilla.org/en-US/docs/Mozilla/QA/Writing_xpcshell-based_unit_tests
[5] https://bugzilla.mozilla.org/show_bug.cgi?id=1018226
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform


_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to