There is no official approach, testing is being an issue for a long time,
there was a project called web2py test runner, but the maintainer abandoned
the project.

If you can contribute with something on this subject, your contribution
will be very welcome.

The main problem of testing is the fact that web2py runs its own
environment, for some things this environment depends on "request",
"response" "session" and other state objects which exists only when the
application is running on a webserver.

I think a good test approach would be creating mocks for that objects and
so having a "fake" environment to run the tests on shell.

$ python web2py.py -S appname -M -R /path/tests.py

The above command will open web2py in a shell mode and runs the tests.py
script since the environment is ready, but on this environment we do not
have full "request", "session" and "response" objects, so we need some
mocking for this.

-- 



Reply via email to