<div dir="ltr"><br><br><div class="gmail_quote">---------- Forwarded message ----------<br>From: <b class="gmail_sendername">Olemis Lang</b> <span dir="ltr">&lt;<a href="mailto:olemis@gmail.com">olemis@gmail.com</a>&gt;</span><br>
Date: Mon, Jan 6, 2014 at 4:02 PM<br>Subject: Re: [TIP] Using doctest for functional tests / user stories<br>To: Paul Moore &lt;<a href="mailto:p.f.moore@gmail.com">p.f.moore@gmail.com</a>&gt;<br><br><br><div dir="ltr"><div class="im">
<div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jan 6, 2014 at 3:00 PM, Paul Moore <span dir="ltr">&lt;<a href="mailto:p.f.moore@gmail.com" target="_blank">p.f.moore@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="overflow:hidden">Is doctest considered a bad idea for this type of high-level narrative<br>
style of functional test (or spec)? Or is the whole idea of<br>
structuring the user stories as testable documents considered bad<br>
practice? I&#39;m finding it very difficult to formulate good functional<br>
tests in the unittest style, but I don&#39;t want to switch to doctest if<br>
it&#39;s going to cause me problems as my development gets more complex.<br></div></blockquote></div></div><div class="gmail_extra"><br></div></div><div class="gmail_extra">This is a question that triggers all sorts of analyses in favor or against doctests . In my opinion I&#39;ve found it useful to combine the expressiveness of doctest with the power of unittest . That&#39;s why I (wrote and) use dutest [1]_ module . Among other things it offers equivalent approaches since global __tc__ variable in doctests is bound to an instance of unittest.TestCase you can use to write assertions e.g. __tc__.assertEquals(x, y) . This approach might have limitations as well .<br>

</div><div class="gmail_extra"><br></div><div class="gmail_extra">There are other approaches e.g. BDD , lettuce [2]_ , ...</div><div class="gmail_extra"><br></div><div class="gmail_extra">p.s. fwiw , I&#39;ve written a derivative framework TracDuTest that allows for writing (unit / functional) test cases for Trac + Bloodhound plugins (i.e. supporting fixtures to load Trac server , create svn repos , ... and then run doctests on top of the custom instances of unittest.TestCase) e.g. used in TracGViz [3]_ . </div>

<div class="gmail_extra"><br></div><div class="gmail_extra">.. [1] <a href="https://pypi.python.org/pypi/dutest" target="_blank">https://pypi.python.org/pypi/dutest</a></div><div class="gmail_extra"><br></div><div class="gmail_extra">
.. [2] <a href="https://pypi.python.org/pypi/lettuce" target="_blank">https://pypi.python.org/pypi/lettuce</a></div>
<div class="gmail_extra"><br></div><div class="gmail_extra">.. [3] <a href="https://pypi.python.org/pypi/TracGViz" target="_blank">https://pypi.python.org/pypi/TracGViz</a></div><div class="gmail_extra"><br>-- <br>Regards,<br>
<br>Olemis - @olemislc<br>
<br>Apache™ Bloodhound contributor<br><a href="http://issues.apache.org/bloodhound" target="_blank">http://issues.apache.org/bloodhound</a><br><a href="http://blood-hound.net" target="_blank">http://blood-hound.net</a><br>
<br>Blog ES: <a href="http://simelo-es.blogspot.com/" target="_blank">http://simelo-es.blogspot.com/</a><br>
Blog EN: <a href="http://simelo-en.blogspot.com/" target="_blank">http://simelo-en.blogspot.com/</a><br><br>Featured article:<br><br><br>
</div></div>
</div><br><br clear="all"><br>-- <br>Regards,<br><br>Olemis - @olemislc<br><br>Apache™ Bloodhound contributor<br><a href="http://issues.apache.org/bloodhound">http://issues.apache.org/bloodhound</a><br><a href="http://blood-hound.net">http://blood-hound.net</a><br>
<br>Blog ES: <a href="http://simelo-es.blogspot.com/">http://simelo-es.blogspot.com/</a><br>Blog EN: <a href="http://simelo-en.blogspot.com/">http://simelo-en.blogspot.com/</a><br><br>Featured article:<br><br><br>
</div>