I think that with web2py there is no unique fit all solution, and doctest
is not that usefull from my point of view, or it should be use with .txt
file and not be include in docstring, to make sure it is not executed with
the regular code.

Also, I really not sure that unit testing a simple web2py function is very
usefull, except for the really complexe one. I mean what can provide a unit
test when you just render a simple form with SQLFORM... It differents for
the more complexe (customized form or decoupled form from the db model),
but it is not clear to me what I should test and not test.

In the pass and for my needs (and the time I had for testing then), I wrote
a bunch of tests in Selenium that load every pages and simply check if the
page load with no error. I want to go further in unit testing and TDD, but
I have a lot of things to learn.

unittest appears to me much more convenient for structuring the test base
then docstring.

Richard

On Thu, Oct 4, 2012 at 12:04 PM, vinicius...@gmail.com <
vinicius...@gmail.com> wrote:

> You're right, Richard, but I was asking how you organize your production
> code, not your test code.
>
> What is your strategies to isolate components to achieve a better
> unit-testing scenario?
>
> --
> Vinicius Assef
>
>
>
> On 10/04/2012 12:49 PM, Richard Vézina wrote:
>
>> I am reading actually about unit testing and doctest in docstring should
>> be pretty small, as a rule of thumb it should be less longer than you
>> docstring documentation.
>>
>> But, it says too that it pretty convenient to have at least one doctest
>> in docstring since it could help a lot in identifying outdated docstring
>> since if you refactor you code without touch you docstring your doctest
>> should failed so you know you are good for a bit of documentation
>> pleasure.
>>
>> I read too that docstring can be kept apart the docstring a .txt file,
>> so the long unit test should go there.
>>
>> So when doctest help you better understand and document the purpose of
>> the code and if it is short it should go in docstring if it get bloated
>> you can move it in .txt file apart.
>>
>> Richard
>>
>> On Thu, Oct 4, 2012 at 10:27 AM, Marek Mollin <rog...@gmail.com
>> <mailto:rog...@gmail.com>> wrote:
>>
>>     I only use doc-string testing. For everything I do its snap and
>>     effective enough. Plus it can trigered from admin.
>>     Though it is not recomnded way of unittesting - it has its problems,
>>     bloats the code base, does not provide clean seperation between
>>     tests and actual app.
>>
>>
>>     W dniu środa, 3 października 2012 21:46:03 UTC+2 użytkownik
>>     viniciusban napisał:
>>
>>         Hi all.
>>
>>         I continue diving into unit-testing and I'd like to know how do
>> you
>>         organize your applications to be unit-tested.
>>
>>         Thin controllers? DAO classes? How do you decouple things in
>>         web2py to
>>         make unit-testing easy?
>>
>>         --
>>         Vinicius Assef
>>
>>     --
>>
>>
>>
>>
>> --
>>
>>
>>
>>
> --
>
>
>
>

-- 



Reply via email to