I am creating a app on Google app engine and am wondering if there are ways to do automated testing with python.
Thanks!
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
We are generally not testing too much. We once had a “80% test coverage” rule but found this doesn’t make us better or faster. Most code and data structures we use are designed quite defensively so there is seldom harm which can’t be undone. Our users prefer fast turnaround times to 100% uptime.
We have two apps setup: my
app.appspot.comand myapp-test.appspot.com. The whole codebase is designer to ensureapp-test.appspot.comnever changes state in external systems.occasionally we copy the data from
app.appspot.comtoapp-test.appspot.com. It can get messy, because id generation counters for the datastore don’t get updated but it works good enough.We develop on both systems. Frontend development is done mostly on
app.appspot.comand experiments with the backend are done onapp-test.appspot.com.We have three branches: master, rc and production.rc gets updated from master and production from rc. rc is deployed daily to rc.app.appspot.com by or operations them. production is deployed weekly to production.app.appspot.com (which is also reachable via an other app name.
Developers usually deply to dev-
whoami.app.appspot.com for experimenting. We use the development server very little because wee need a lot of data from the datastore.Now to testing: we mostly use acceptance tests. We have a little framework called
resttest_dslwhich we use to describe tests like this:hostname and credentials have defaults but can be overwritten by environment variables. Most errors we ever have fixed have a regression test in there. We use
Makefiles to drive the whole stuff. Eg.g:Deployment always happens from the central git repository like this:
We first deploy to a version tagged with the current revision on AppEngine. We then run
resttest.pyagainst this freshly deployed version. On failure the mmakestops execution. If no failure occurred the “production version” is deployed.We also run mandantory pep8, pyflakes and pylint checks on source code checkin.
All in all we have very simple minded tests but run them a lot and against production code and data. For us this catches most of error we make which relatively little effort.