Saturday, June 25, 2011

appengine unittesting trick

I was looking for the ideal way to run all my unittests on my appengine projects.
Let's define what is ideal:
  • http://project.appspot.com/test to run all unittests
  • create unittest directly in file it is testing/no need to create unittest file for each file
Solution:
  • install gaeunit
  • create or move unittest classes directly in file that it is testing
  • create /test/project_unittest.py
  • import all file containing unittest class in project_unittest.py
What's great with python is that unittest.main() run all unittests that are in the scope which means you simply have to import them and no need to create multiple test files if unittests classes are directly integrated in each files.