tdd with python and app engine

16
TDD with App Engine and Python the easy way

Upload: ricardo-banffy

Post on 23-Aug-2014

259 views

Category:

Internet


0 download

DESCRIPTION

An easy way to test your App Engine Python applications

TRANSCRIPT

Page 1: TDD with Python and App Engine

TDD with App Engine and Pythonthe easy way

Page 2: TDD with Python and App Engine

Show of hands● Who already uses App Engine with Python?● Who does TDD with App Engine and

Python?● Who writes tests?

Page 3: TDD with Python and App Engine

O que é o Google App Engine

Page 4: TDD with Python and App Engine

O que é o Google App Engine

Page 5: TDD with Python and App Engine

O que é o Google App Engine

Page 6: TDD with Python and App Engine

What is Google App Engine● A PaaS - platform as a service● Specific APIs and libraries

o but can run Django, Flask etc adapted apps● You don't worry about the server● Google's team manages them for you● A local development environment● Deployment using the SDK (or git - for Java)

Page 7: TDD with Python and App Engine

What else is in Google App Engine● Automagic spin-up and spin-down of servers● Pay-as-you-go● Datastore (NoSQL) + Google Cloud SQL● Queues - for asynchronous tasks● NDB - asynchronous data access (and

more)● Authentication● A framework that encourages good practices

o And punishes bad ones

Page 8: TDD with Python and App Engine

More?● A management interface● You can keep multiple versions deployed

o And split traffic between them

● A brand-new management interfaceo Integrated with the other cloud products family

Page 9: TDD with Python and App Engine

What we had before?● GAEUnit

o Deploys testing code to productiono Does it still work?

● SDK testbedo Batteries not included

● NoseGAE, pytest-gaeo Some batteries included

● ?

Page 10: TDD with Python and App Engine

Why build another one?● Include more batteries● Being opinionated can be good

o Conventions over configuration helps newcomers● Some things are missing from the vanilla

SDKo Exampleso The way Django uses its fixtures is amazing

Page 11: TDD with Python and App Engine

Why build another one? (continued)● Virtualenvs are cool

o To break the system Python is always painfulo Built-in Python may not be an option

● If it's hard to test, people won'to Laziness is one of the virtues of a programmer (even

if, in this case, it may not be)● A little bit of support goes a long way

Page 12: TDD with Python and App Engine

What was done?● A skeleton project (on GitHub)● Creates a virtualenv● Runs sanity tests● Loads data from a JSON file● Assemble everything with a Makefile● Tests do not rely on the development server● You can run ipdb (in your tests)!

Page 13: TDD with Python and App Engine

How do you use it?Demo1. git clone

o [email protected]:rbanffy/testable_appengine.git2. make venv3. nosetests (or py.test)

Page 14: TDD with Python and App Engine

O que falta fazer● Importar hierarquias de objetos para testes● Tornar mais fácil usar em projetos já em

andamentoo Sobretudo manter o maquinário atualizadoo Se bem que isso pode nem ser importante

● Precisamos de mais usuárioso Que dêem mais palpites

Page 15: TDD with Python and App Engine

Questions?

Page 16: TDD with Python and App Engine

Contactabout.me/rbanffy@rbanffyhttps://github.com/rbanffy/testable_appengine