Hi Chris, Andreas,<br><br><div class="gmail_quote">On Thu, May 13, 2010 at 10:57 AM, Chris Muller <span dir="ltr">&lt;<a href="mailto:asqueaker@gmail.com">asqueaker@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;">
Andreas, I have hundreds of tests for Magma and various proprietary<br>
applications that each take anywhere from 1 millisecond to 1 hour.<br>
Would you tell me what I am supposed to do to allow my tests taking<br>
more than 5 seconds not to &quot;timeout&quot;?  Please don&#39;t say I have to put<br>
a pragma into every single method..<br>
<br>
And please don&#39;t say, &quot;tests should be quick.&quot;  Many of my tests are<br>
written to be _thorough_ in that they ensure adequate volumes of data<br>
are handled correctly.  Unlike recently, when a significant<br>
performance regression was introduced 4.1 in the hashed-collections<br>
simply because the test was &quot;quick&quot; and not thorough.<br>
<br>
Tests will take different amounts of time depending on the speed of<br>
the machine running them.  So now when I run on a older, slower<br>
machine, I may get test failures just because the hardware wasn&#39;t fast<br>
enough, when actually the software is working normally.  I see you<br>
have already had to &quot;fiddle&quot; with the timeout value to run through<br>
successfully on whatever machine you are using.<br>
<br>
The reasons stated for introducing this change were:<br>
<br>
&gt; Time out tests by default to avoid a test deadlocking or requiring unexpected user input.<br>
..<br>
&gt; The change heavily simplifies automated testing since tests that deadlock or require user input unexpectedly no longer lock up the testing process but rather fail the individual test.<br>
<br>
After years of straight-away interactive testing, this seems like a<br>
drastic change for a very limited use-case; some kind overnight test<br>
server that spams everyone with test results every morning?  Sorry,<br>
I&#39;m just not happy about this..<br>
<br>
What percentage of tests encounter user-input?  Machines prompting<br>
users is inherently wrong anyway (like SqueakMap, prompting me to<br>
update the map, it&#39;s plain wrong).<br>
<br>
What percentage of tests could possibly encounter a deadlock?  That&#39;s<br>
for when a test involving multiple processes, right?  Small<br>
percentage.<br>
<br>
Therefore, I suggest we make the default timeout much higher, like two<br>
days, and then the very few tests that encounter user-input or<br>
potential deadlocks can stick it in their pragma.<br></blockquote><div><br></div><div>Seems to me the correct default behaviour is that test methods without a timeout are run with an infinite timeout and only methods with a timeout tag will timeout.  Any &quot;large&quot; default timeout is kind of arbitrary.</div>
<div><br></div><div>I have to say I love the use of method tags for the test timeout.  Its an excellent example of metadata specific to a particular method.</div><div><br></div><div>best</div><div>Eliot</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

<br>
 - Chris<br>
<br>
<br>
<br>
<br>
On Mon, May 10, 2010 at 10:55 PM,  &lt;<a href="mailto:commits@source.squeak.org">commits@source.squeak.org</a>&gt; wrote:<br>
&gt; Andreas Raab uploaded a new version of SUnit to project The Trunk:<br>
&gt; <a href="http://source.squeak.org/trunk/SUnit-ar.76.mcz" target="_blank">http://source.squeak.org/trunk/SUnit-ar.76.mcz</a><br>
&gt;<br>
&gt; ==================== Summary ====================<br>
&gt;<br>
&gt; Name: SUnit-ar.76<br>
&gt; Author: ar<br>
&gt; Time: 10 May 2010, 8:54:50.15 pm<br>
&gt; UUID: 7b624ddc-b133-894a-a273-7757b0c1b742<br>
&gt; Ancestors: SUnit-ul.75<br>
&gt;<br>
&gt; Time out tests by default to avoid a test deadlocking or requiring unexpected user input. The timeout can either be set on a per-class basis (for example DecompilerTests&gt;&gt;defaultTimeout) or using the &lt;timeout: seconds&gt; tag on a per-test basis (for example LocalTest&gt;&gt;testLocaleChanged).<br>

&gt;<br>
&gt; The change heavily simplifies automated testing since tests that deadlock or require user input unexpectedly no longer lock up the testing process but rather fail the individual test.<br>
&gt;<br>
&gt;<br>
&gt; =============== Diff against SUnit-ul.75 ===============<br>
&gt;<br>
&gt; Item was changed:<br>
&gt;  ----- Method: TestCase&gt;&gt;runCase (in category &#39;running&#39;) -----<br>
&gt;  runCase<br>
&gt;<br>
&gt; +       [[self setUp.<br>
&gt; +       self performTest] ensure: [self tearDown]]<br>
&gt; +               valueWithin: self timeoutForTest seconds<br>
&gt; +               onTimeout:[TestFailure signal: &#39;Test timed out&#39;].<br>
&gt; +       !<br>
&gt; -       [self setUp.<br>
&gt; -       self performTest] ensure: [self tearDown]<br>
&gt; -                       !<br>
&gt;<br>
&gt; Item was added:<br>
&gt; + ----- Method: SUnitTest&gt;&gt;testTestTimeoutLoop (in category &#39;testing&#39;) -----<br>
&gt; + testTestTimeoutLoop<br>
&gt; +       &lt;timeout: 1&gt;<br>
&gt; +       self should:[[true] whileTrue.] raise: TestFailure.<br>
&gt; + !<br>
&gt;<br>
&gt; Item was added:<br>
&gt; + ----- Method: SUnitTest&gt;&gt;testTestTimeoutTag (in category &#39;testing&#39;) -----<br>
&gt; + testTestTimeoutTag<br>
&gt; +       &lt;timeout: 1&gt;<br>
&gt; +       self should:[(Delay forSeconds: 3) wait] raise: TestFailure.<br>
&gt; + !<br>
&gt;<br>
&gt; Item was added:<br>
&gt; + ----- Method: TestCase&gt;&gt;timeoutForTest (in category &#39;accessing&#39;) -----<br>
&gt; + timeoutForTest<br>
&gt; +       &quot;Answer the timeout to use for this test&quot;<br>
&gt; +<br>
&gt; +       | method |<br>
&gt; +       method := self class lookupSelector: testSelector asSymbol.<br>
&gt; +       (method pragmaAt: #timeout:) ifNotNil:[:tag| ^tag arguments first].<br>
&gt; +       ^self defaultTimeout!<br>
&gt;<br>
&gt; Item was added:<br>
&gt; + ----- Method: TestCase&gt;&gt;defaultTimeout (in category &#39;accessing&#39;) -----<br>
&gt; + defaultTimeout<br>
&gt; +       &quot;Answer the default timeout to use for tests in this test case.<br>
&gt; +       The timeout is a value in seconds.&quot;<br>
&gt; +<br>
&gt; +       ^5 &quot;seconds&quot;!<br>
&gt;<br>
&gt; Item was added:<br>
&gt; + ----- Method: SUnitTest&gt;&gt;testTestTimeout (in category &#39;testing&#39;) -----<br>
&gt; + testTestTimeout<br>
&gt; +       self should:[(Delay forSeconds: 6) wait] raise: TestFailure.<br>
&gt; + !<br>
&gt;<br>
&gt;<br>
&gt;<br>
<br>
</blockquote></div><br>