Recommended way to save django debug page on error?

7 views
Skip to first unread message

Daniel Abel

unread,
Oct 17, 2009, 5:29:54 AM10/17/09
to Windmill Developers
Hi!

I am using windmill for testing a site written in django. Django, when
used in debug mode produces really useful error pages when something
goes wrong on the server-side. (with a traceback, get/post parameters,
etc.)

I would like to get the information contained in this page in the test
result output if the test fails. In fact, I think this is a more
general issue: the output printed by windmill when a test fails is not
in the most useful format for finding out _why_ the test failed. Even
the error message is hard to find, plus it doesn't contain any
information about the page itself, or the headers the server sent with
it.

So my question is:

- what do others handle this situation? Am I missing some usage
pattern? (for example, would the 'browserdebug' or '-d' command line
options help? Any documentation available on what they do?)

- Should I just try to hack together an error reporter for my test
runner (I use nose) that save the page text after an assertion error,
or is there some more reasonable thing to do?

- How can the test get / assert etc. the http headers the server
sends?

Thanks in advance,
Daniel

Mikeal Rogers

unread,
Oct 17, 2009, 6:04:23 PM10/17/09
to windmi...@googlegroups.com
You can do a couple things.

1) You can pull any information you would like out of the page using an execJs call.
2) You can call in to a Python library that will take a screenshot of the entire desktop.

3) Depending on the browser, we could work on some code that took a screenshot using canvas.
4) We can work on better django integration to add a listener somewhere that notifies windmill of the error page generation and takes all the raw data sent to the page and sends it to a different windmill debugging tool.

We definitely need to work on making all this stuff simpler and seamless but most of the core developers aren't using django regularly so we kind of need input from users like you to figure out the best way to do this integration. We have traditionally tried to wait on people from particular communities to add windmill support rather than attempting to add the support ourselves when we aren't necessarily the target users.

-Mikeal

Seth

unread,
Oct 18, 2009, 8:57:48 PM10/18/09
to Windmill Developers
Hi,

we wrote this app to solve situations like this:

http://www.areciboapp.com

It's free. Any feedback would be great.

Cheers,

Seth



Daniel Abel

unread,
Oct 20, 2009, 6:48:01 AM10/20/09
to Windmill Developers
On Oct 18, 12:04 am, Mikeal Rogers <mikeal.rog...@gmail.com> wrote:
> You can do a couple things.
> 1) You can pull any information you would like out of the page using an
> execJs call.

What call would you suggest to get the current, full page source?

I.e. if I have javascript snippets that modify the DOM, firefox's
'save page source' will save the original, unmodified html. How should
I get the 'actual', modified one?

> 2) You can call in to a Python library that will take a screenshot of the
> entire desktop.
>
> 3) Depending on the browser, we could work on some code that took a
> screenshot using canvas.

There are firefox extensions that take a 'full screenshot' of the
given page (which might be taller than what fits on the page), is
there some way such an extension could be called with execJS? (I'm not
really familiar with either javascript or firefox extension
development, but I would assume that a javascript snippet included in
the page would not get access to the extensions installed in the
browser.)

> 4) We can work on better django integration to add a listener somewhere that
> notifies windmill of the error page generation and takes all the raw data
> sent to the page and sends it to a different windmill debugging tool.

Since django sends the error page with an http status code of 500
('Internal Server Error'), I think it would be enough if getting a
non-ok http status code would trigger a windmill error / test
failure. Is this possible? I guess this boils down to two questions:

1) adding checks that are to be run on every page, like twill's
require extension
(http://twill.idyll.org/extensions.html#require-assert-that-specific-
conditions-hold-after-each-page-is-loaded)

I.e. allow registering some python method (in setup_module, for
example) that is run after, say, every waits.forPageLoad, so that I
can specify these checks in one place and have them being run
everywhere.

2) checking the http status code. According to some pages I found via
google, these status codes are not available to javascript in the
browser. Can windmill check somehow despite this?

Other similar 'check for all page-load' checks that might be
interesting:
- check that page validates
- check that links on page are not broken
- check that site-wide navigation is present on page (with
a .assertNode(), for example)

Thanks,
Daniel

Martin Häcker

unread,
Oct 20, 2009, 6:57:33 AM10/20/09
to windmi...@googlegroups.com
On 20.10.09 12:48, Daniel Abel wrote:
>
> On Oct 18, 12:04 am, Mikeal Rogers <mikeal.rog...@gmail.com> wrote:
>> You can do a couple things.
>> 1) You can pull any information you would like out of the page using an
>> execJs call.
>
> What call would you suggest to get the current, full page source?

Using jQuery this worked for me in other circumstances:

$('html').html()

Regards,
Martin

Reply all
Reply to author
Forward
0 new messages