separating tests out to a different file

41 views
Skip to first unread message

Michael Wills

unread,
Mar 3, 2008, 6:39:06 PM3/3/08
to web2py Web Framework
I have been wanting to learn and implement test driven development for quite some time. Web2py's implementation makes that easy which is really good. But if we would like to separate the tests out to a separate file, we would have to use unittest instead of doctest, correct? Or is there a way to continue to use the builtin doctest functionality, but separate things out?

voltron

unread,
Mar 3, 2008, 7:59:36 PM3/3/08
to web2py Web Framework
I dunno Michael, doctests are IMHO easier, and they serve also as
documentation, besides, as you mentioned, Web2py makes things easy for
test newbies like me :-)

Massimo Di Pierro

unread,
Mar 4, 2008, 1:28:33 AM3/4/08
to web...@googlegroups.com
I agree with voltron that doctests are more intuitive.

Anyway nothing prevents to create a controller with only test
functions and call all of them from one or more doctests.

Massimo

Michael Wills

unread,
Mar 5, 2008, 1:01:03 AM3/5/08
to web...@googlegroups.com
Hmm... good points. Knowing the option is there easily enough is good as well. I have to say doctests are really straightforward for our own controllers. Part of the reason is twofold though. One is to develop tests for our own, the second is to (eventually) develop tests for web2py. I see there are some tests included as is, but as more and more people take notice of it, there will be more questions about code coverage.

For example some of the code issues that have limodou (hope I spelled your name right and sorry if I did not!) and I think you (voltron) brought up would be good candidates for tests as well. In my extremely limited experience and reading with test driven development, if there is an unexpected error or even a confirmed bug, make a test that is run so that it doesn't come back unexpectedly. Again that's just based on very limited exposure at this point.

Tests separated out are also partially useful because PyDev includes the ability to do unit test from within Eclipse as well. That still requires some investigation though.
Reply all
Reply to author
Forward
0 new messages