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

Paul Wilson paulalexwilson at gmail.com
Wed Apr 8 09:52:33 EDT 2009


Silly question, but has your view been grokked prior to calling its constructor?

2009/4/8 Wichert Akkerman <wichert at wiggy.net>:
> I think you misunderstand me. I want to unittest utility methods in my
> View class. I do not want to write an integration or functional test.
>
> Wichert.
>
>
> Previously Vanderson Mota dos Santos wrote:
>> 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"(
>> http://codebetter.com/blogs/jeremy.miller/archive/2006/06/08/146233.aspx)
>>
>> 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
>
>> _______________________________________________
>> Grok-dev mailing list
>> Grok-dev at zope.org
>> http://mail.zope.org/mailman/listinfo/grok-dev
>
>
> --
> 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
>


More information about the Grok-dev mailing list