> I'd like to create some unit tests whch should be executed in random order.
>
>
> However some tests could benefit from results of some predecessor tests.
>
> Therefore they should be executed only after certain tests.
Unit tests are supposed to be isolated. They shouldn't depend on
execution order, or have any pre-requisite other than those specified
as part of the setUp()/teardown() methods. As a result, you won't find
a whole lot of documentation on how to do what you're describing.
The right way to approach this is to identify the required
preconditions for each test, and either construct those preconditions
in the setUp() method, or use Django's test fixtures to install test
data.
This is all covered in the documentation for Django's testing system;
most notably in the section on fixtures.
[1] https://docs.djangoproject.com/en/1.3/topics/testing/#fixture-loading
More broadly, you might want to dig into the documentation for
Python's unittest module, which is what Django's unit test framework
is built on.
Yours,
Russ Magee %-)
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
No comments:
Post a Comment