<div id="__MailbirdStyleContent" style="font-size: 10pt;font-family: Arial;color: #000000;text-align: left" dir="ltr">
Hi Christoph --<div><br></div><div>Well, looks good. </div><div><br></div><div>+1</div><div><br></div><div>Best,</div><div>Marcel</div><div><br></div><div class="mb_sig"></div>
<blockquote class="history_container" type="cite" style="border-left-style: solid;border-width: 1px;margin-top: 20px;margin-left: 0px;padding-left: 10px;min-width: 500px">
<p style="color: #AAAAAA; margin-top: 10px;">Am 29.12.2021 18:38:37 schrieb commits@source.squeak.org <commits@source.squeak.org>:</p><div style="font-family:Arial,Helvetica,sans-serif">A new version of SUnit was added to project The Inbox:<br>http://source.squeak.org/inbox/SUnit-ct.133.mcz<br><br>==================== Summary ====================<br><br>Name: SUnit-ct.133<br>Author: ct<br>Time: 29 December 2021, 6:38:28.060638 pm<br>UUID: 83af50fb-86e6-d843-8e9e-9abe8e8e379a<br>Ancestors: SUnit-mt.125<br><br>Updates debugging logic of TestCase. Instead of abusing #halt, open a debugger directly on the entrypoint to run the case. Deprecates #openDebuggerOnFailingTestMethod.<br><br>Also slightly refactors internal behavior to avoid some duplication, and to get rid of unnecessary semaphores which do not add any value compared to #ensure: unless some really low-level things are broken.<br><br>Supersedes SUnit-ct.125. Based on my own experiences from >1.5 years, I have revised #debugAsFailure to always halt right before sending #setUp. This improves a) the explorability of any custom set-up/tear-down logic of the test case and b) the immediacy of opening a debugger if you have a very heavy #setUp implementation. From the user perspective, effectively, you still have to click "Over-into-over-into" to navigate into the actual test method.<br><br>Please report back whether you find this behavior acceptable. :-)<br><br>=============== Diff against SUnit-mt.125 ===============<br><br>Item was added:<br>+ ----- Method: TestCase>>assureResourcesDuring: (in category 'private') -----<br>+ assureResourcesDuring: aBlock<br>+ <br>+ | resources |<br>+ resources := self resources.<br>+ resources do: [:resource |<br>+ resource isAvailable ifFalse: [<br>+ ^ resource signalInitializationError]].<br>+ ^ aBlock ensure: [<br>+ resources do: [:resource |<br>+ resource reset]].!<br><br>Item was changed:<br> ----- Method: TestCase>>debug (in category 'running') -----<br> debug<br>+ "Run the receiver and open a debugger on the first failure or error."<br>+ <br>+ ^ self assureResourcesDuring: [self runCaseWithoutTimeout]!<br>- self resources do:<br>- [ : res | res isAvailable ifFalse: [ ^ res signalInitializationError ] ].<br>- [ self runCase ] ensure:<br>- [ self resources do:<br>- [ : each | each reset ] ]!<br><br>Item was changed:<br> ----- Method: TestCase>>debugAsFailure (in category 'running') -----<br> debugAsFailure<br>+ "Spawn a debugger that is ready to debug the receiver."<br>+ <br>+ (Process<br>+ forBlock: [self debug]<br>+ runUntil: [:context | context isClosureContext "navigate the process directly to the point where it is about to send #setUp"<br>+ and: [context selector = #runCaseWithoutTimeout]])<br>+ debug.!<br>- | semaphore |<br>- semaphore := Semaphore new.<br>- self resources do: [:res | <br>- res isAvailable ifFalse: [^res signalInitializationError]].<br>- [semaphore wait. self resources do: [:each | each reset]] fork.<br>- (self class selector: testSelector) runCaseAsFailure: semaphore.!<br><br>Item was changed:<br> ----- Method: TestCase>>openDebuggerOnFailingTestMethod (in category 'running') -----<br> openDebuggerOnFailingTestMethod<br>+ <br>+ self deprecated: 'ct: Use #debugAsFailure'.<br>+ <br> "SUnit has halted one step in front of the failing test method. Step over the 'self halt' and <br> send into 'self perform: testSelector' to see the failure from the beginning"<br>- <br> self<br> halt;<br> performTest!<br><br>Item was changed:<br> ----- Method: TestCase>>runCaseAsFailure: (in category 'running') -----<br> runCaseAsFailure: aSemaphore<br>+ <br>+ self deprecated: 'ct: Use #runCaseWithoutTimeout and #ensure:'.<br>+ ^ [self runCaseWithoutTimeout]<br>+ ensure: [aSemaphore signal]!<br>- [self setUp.<br>- self openDebuggerOnFailingTestMethod] ensure: [<br>- self tearDown.<br>- aSemaphore signal]!<br><br>Item was added:<br>+ ----- Method: TestCase>>runCaseWithoutTimeout (in category 'running') -----<br>+ runCaseWithoutTimeout<br>+ <br>+ [self setUp.<br>+ self performTest]<br>+ ensure: [self tearDown].!<br><br><br></div></blockquote></div>