Django: How to keep the test database when the test is finished?
Some of my requirements are these:
- Create a in-memory sqlite3 database.
- Read a list, and pull those data from production database.
- Perform unit tests
- Remain the test database.
- Perform some intelligent UI tests using the same test database.
I am not a pro in test, but these have to achieved, anyo开发者_如何学JAVAne professional who can suggest a best practice in this area?
Thanks very much for your help!
New in Django 1.8
The --keepdb option can be used to preserve the test database between test runs
https://docs.djangoproject.com/en/1.8/ref/django-admin/#django-admin-option---keepdb
You can run:
./manage.py testserver
Your test database will be created, all your tests are run and afterwards the server keeps running, so you can do your ui testing.
hope this helps, Anton
Persistent Database Test Runner adds a new command called quicktest
that will retain the database after the test is run, and use the same when run again.
精彩评论