Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Locked thread
Share Bear
Apr 27, 2004

How do I get started writing tests for things in Django?

I've never done testing in code, and my workflow tends to be:

1) Start server
2) Edit views.py or forms.py
3) Refresh browser, test data


I think I could do this better. How?

Adbot
ADBOT LOVES YOU

Share Bear
Apr 27, 2004

bitprophet posted:

Er. Hate to be all RTFM on you but did you look at the documentation? Go to the Django documentation page and it's the 5th line down under the Reference header :)

Granted, comprehensively testing web apps is a bit tougher because of their nature, but you can still get a lot done with a simple set of unit tests testing object creation/editing/deletion, making sure all your URLs result in HTTP 200s and aren't breaking, and putting doctests on any non-builtin model methods you write (e.g. if you do something like get_sum_of_child_numbers(), do a doctest to ensure it works correctly). So on and so forth.

Haha drat I missed it while looking over the documentation page. Thanks.

Share Bear
Apr 27, 2004

duck monster posted:

I just made this

xml-from-dictionary function()

Have fun.

Also the order it puts elements is MAGICAL just like harry potter or a unicorn.

That's neat, is this a question? I've read the last two pages and I'm not sure. Dictionaries/hashes don't store ordering information and need sorting for keys or definitions.

  • Locked thread