On Apr/6/2011 6:33 PM, ext Aryeh Gregor wrote:
On Wed, Apr 6, 2011 at 2:11 PM, Garrett Smith<dhtmlkitc...@gmail.com>  wrote:
| Within each test one may have a number of asserts.

I don't agree.

SRP applies to functions and also unit tests. Limiting test functions
to one assertion keeps them simple and can also indicate too much
complexity in the method being tested.
Multiple assertions per test are allowed so each file will have a
fixed number of tests that always run.  This way you can come up with
meaningful figures on the number of tests failed.  Often it's
impossible to even run one assertion if a previous assertion fails, so
having one assert per test wouldn't allow this.

Personally, I've found multiple assertions per test to be useful and
natural, once I got used to them.  I'd want concrete objections to
actual tests that have been written if I were to consider switching to
using only one assertion per test.

Testing W3C APIs is something that I have advocated for years on these
lists.. This test harness needs an overhaul, however. It is not easy
to find an expert with deep knowledge of W3c APIs, ECMAScript,
browsers, and unit testing and who can put all of it together. This
stuff is not as simple as it might appear on the surface.
That may be, but in the end, it's the people who write the tests who
will decide how they write them.  If you're interested in persuading
test writers to follow particular practices, I'd suggest providing
complete and detailed arguments.

I think we want to give test case contributors some flexibility and not make the process overly prescriptive.

Garrett - almost all of the text in the Harness wiki document is copied from testharness.js, the idea being a reader could get a general sense of the harness without reading the JS file. If any of the info in that document is incorrect, I will fix it or delete it (and plan to work more closely with James on its contents).

-Art Barstow



Reply via email to