I want to add my +1 to the goal of unifying and streamlining the setting up of 
test flows and a common assertion syntax. 

I know some of the issues you raise with Promises (like getting a useful stack 
on exceptions) are being discussed and addressed already. I dont have all the 
context, but ISTM the task/promise boat has already sailed, so step 1 in the 
unification effort is ferretting out and fixing issues created or not-solved by 
this approach before adoption is truly widespread.

In the past I've seen real benefit from having some kind of Test or Fixture 
class/prototype, as well as for a group or suite of tests. It lets you easily 
share boilerplate for similar tests and gives you a place to hang state and 
other products of the steps in a test, where they can be tracked and cleaned up 
during teardown.

In the (mochi)tests we'e been writing in browser/metro, we've found need for a 
few things to facilitate test writing and useful running and reporting 
behavior, including:
 
* async setUp, i.e. setUp is itself a Task
* various helpers for events, observers and other asynchrony tests need to 
navigate
* method spies/stubs
* try/catch hackery to allow a suite to complete and report all errors, rather 
than falling at the first hurdle 

The guts of the test runner-runner are here: 
https://mxr.mozilla.org/mozilla-central/source/browser/metro/base/tests/mochitest/head.js#668
 .. I'm sure each module and project has some unique requirements but a lot of 
this stuff feels strongly like it should already exist. Count me in on any 
efforts to fill this gap.
 
/Sam

On Tuesday, May 7, 2013 2:49:49 PM UTC+1, Mike de Boer wrote:
> TLDR; in bug 867742 I requested to adopt two JS modules, Async.jsm and 
> AsyncTest.jsm, in mozilla-central/toolkit/modules. The whole story can be 
> read below as well as at https://gist.github.com/mikedeboer/5495405. I posted 
> about this subject before on firefox-dev: 
> https://mail.mozilla.org/pipermail/firefox-dev/2013-April/thread.html#268

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

Reply via email to