Re: [web2py] Script TDD in web2py
Also, kindly please stop posting the same question multiple times -- just ask once. Thank you. On Sunday, June 12, 2011 1:28:17 AM UTC-4, Pierre Thibault wrote: 2011/6/12 anil manikyam anilman...@gmail.com *i want to update last row in a table in web2py how?* -- @n!l m@n!ky@m Hi Anil, I think this is a bit out of subject. Please, open a new conversion with a new subject. -- 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
Re: [web2py] Script TDD in web2py
2011/6/10 contatogilson...@gmail.com contatogilson...@gmail.com 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
Re: [web2py] Script TDD in web2py
How to tests with web2py. Need importing gluon libs. _ *Gilson Filho* *Web Developer http://gilsondev.com* 2011/6/11 Pierre Thibault pierre.thibau...@gmail.com 2011/6/10 contatogilson...@gmail.com contatogilson...@gmail.com 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
Re: [web2py] Script TDD in web2py
Show an example of how you use py.test to perform unit tests on the model layer and controller. _ *Gilson Filho* *Web Developer http://gilsondev.com*
Re: [web2py] Script TDD in web2py
2011/6/11 contatogilson...@gmail.com contatogilson...@gmail.com Show an example of how you use py.test to perform unit tests on the model layer and controller. _ *Gilson Filho* *Web Developer http://gilsondev.com* I have nothing concrete yet. I am just thinking about what might be the best strategy. I don't know what I will do with the models. What one way would be a controller made to return the globals. Do I need to test the models? It may be seen as configuration files. The other thing I plan to do is put the application logic in the modules directory. This way, I can test the business logic without web2py and I reuse the logic in other apps. -- 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
Re: [web2py] Script TDD in web2py
Yes, I understand. But the issue is the use of the gluon. Perform tests is fine, the problem is to run the same tests using the libraries and gluon. Therefore it has to import them. Hence the creation of this script. _ *Gilson Filho* *Web Developer http://gilsondev.com*
Re: [web2py] Script TDD in web2py
2011/6/11 contatogilson...@gmail.com contatogilson...@gmail.com Yes, I understand. But the issue is the use of the gluon. Perform tests is fine, the problem is to run the same tests using the libraries and gluon. Therefore it has to import them. Hence the creation of this script. The code to start web2py is in web2py.py. I'll have to create a similar code to start it but I want to start it without a gui interface. I also want to start it at the beginning of the tests and stop it at the end. Your strategy is different: you are executing code like if that code was in a web2py environment. I prefer to use another strategy: I run web2py itself and I send real http request from a real client. This way, I cannot have bugs because the mockup environment is different from the real one: I am testing the real thing. I think it is a better approach. -- 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
Re: [web2py] Script TDD in web2py
So when you create the script makes available for us to test and to use =) _ *Gilson Filho* *Web Developer http://gilsondev.com* 2011/6/11 Pierre Thibault pierre.thibau...@gmail.com 2011/6/11 contatogilson...@gmail.com contatogilson...@gmail.com Yes, I understand. But the issue is the use of the gluon. Perform tests is fine, the problem is to run the same tests using the libraries and gluon. Therefore it has to import them. Hence the creation of this script. The code to start web2py is in web2py.py. I'll have to create a similar code to start it but I want to start it without a gui interface. I also want to start it at the beginning of the tests and stop it at the end. Your strategy is different: you are executing code like if that code was in a web2py environment. I prefer to use another strategy: I run web2py itself and I send real http request from a real client. This way, I cannot have bugs because the mockup environment is different from the real one: I am testing the real thing. I think it is a better approach. -- 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
Re: [web2py] Script TDD in web2py
2011/6/11 contatogilson...@gmail.com contatogilson...@gmail.com So when you create the script makes available for us to test and to use =) Well, it is better than I thought. I don't even need such a script! Sorry to say that. :-) I can start web2py from Eclipse with code coverage. After that I can start, also from Eclipse, my test suit (gui or headless) and I will get both my test results and my code coverage for my tests after the tests has run. The only thing I will need is the decorator thing I talked about. I don't think it will be hard to do. -- 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
Re: [web2py] Script TDD in web2py
*i want to update last row in a table in web2py how?* -- @n!l m@n!ky@m
Re: [web2py] Script TDD in web2py
2011/6/12 anil manikyam anilmanikya...@gmail.com *i want to update last row in a table in web2py how?* -- @n!l m@n!ky@m Hi Anil, I think this is a bit out of subject. Please, open a new conversion with a new subject. -- 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
[web2py] Script TDD in web2py
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. The link: https://gist.github.com/996576 _ *Gilson Filho* *Web Developer http://gilsondev.com*