Testing is hard. I think that the comments so far are representative of lack
of specificity in your question. I thought about it last night and put
together a draft of a RESTful approach to testing that could test both
webapp and database at the same time. I believe paste and nose [1] can do
something similar but I feel like web.py has all of the functionality
already built-in.

So without further ado I'd like to request for comment on *RESTful
doctesting using request* [2]. Notice that I've commented out RDBMS code in
favor of a dictionary. I did so in order to make the RESTful aspect easily
testable on other systems. The next step, of course, is to pull SQL into the
loop. I wanted to get others' opinions on the matter. The obvious, easiest
solution would be to keep an up-to-date dump of your DB schema on hand to
setup and teardown a `_test` DB just before and after the
`doctest.testmod()` line third from last.

Any thoughts on extending this for exemplary purposes or is this more or
less just one of very many ways to accomplish the task?

* Focus on the doctest and walking through the CRUD operations. This can be
extended to maintain session state (e.g. setup, user creation, user
verification, user login, resource creation, .., teardown). Lastly, keep in
mind the possibility of using a key-value based DB rather than a SQL-based
RDBMS, the former modeled more like to the code as is.

Sean, is this along the lines of what you were looking for?

[1] http://webpy.org/cookbook/testing_with_paste_and_nose
[2] http://webpy.org/cookbook/restful_doctesting_using_request

On Fri, Sep 18, 2009 at 2:59 PM, Sean <[email protected]> wrote:

>
> Hi,
>
> I'm trying to test my web.py app, including its database
> functionality.  I would like to use a test database for this purpose,
> but it seems like the standard web.py way of doing things is to
> hardcode the database connection in something like a config.py file.
>
> What's the best way to test a web.py app, including its database?  How
> do others do this?
>
> Thanks!
> Sean
>
> >
>


-- 
Angelo Gladding
[email protected]
http://angelo.gladding.name/
E69E 47E8 5C3A 96E5 C70F
D931 F35C ACBA 6F39 9611

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web.py" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [email protected]
For more options, visit this group at http://groups.google.com/group/webpy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to