There is no silly questions, there is the ones that are easy or hard to answer.<br><br>&quot;No. In a unittest nothing happens automatically. That&#39;s the whole point<br>
of unittests: you want to test things in isolation.&quot;<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">&lt;<a href="mailto:wichert@wiggy.net">wichert@wiggy.net</a>&gt;</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&#39;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>
&gt; Silly question, but has your view been grokked prior to calling its constructor?<br>
&gt;<br>
&gt; 2009/4/8 Wichert Akkerman &lt;<a href="mailto:wichert@wiggy.net">wichert@wiggy.net</a>&gt;:<br>
&gt; &gt; I think you misunderstand me. I want to unittest utility methods in my<br>
&gt; &gt; View class. I do not want to write an integration or functional test.<br>
&gt; &gt;<br>
&gt; &gt; Wichert.<br>
&gt; &gt;<br>
&gt; &gt;<br>
&gt; &gt; Previously Vanderson Mota dos Santos wrote:<br>
&gt; &gt;&gt; You should use an integration/funtional layer in this test.<br>
&gt; &gt;&gt;<br>
&gt; &gt;&gt; The name is not really an unit test. It is an acceptance test.<br>
&gt; &gt;&gt; You can do it in 3 ways:<br>
&gt; &gt;&gt;<br>
&gt; &gt;&gt; 1) Test directly in the View class API, instantiating it with the<br>
&gt; &gt;&gt; TestRequest class as parameter. This is called &quot;Under the skin&quot;(<br>
&gt; &gt;&gt; <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>
&gt; &gt;&gt;<br>
&gt; &gt;&gt; 2) User the zopetestbrowser - Best option if your view doesn&#39;t have any<br>
&gt; &gt;&gt; javascript and you don&#39;t need a browser or an &quot;Your Application&quot; instance up<br>
&gt; &gt;&gt; and running to run the test.<br>
&gt; &gt;&gt; Here you will need to use TestRequest as well.<br>
&gt; &gt;&gt;<br>
&gt; &gt;&gt; 3) Use selenium. But you will need to put an application instance running in<br>
&gt; &gt;&gt; order to run your tests.<br>
&gt; &gt;&gt;<br>
&gt; &gt;&gt; good testing!<br>
&gt; &gt;&gt;<br>
&gt; &gt;&gt; 2009/4/8 Wichert Akkerman &lt;<a href="mailto:wichert@wiggy.net">wichert@wiggy.net</a>&gt;<br>
&gt; &gt;&gt;<br>
&gt; &gt;&gt; &gt; How can you unittest a view? Trying to instantiate a view in a testcase<br>
&gt; &gt;&gt; &gt; fails when the constructor tries to access self.__view_name__ and<br>
&gt; &gt;&gt; &gt; self.module_info.<br>
&gt; &gt;&gt; &gt;<br>
&gt; &gt;&gt; &gt; Wichert.<br>
&gt; &gt;&gt; &gt;<br>
&gt; &gt;&gt; &gt; --<br>
&gt; &gt;&gt; &gt; Wichert Akkerman &lt;<a href="mailto:wichert@wiggy.net">wichert@wiggy.net</a>&gt;    It is simple to make things.<br>
&gt; &gt;&gt; &gt; <a href="http://www.wiggy.net/" target="_blank">http://www.wiggy.net/</a>                   It is hard to make things simple.<br>
&gt; &gt;&gt; &gt; _______________________________________________<br>
&gt; &gt;&gt; &gt; Grok-dev mailing list<br>
&gt; &gt;&gt; &gt; <a href="mailto:Grok-dev@zope.org">Grok-dev@zope.org</a><br>
&gt; &gt;&gt; &gt; <a href="http://mail.zope.org/mailman/listinfo/grok-dev" target="_blank">http://mail.zope.org/mailman/listinfo/grok-dev</a><br>
&gt; &gt;&gt; &gt;<br>
&gt; &gt;&gt;<br>
&gt; &gt;&gt;<br>
&gt; &gt;&gt;<br>
&gt; &gt;&gt; --<br>
&gt; &gt;&gt; Vanderson Mota dos Santos<br>
&gt; &gt;<br>
&gt; &gt;&gt; _______________________________________________<br>
&gt; &gt;&gt; Grok-dev mailing list<br>
&gt; &gt;&gt; <a href="mailto:Grok-dev@zope.org">Grok-dev@zope.org</a><br>
&gt; &gt;&gt; <a href="http://mail.zope.org/mailman/listinfo/grok-dev" target="_blank">http://mail.zope.org/mailman/listinfo/grok-dev</a><br>
&gt; &gt;<br>
&gt; &gt;<br>
&gt; &gt; --<br>
&gt; &gt; Wichert Akkerman &lt;<a href="mailto:wichert@wiggy.net">wichert@wiggy.net</a>&gt;    It is simple to make things.<br>
&gt; &gt; <a href="http://www.wiggy.net/" target="_blank">http://www.wiggy.net/</a>                   It is hard to make things simple.<br>
&gt; &gt; _______________________________________________<br>
&gt; &gt; Grok-dev mailing list<br>
&gt; &gt; <a href="mailto:Grok-dev@zope.org">Grok-dev@zope.org</a><br>
&gt; &gt; <a href="http://mail.zope.org/mailman/listinfo/grok-dev" target="_blank">http://mail.zope.org/mailman/listinfo/grok-dev</a><br>
&gt; &gt;<br>
&gt; _______________________________________________<br>
&gt; Grok-dev mailing list<br>
&gt; <a href="mailto:Grok-dev@zope.org">Grok-dev@zope.org</a><br>
&gt; <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 &lt;<a href="mailto:wichert@wiggy.net">wichert@wiggy.net</a>&gt;    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>