There is no silly questions, there is the ones that are easy or hard to answer.<br><br>"No. In a unittest nothing happens automatically. That's the whole point<br>
of unittests: you want to test things in isolation."<br><br>As far as i know, if you test a view, it is an acceptance testing. <br>Well, i guess you will have to use the integration layer to make the test fixture easier to build.<br>
<div class="gmail_quote">2009/4/8 Wichert Akkerman <span dir="ltr"><<a href="mailto:wichert@wiggy.net">wichert@wiggy.net</a>></span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
No. In a unittest nothing happens automatically. That's the whole point<br>
of unittests: you want to test things in isolation.<br>
<font color="#888888"><br>
Wichert.<br>
</font><div><div></div><div class="h5"><br>
<br>
Previously Paul Wilson wrote:<br>
> Silly question, but has your view been grokked prior to calling its constructor?<br>
><br>
> 2009/4/8 Wichert Akkerman <<a href="mailto:wichert@wiggy.net">wichert@wiggy.net</a>>:<br>
> > I think you misunderstand me. I want to unittest utility methods in my<br>
> > View class. I do not want to write an integration or functional test.<br>
> ><br>
> > Wichert.<br>
> ><br>
> ><br>
> > Previously Vanderson Mota dos Santos wrote:<br>
> >> You should use an integration/funtional layer in this test.<br>
> >><br>
> >> The name is not really an unit test. It is an acceptance test.<br>
> >> You can do it in 3 ways:<br>
> >><br>
> >> 1) Test directly in the View class API, instantiating it with the<br>
> >> TestRequest class as parameter. This is called "Under the skin"(<br>
> >> <a href="http://codebetter.com/blogs/jeremy.miller/archive/2006/06/08/146233.aspx" target="_blank">http://codebetter.com/blogs/jeremy.miller/archive/2006/06/08/146233.aspx</a>)<br>
> >><br>
> >> 2) User the zopetestbrowser - Best option if your view doesn't have any<br>
> >> javascript and you don't need a browser or an "Your Application" instance up<br>
> >> and running to run the test.<br>
> >> Here you will need to use TestRequest as well.<br>
> >><br>
> >> 3) Use selenium. But you will need to put an application instance running in<br>
> >> order to run your tests.<br>
> >><br>
> >> good testing!<br>
> >><br>
> >> 2009/4/8 Wichert Akkerman <<a href="mailto:wichert@wiggy.net">wichert@wiggy.net</a>><br>
> >><br>
> >> > How can you unittest a view? Trying to instantiate a view in a testcase<br>
> >> > fails when the constructor tries to access self.__view_name__ and<br>
> >> > self.module_info.<br>
> >> ><br>
> >> > Wichert.<br>
> >> ><br>
> >> > --<br>
> >> > Wichert Akkerman <<a href="mailto:wichert@wiggy.net">wichert@wiggy.net</a>> It is simple to make things.<br>
> >> > <a href="http://www.wiggy.net/" target="_blank">http://www.wiggy.net/</a> It is hard to make things simple.<br>
> >> > _______________________________________________<br>
> >> > Grok-dev mailing list<br>
> >> > <a href="mailto:Grok-dev@zope.org">Grok-dev@zope.org</a><br>
> >> > <a href="http://mail.zope.org/mailman/listinfo/grok-dev" target="_blank">http://mail.zope.org/mailman/listinfo/grok-dev</a><br>
> >> ><br>
> >><br>
> >><br>
> >><br>
> >> --<br>
> >> Vanderson Mota dos Santos<br>
> ><br>
> >> _______________________________________________<br>
> >> Grok-dev mailing list<br>
> >> <a href="mailto:Grok-dev@zope.org">Grok-dev@zope.org</a><br>
> >> <a href="http://mail.zope.org/mailman/listinfo/grok-dev" target="_blank">http://mail.zope.org/mailman/listinfo/grok-dev</a><br>
> ><br>
> ><br>
> > --<br>
> > Wichert Akkerman <<a href="mailto:wichert@wiggy.net">wichert@wiggy.net</a>> It is simple to make things.<br>
> > <a href="http://www.wiggy.net/" target="_blank">http://www.wiggy.net/</a> It is hard to make things simple.<br>
> > _______________________________________________<br>
> > Grok-dev mailing list<br>
> > <a href="mailto:Grok-dev@zope.org">Grok-dev@zope.org</a><br>
> > <a href="http://mail.zope.org/mailman/listinfo/grok-dev" target="_blank">http://mail.zope.org/mailman/listinfo/grok-dev</a><br>
> ><br>
> _______________________________________________<br>
> Grok-dev mailing list<br>
> <a href="mailto:Grok-dev@zope.org">Grok-dev@zope.org</a><br>
> <a href="http://mail.zope.org/mailman/listinfo/grok-dev" target="_blank">http://mail.zope.org/mailman/listinfo/grok-dev</a><br>
<br>
</div></div>--<br>
<div><div></div><div class="h5">Wichert Akkerman <<a href="mailto:wichert@wiggy.net">wichert@wiggy.net</a>> It is simple to make things.<br>
<a href="http://www.wiggy.net/" target="_blank">http://www.wiggy.net/</a> It is hard to make things simple.<br>
_______________________________________________<br>
Grok-dev mailing list<br>
<a href="mailto:Grok-dev@zope.org">Grok-dev@zope.org</a><br>
<a href="http://mail.zope.org/mailman/listinfo/grok-dev" target="_blank">http://mail.zope.org/mailman/listinfo/grok-dev</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>Vanderson Mota dos Santos<br><br>