I've not used Unit Tests before other than a quick introduction in a Uni course. I'm currently writing an application though and would like to teach myself TDD in the process. The problem is, I've no idea what to test or really how.
I'm writing a Django application, and so far have only created the models (and customised the admin application). This is how I've written the skeletons of my tests so far:
class ModelTests(TestCase):
fixtures = ['initial_data.json',]
def setUp(self):
pass
def testSSA(self):
ssa = SSA.objects.create(name="sdfsdf", cost_center=1111, street_num=8,
street_name="dfsdfsf Street", suburb="sdfsdfsdf",
post_code=3333)
def testResident(self):
pass
def testSSA_Client(self):
pass
I planned to write a function to test each model within the ModelTests class. Is this a good way of writing tests? Also, what exactly should I be testing for? That creating a model with all of the fields completed works? That a half complete model fails? That any special cases are tested (like a null and is_required=False)? I've trust in the ORM, which as far as I'm aware is heavily tested, so I shouldn't need to test all of the methods should I?
What do I need to test for a web application written in Django/Python? Some examples would be nice.