web.browser wouldn't be hard to maintain yourself since it's not a large codebase, if Anand ever decides to ditch it. ;)
On Fri, Jun 10, 2011 at 3:33 PM, Pete Emerson <[email protected]> wrote: > Ah, I misspoke, I meant that I could run my application and then do > functional testing (with something like twill, mentioned above). But I > didn't know about this library built in. That's a win in my opinion > since it's tied in to the framework; sometimes I feel like I've found > something that might be useful only to discover that it isn't being > actively maintained anymore, which can sometimes make finding help in > a pinch rather difficult. > > On Fri, Jun 10, 2011 at 6:20 AM, Branko Vukelic > <[email protected]> wrote: >> Not the actual browser. It's a library incuded with web.py. >> >> https://github.com/webpy/webpy/blob/master/web/browser.py >> >> On Fri, Jun 10, 2011 at 3:16 PM, Pete Emerson <[email protected]> wrote: >>> Sure, I can run the actual browser and then run tests off of that by >>> simulating a web client. One disadvantage of that, though, is that I >>> don't think I can do fancy analysis like code coverage reports. But >>> it's good to keep the options open. Thanks. >>> >>> On Fri, Jun 10, 2011 at 5:28 AM, Branko Vukelic >>> <[email protected]> wrote: >>>> IIRC, web.py has a built-in browser that you can use for testing. A >>>> long time ago, I used it successfully to test an app in conjunction >>>> with nose. I don't remember the specifics, though, but the source code >>>> was very readable, last time I've looked at it. >>>> >>>> On Fri, Jun 10, 2011 at 2:51 AM, Pete Emerson <[email protected]> wrote: >>>>> What are you using to unit test your web.py application? >>>>> >>>>> Following what I found on the web.py website, I started in with paste and >>>>> nose: >>>>> >>>>> http://webpy.org/cookbook/testing_with_paste_and_nose >>>>> >>>>> but as a Python newbie I'm struggling due to lack of great examples. >>>>> >>>>> For instance, my app returns a '400 Bad Request' under certain >>>>> circumstances, and so far I haven't been able to get the 400 code back >>>>> and also validate the response. By running my app and curling it, I >>>>> know that I'm producing a 400 Bad Request with some JSON text, but I >>>>> can't test it with paste / nose. >>>>> >>>>> This code: >>>>> >>>>> r = testApp.post('/auth', headers={'Content-Type':'text/plain'}, >>>>> params=text) >>>>> assert_equal(r.status, 400) >>>>> >>>>> throws an exception (AppError: Bad response: 400 Bad Request (not 200 >>>>> OK or 3xx redirect for /auth)), and it looks like I should be >>>>> leveraging assert_raises from nose.tools, but I haven't been able to >>>>> find the golden code yet to solve this one. >>>>> >>>>> I'd be happy to show more code to try to fix this particular problem, >>>>> but it seems to me there might be other testing frameworks out there >>>>> that are full of good examples that might be a better fit for me. I'm >>>>> curious to hear what others are using to do their testing; the answer >>>>> may be that paste / nose is really the right tool, and I simply need >>>>> to be less of a Python newbie. If that's the case, so be it! >>>>> >>>>> Thanks, >>>>> Pete >>>>> >>>>> -- >>>>> 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. >>>>> >>>>> >>>> >>>> -- >>>> 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. >>>> >>>> >>> >>> -- >>> 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. >>> >>> >> >> -- >> 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. >> >> > > -- > 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. > > -- 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.
