- From: Aryeh Gregor <Simetrical+w3c@gmail.com>
- Date: Wed, 6 Apr 2011 18:33:26 -0400
- To: Garrett Smith <dhtmlkitchen@gmail.com>
- Cc: Arthur Barstow <art.barstow@nokia.com>, public-webapps <public-webapps@w3.org>
On Wed, Apr 6, 2011 at 2:11 PM, Garrett Smith <dhtmlkitchen@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.
Received on Wednesday, 6 April 2011 22:34:13 UTC