[Grok-dev] How does one unittest a view?

Vanderson Mota dos Santos vanderson.mota at gmail.com
Wed Apr 8 09:40:18 EDT 2009

You should use an integration/funtional layer in this test.

The name is not really an unit test. It is an acceptance test.
You can do it in 3 ways:

1) Test directly in the View class API, instantiating it with the
TestRequest class as parameter. This is called "Under the skin"(

2) User the zopetestbrowser - Best option if your view doesn't have any
javascript and you don't need a browser or an "Your Application" instance up
and running to run the test.
Here you will need to use TestRequest as well.

3) Use selenium. But you will need to put an application instance running in
order to run your tests.

good testing!

2009/4/8 Wichert Akkerman <wichert at wiggy.net>

> How can you unittest a view? Trying to instantiate a view in a testcase
> fails when the constructor tries to access self.__view_name__ and
> self.module_info.
> Wichert.
> --
> Wichert Akkerman <wichert at wiggy.net>    It is simple to make things.
> http://www.wiggy.net/                   It is hard to make things simple.
> _______________________________________________
> Grok-dev mailing list
> Grok-dev at zope.org
> http://mail.zope.org/mailman/listinfo/grok-dev

Vanderson Mota dos Santos
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.zope.org/pipermail/grok-dev/attachments/20090408/f8063797/attachment-0001.html 

More information about the Grok-dev mailing list