On Thursday 2012-08-16 17:34 +0200, Ms2ger wrote:
> On 08/16/2012 05:10 PM, Ehsan Akhgari wrote:
> >I think this is generally a good idea.  I have a few questions before
> >jumping in to agree though.
> >
> >1. Is the current testharness.js API the documentation at the beginning
> >of <http://w3c-test.org/resources/testharness.js>?  If that is the case,
> >the API looks a lot heavier weight than the default mochitest API we
> >use.  In that case, would it make sense for us to have a compatibility
> >layer which translates our mochitest APIs to the equivalent
> >testharness.js API calls?  (I'm not 100% sure if that conversion would
> >be straightforward.)
> 
> I don't feel it's terribly heavyweight. In the simple case, you need a
> 
> test(function() {
>   // tests
> });
> 
> That's two extra lines of boilerplate. Our mochitest boilerplate is…
> (*looks it up*) 30 lines. I think we'll deal. The method names for
> assertions (assert_*) are a bit longer than we're used to, but in my
> experience, you get used to it rather quickly.

It's two extra lines of boilerplate if you only have one test in the
file.

But if you have many tests in the file, it's a lot more, since each
test needs to be wrapped in this -- at least in my understanding.
Some browser vendors (e.g., Opera) seem to care quite strongly that
each test file always execute the same number of tests in the same
order -- even if some of those tests fail by throwing an exception.
So my understanding is that the intent here is that *each* test be
wrapped this way, presumably along with anything that might throw an
exception.  (That said, I think this "might throw" concept is rather
loose.)

I think it's probably worth writing tests this way because of the
value of sharing them.  But I wouldn't minimize that it is more
overhead.



One other characteristic of tests to be submitted to the W3C that's
rather important is that they fail when the feature isn't
implemented.  If this isn't true, then people will build tables that
show a feature as being partially implemented, etc.  (It's
particularly bad if, say, all but one of a large set of tests that
mostly test error handling actually pass when the feature isn't
implemented.)

-David

-- 
π„ž   L. David Baron                         http://dbaron.org/   𝄂
𝄒   Mozilla                           http://www.mozilla.org/   𝄂
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to