Marcel Taeumel uploaded a new version of SUnit to project The Trunk:
http://source.squeak.org/trunk/SUnit-mt.117.mcz ==================== Summary ==================== Name: SUnit-mt.117 Author: mt Time: 4 September 2019, 5:27:53.689072 pm UUID: ca737f98-f12d-48c1-bb86-028b96fe0cf4 Ancestors: SUnit-mt.116 Measure the time to run a test and store it into the test-case history. =============== Diff against SUnit-mt.116 =============== Item was changed: ----- Method: TestCase>>run: (in category 'running') ----- run: aResult + aResult runCaseMeasured: self. - aResult runCase: self. ! Item was changed: Object subclass: #TestResult + instanceVariableNames: 'timeStamp failures errors passed durations' - instanceVariableNames: 'timeStamp failures errors passed' classVariableNames: '' poolDictionaries: '' category: 'SUnit-Kernel'! !TestResult commentStamp: '<historical>' prior: 0! This is a Collecting Parameter for the running of a bunch of tests. TestResult is an interesting object to subclass or substitute. #runCase: is the external protocol you need to reproduce. Kent has seen TestResults that recorded coverage information and that sent email when they were done.! Item was added: + ----- Method: TestResult>>duration (in category 'accessing') ----- + duration + + ^ self durations inject: 0 into: [:sum :each | sum + each]! Item was added: + ----- Method: TestResult>>durations (in category 'accessing') ----- + durations + ^ durations! Item was changed: ----- Method: TestResult>>initialize (in category 'initialization') ----- initialize super initialize. passed := OrderedCollection new. failures := Set new. errors := OrderedCollection new. + timeStamp := TimeStamp now. + durations := Dictionary new.! - timeStamp := TimeStamp now! Item was changed: ----- Method: TestResult>>printOn: (in category 'printing') ----- printOn: aStream aStream nextPutAll: self runCount printString; + nextPutAll: ' run in '; + nextPutAll: (Duration milliSeconds: self duration) printString; + nextPutAll: ', '; - nextPutAll: ' run, '; nextPutAll: self expectedPassCount printString; nextPutAll: ' passes, '; nextPutAll: self expectedDefectCount printString; nextPutAll:' expected failures, '; nextPutAll: self unexpectedFailureCount printString; nextPutAll: ' failures, '; nextPutAll: self unexpectedErrorCount printString; nextPutAll:' errors, '; nextPutAll: self unexpectedPassCount printString; nextPutAll:' unexpected passes'.! Item was added: + ----- Method: TestResult>>runCaseMeasured: (in category 'running') ----- + runCaseMeasured: aTestCase + + self durations + at: aTestCase + put: [self runCase: aTestCase] timeToRunWithoutGC.! Item was changed: ----- Method: TestResult>>selectResultsForTestCase: (in category 'history') ----- selectResultsForTestCase: aTestCaseClass + | passedSelectors errorsSelectors failuresSelectors testCaseDurations | + - | passedSelectors errorsSelectors failuresSelectors | passedSelectors := self passed select: [:testCase | testCase class == aTestCaseClass ] thenCollect: [:testCase | testCase selector]. errorsSelectors := self errors select: [:testCase | testCase class == aTestCaseClass ] thenCollect: [:testCase | testCase selector]. failuresSelectors := self failures select: [:testCase | testCase class == aTestCaseClass ] thenCollect: [:testCase | testCase selector]. + + testCaseDurations := Dictionary new. + self durations keysAndValuesDo: [:testCase :milliseconds | + testCase class == aTestCaseClass ifTrue: [testCaseDurations at: testCase selector put: milliseconds]]. + + ^ self class newTestDictionary + at: #timeStamp put: self timeStamp; "Keep this result's time stamp." - - ^ self class newTestDictionary at: #passed put: passedSelectors asSet; at: #failures put: failuresSelectors asSet; at: #errors put: errorsSelectors asSet; + at: #durations put: testCaseDurations; + at: #duration put: (testCaseDurations inject: 0 into: [:sum :each | sum + each]); yourself ! |
Hey Marcel, I think we're trying to get to a place where we can deprecate TimeStamp. Would you mind using DateAndTime instead? Best, Chris On Wed, Sep 4, 2019 at 10:27 AM <[hidden email]> wrote: Marcel Taeumel uploaded a new version of SUnit to project The Trunk: |
Hi Chris, sure. I didn't touch that part yet, but I can clean that up in SUnit. :-) For the measurements, I use plain milliseconds and Duration. Best, Marcel
|
Woops, I misread the + Timestamp line, and in context of these new timings, thought you had added it. Sorry Marcel. :) Even without knowing, you were still kind to offer to begin that clean up. No expectations, but if you have time next time, thank you. :) Best, Chris On Fri, Sep 6, 2019 at 12:53 AM Marcel Taeumel <[hidden email]> wrote:
|
In reply to this post by commits-2
I think this broke smalltalkCI.
<[hidden email]> schrieb am Mi., 4. Sep. 2019, 17:28: Marcel Taeumel uploaded a new version of SUnit to project The Trunk: |
Well, smalltalkCI did a full source copy of Squeak's TestRunner. It should then also copy TestResult and TestCase, I suppose. :-) Best, Marcel
|
I will revert that part of SUnit to make smalltalkCI work again. Best, Marcel
|
Free forum by Nabble | Edit this page |