[Pkg] The Trunk: SUnit-mt.117.mcz

commits at source.squeak.org commits at source.squeak.org
Wed Sep 4 15:27:54 UTC 2019


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
  		!



More information about the Packages mailing list