Matthew Woodcraft <[EMAIL PROTECTED]> writes:

> Ben Finney  <[EMAIL PROTECTED]> wrote:
> > Your test cases should *not* depend on any state from other test
> > cases; they should function equally well when executed in any
> > arbitrary sequence. Dependencies between separate test cases (e.g.
> > "they only work correctly when run in a specific sequence") means
> > you're not isolating them properly.
> 
> So a mode to randomise the test sequence would be nice to have.

Twisted has a "trial" framework that allows just such a mode
<URL:http://buildbot.net/repos/release/docs/reference/buildbot.steps.python_twisted.Trial-class.html>.

> Unittest's behaviour (using alphabetical order) doesn't really help
> to detect undesired dependencies (which might be bugs in the test
> suite or bugs in the underlying code).

Agreed. It's just a matter of making a custom unittest.TestRunner,
though. Yes, a Small Matter of Programming which I haven't actually
done, but unittest doesn't make it difficult to do that.

> But running tests in the order they appear is often helpful: you can
> put the tests for basic stuff before the tests for advanced stuff,
> and then if you suddenly get seventeen failing tests, you know that
> the first failure is the best bet to investigate first.

Surely, since "suddenly" implies you changed one small area of the
code, that area of the code is the best place to look for what caused
the failure.

-- 
 \         "I planted some bird seed. A bird came up. Now I don't know |
  `\                               what to feed it."  -- Steven Wright |
_o__)                                                                  |
Ben Finney
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to