Más contenido relacionado La actualidad más candente (19) Similar a Making the most of your Test Suite (20) Making the most of your Test Suite1. Making the most out
of your test suite
Eric Holscher
http://ericholscher.com
Djangocon.eu 2010
2. Overview
» Defining your tests
» Running your tests on every commit
» Monitoring and deployment
» Playing with test data
7. Ways to run Django tests
» ./manage.py test <app>
» ./manage.py test testapp
» nosetests
» setup.py test
» run_tests.py
» ...
9. We need a standard way to
run Python tests
12. setup.py test
» Part of setuptools/distribute
» Will be a part of distutils2
» Django has no support for this yet
» We can lead standardization efforts
14. Pony Build
» Started by Titus Brown
» Super simple Continuous Integration
Server
» Interesting part is the client
» github.com/ericholscher/pony_barn
16. Full Example
class PonyBuild(BaseBuild):
def __init__(self):
super(PonyBuild, self).__init__()
self.name = "sphinx"
self.required = ['nose']
self.repo_url = 'http://bitbucket.org/birkenfeld/sphinx/'
def define_commands(self):
self.commands = [
pony.HgClone(self.repo_url, egg=self.get_name()),
pony.BuildCommand([self.context.python, 'setup.py', 'install']),
pony.TestCommand([self.context.python, 'tests/run.py']),
]
18. Ships with support for
» ./manage.py test <app>
» ./manage.py test <testapp>
» nose
» setup.py test
19. Simple Pony Build
class PonyBuild(DjangoGitBuild):
def __init__(self):
super(PonyBuild, self).__init__()
self.repo_url = "git://github.com/alex/django-filter.git"
self.name = "django-filter"
self.package_name = 'django_filters'
self.installed_apps = ['django_filters', 'django_filters.tests']
34. Hudson stats
» Written in Java :x
» Great plugin community
» Super simple to setup
» Becoming Defacto
» Worthwhile if you have resources
43. XML Output
» Gareth Rushgrove’s django-test-
extensions
» Requires a subclassed TestRunner
» github.com/garethr/django-test-
extensions
» github.com/danielfm/unittest-xml-
reporting
63. Simple Example
go {{ site.url }}/
code 200
find “Awesome”
follow “Events”
code 200
find “Today’s Events”
69. A neat hack allows you to
test your site locally too!
70. Stuff to do
» Nagios integration
» “Run levels”
» Better aggregates timing data
» Have tests live on disk/in VCS
86. We have all the tech we
need, just need to tie it
together