May 14, 2010

Now Kay Framework has GAETestBase bundled!

What I've been working on recently is to incorporate GAETestBase to Kay Framework.

I've just finished the adapting work and bundled GAETestBase works very nicely with kay framework. You just need to change the base class of your testcase to "kay.ext.testutils.gae_test_base.GAETestBase" like:

from kay.ext.testutils.gae_test_base import GAETestBase
class DummyTest1(GAETestBase):
  #...
  def test_foo(self):
    # ...
    # ...

By default, when you run your tests via gaeunit, the web testrunner will collect testcases from all of your applications defined in settings.INSTALLED_APPS variable. For now, you cannot change this behavior, but in the near future, I'll add a feature for configuring which test to run via the gaeunit web testrunner.

The recent version of Kay has a url mapping for web testrunner, but your app.yaml may lack of it. In such a case, please add following entry to your app.yaml:

- url: /_ah/test.*
  script: kay/ext/testutils/gaeunit.py
  login: admin

As you can see, you can run your test by visiting a URL like "/_ah/test".

As a note, all of your tests will be called in parallel, so it might leads to unexpected test failures. So you need to write your test functions independent from other tests.

Please see my previous post for details about how to configure GAETestBase.

Happy testing!

1 comment:

A said...

Just wanted to drop in a thank you note.. I've recently started using Kay and it is decidedly the best GAE framework out there at this time. The quality of the documentation is also very high.

Thank you and keep up the good work!