<br><br><div class="gmail_quote">On Tue, Jan 19, 2010 at 3:36 PM, Gary Bernhardt <span dir="ltr">&lt;<a href="mailto:gary.bernhardt@gmail.com">gary.bernhardt@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
On Tue, Jan 19, 2010 at 12:26 PM, Alfredo Deza &lt;<a href="mailto:alfredodeza@gmail.com">alfredodeza@gmail.com</a>&gt; wrote:<br>
(snip)<br>
<div class="im">&gt; Would it be OK to alter the naming in the methods to make sure they are run<br>
&gt; in the order I need to? Even if the naming gets really weird like:<br>
<br>
</div>Never! Extract the required functionality into a separate function and<br>
have both tests call it. If this is a slow-running system test and<br>
that shared functionality is too expensive to run for each test, then<br>
do it in the setup and let the tests rely on that.<br>
<br>
Tests should always work regardless of execution order! :)<br></blockquote><div><br>Ok good point. It is weird though, to get involved with tests and find that execution<br>is done differently (e.g. alphabetical order). <br>
</div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="im"><br>
&gt; Or is there a different/better way to do this? I am thinking something like<br>
&gt; breaking the above example in 2 different classes and creating the setUp()<br>
&gt; and tearDown() methods for each, but wouldn&#39;t that be a little redundant?<br>
<br>
</div>If it&#39;s truly redundant, you&#39;ll be able to merge them without relying<br>
on test order. If you can&#39;t do that, then the existence of two<br>
different classes is expressing the natural differences in the test<br>
scenarios.<br>
<br>
If the tests want to be separate, but you force them together by<br>
making them order-dependent, what you&#39;re really doing is trading away<br>
correctness to gain some terseness. That&#39;s dangerous! :)<br></blockquote><div><br>No, I am jut trying to see what is the best approach. If I need to separate the tests, this is OK. I just want<br>to make sure I am not writing code that someone (maybe me?) will read this code later on and <br>
bang their heads against the screen. <br> </div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<font color="#888888"><br>
--<br>
Gary<br>
<a href="http://blog.extracheese.org" target="_blank">http://blog.extracheese.org</a><br>
</font></blockquote></div><br><br clear="all"><br>-- <br>Alfredo Deza<br><br>