Django Testing

Text-only Preview

Django Djang To estingTEric Holscherhttp://ericholscher.comTuesday, May 5, 20091How do you know? • First 4 months of my job was porting and testing Ellington• Going from Django r1290 to Django 1.0.• Suite from 0 to 400 tests.Tuesday, May 5, 2009230,000 Ft View• State of testing in Django• Why you should be testing• How you start testing• Useful tools• Eventual GoalsTuesday, May 5, 20093State of Django TestingTuesday, May 5, 20094assertTrue('Hello World', community.testing.status)Tuesday, May 5, 20095Django 1.1Making Testing Possible since 2009Tuesday, May 5, 20096manage.py startapp creates a tests.pyTuesday, May 5, 20097from django.test import TestCaseclass SimpleTest(TestCase): def test_basic_addition(self): """ Tests that 1 + 1 always equals 2. """ self.failUnlessEqual(1 + 1, 2)__test__ = {"doctest": """Another way to test that 1 + 1 is equal to 2.>>> 1 + 1 == 2True"""}Tuesday, May 5, 20098Fast Tests(Transactions)Tuesday, May 5, 20099Minutes (Lower is better)Ellington Test Speedup604530150Django 1.0Django 1.1Tuesday, May 5, 200910