#2333: Add unit test framework for end-user Django applications
-------------------------------+--------------------------------------------
Reporter: russellm | Owner: russellm
Type: enhancement | Status: new
Priority: normal | Milestone:
Component: Unit test system | Version: SVN
Severity: normal | Resolution:
Keywords: unit test doctest |
-------------------------------+--------------------------------------------
Comment (by russellm):
Ok; here's a walkthrough of v1 of the Django testing framework. Note that
this is not the end of development; it is just an attempt to set up a
generic test framework that is the equal of the existing test/runtests.py.
The next step is to implement facilities for fixtures, testing templates,
contexts, views, etc.
== core ==
* Added a 'test' target to django-admin
* Test target gets the settings.TEST_RUNNER method in
setings.TEST_MODULE, and invokes it
* Test method is provided with a list of modules to test, and a
verbosity for error reporting.
* Added a '--verbosity/-v' option, which is passed to a few of the
targets
* Modified syncdb to allow customized verbosity of output messages.
* Modified syncdb to operate in a 'non-interactive' mode, so you can call
syncdb and disable the call to create a superuser
* Modified the parameters of the post_syncdb signal to pass on verbosity
and interactivity options.
== conf ==
* Added two new default settings: TEST_MODULE and TEST_RUNNER. These
strings identify the module name, and the module symbol that will be used
by the django-admin 'test' target to start the test set. Points to the
'simple' test runner by default.
== contrib ==
* Modified the post_syncdb handlers for the contenttypes, auth, and sites
applications to cater for the new verbosity and interactivity
information.
== test ==
* Moved the copy of doctest.py into the test package.
* simple.py
* An implementation of a 'simple' testing strategy - i.e., the same
strategy currently used by tests/runtests.py
* Searches for any doctest in the models.py or tests.py module
* Searches for any unittest in the models.py or tests.py module
* Composes a unitest.TestSuite of all these tests
* Sets up the test db before running the entire suite, and tears it
down after running the suite.
* The simple test runner can also be provided with a list of 'extra'
testCases that will be added to the test suite. This is used by the django
tests to insert model validation tests.
* testcases.py
* Some utilites that customize the default behaviour of doctest and
unittest.
* Original intent was to add some TestCase extensions to this module
that implement fixture/db setup type procedures.
* utils.py
* Methods that other test framework writers might need - specifically,
db setup/teardown calls.
* db setup/teardown use syncdb to setup the database, so all
permissions and content types will be in the database during testing
(rather than the existing approach that just installs tables.
* ALL the apps in INSTALLED_APPS are synced, just in case of
dependencies between models.
== modeltests ==
* Moved the API_TESTS string to a location that doctest will find by
default.
* An alternate approach would be to put this docstring into a 'tests.py'
package.
== regressiontests ==
* Moved the API_TESTS string to a location that doctest will find by
default.
* Moved each of the othertests as an app within regressiontests. The
tests are in the tests.py of each package.
* If they were simple doctests, they are pretty much unchanged.
* If they were executing 'assert' tests, they have been ported as
unittests
* Each of the tests.py for an 'othertest' is still a standalone script.
Comments?
--
Ticket URL: <http://code.djangoproject.com/ticket/2333>
Django <http://code.djangoproject.org/>
The web framework for perfectionists with deadlines.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-updates
-~----------~----~----~----~------~----~------~--~---