W3C home > Mailing lists > Public > public-html-testsuite@w3.org > December 2010

Re: Request for Feedback On Test Harness

From: Henri Sivonen <hsivonen@iki.fi>
Date: Wed, 1 Dec 2010 15:08:48 +0200
Message-Id: <3CE6D605-EE5B-4797-AD3F-8DC1740B230C@iki.fi>
To: public-html-testsuite@w3.org
On Nov 30, 2010, at 20:57, Maciej Stachowiak wrote:

> I wrote a script test and found myself stymied by this design choice.

Me, too.

> I wanted my test output to report each assertion that passed or failed individually. It seems like the only way to do this is to use a separate test() and assert_equals() for each assertion, for example:
>     test(function() {
>         assert_equals(document.getElementById("abcd"), document.getElementsByTagName("i")[0]);
>     }, "User agents must associate the element with an id value for purposes of getElementById.");

I had exactly the same experience.

> A) Add a test_assert_equals() combo call (perhaps the shorthand should even take an expression to eval rather than a function, but it doesn't really matter). That way, you can easily have a list of assertions each of which is reported independently, with a useful error message that reports the bad value.

I was tempted to write one and call it ok(). :-/

However, if people start writing their non-assertion code outside a test() wrapper, isn't the whole point of the test() wrapper defeated and onerror becomes necessary anyway?

Henri Sivonen
Received on Wednesday, 1 December 2010 13:09:22 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 15:49:38 UTC