2011/6/10 [email protected] <[email protected]> > Hello guys, > > I started to create a script to test the scripts that use the library > unittest projects web2py. I usually like this: > > - I create the folder *tests* in the project; > - Inside the tests folder create two folders: *models* and *controllers*; > > For now, I have done is to test the model layer. But I ask the help and > contribution ofall to improve this script, and so we have a full support to > the use of TDD in both themodel layer as the control. This is good for > people like me, sympathized greatly with doctests. > > Hello Gilson,
This is something I thought about. Here is my idea about web2py testing: 1) I want to use py.test (http://doc.pytest.org/en/latest/) for testing. I don't want to have to create my test suits manually and with py.test I can mark my functions with decorators to create test suits. 2) For the controllers, I want to create two types of tests: web GUI tests and headless tests. For the web gui tests, I plan to use Windmill (http://www.getwindmill.com/). For the headless tests, I plan to use WebTest ( http://pythonpaste.org/webtest/). More specifically, I want my test suits to start web2py on another thread. This way pydev will be able to give me the code coverage at the end of my tests. For headless tests, I plan with send my http request with a special argument like "test=true" so my controller will know it is a test. Then I will decorate my controller functions so that instead of returning a dictionary to be rendered by the view, it will stream the dictionary as a file and my tests will be able to easily analyze the results by downloading the file and recreating the same dictionary. Yet, I have to implemented this solution but this is what I have in mind. -- A+ ------------- Pierre My blog and profile (http://pierrethibault.posterous.com)<http://pierrethibault.posterous.com> YouTube page (http://www.youtube.com/user/tubetib)<http://www.youtube.com/user/tubetib> Twitter (http://twitter.com/pierreth2) <http://twitter.com/pierreth2>

