You're perfectly rigth! I was trying to use TDD in a wrong way.
Now I understand I *have* to use a new database.
"dumpdata" is what I need.
Thanks for your advice.
On Aug 23, 8:53 pm, Russell Keith-Magee <russ...@keith-magee.com>
wrote:
> On Tue, Aug 23, 2011 at 9:15 PM, Carlos Brum <carlos...@gmail.com> wrote:
> > Hello guys,
>
> > I'm new in Django testing whith django test facilities.
>
> > I've read "https://docs.djangoproject.com/en/1.3/topics/testing/" but
> > couldn't find what i'm looking for.
>
> > I'm trying to begin TDD development but wanna use my old data. I don't
> > wanna have to build up all my database again. I already have data
> > there.
>
> > Is it possible!?
>
> Maybe, if you *really* try hard. However, if you are genuine about
> TDD, you don't actually want to use the "old database". You *must*
> have a new database in order to guarantee test conditions. Good tests
> have a known entry condition and a known exit condition; the only
> practical way to guarantee this (and the approach implemented by
> Django) is to have a fresh database configured for every test run.
>
> However, this doesn't mean that you can't have test data in your new
> database. If your live database contains some useful test data, you
> can dump that data using the "dumpdata" command. This will produce a
> JSON/XML fixture that can be specified in your test case; then, every
> time Django runs a test, it will create a clean database and populate
> it with your test data.
>
> 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