--- a/Tools__TestRunnerMini.st Wed Mar 27 16:02:07 2019 +0100
+++ b/Tools__TestRunnerMini.st Wed Mar 27 16:55:44 2019 +0100
@@ -34,7 +34,8 @@
selectedMethodsHolder methodGeneratorHolder resultHolder
resultInfoHolder resultBackgroundColorHolder runningHolder
progressHolder progressIndicatorShownHolder infoHolder
- testProcess allTestCases progressIndicator'
+ testProcess allTestCases progressIndicator resultNameAspect
+ currentTestCaseName'
classVariableNames:''
poolDictionaries:''
category:'SUnit-UI'
@@ -203,10 +204,12 @@
^
#(FullSpec
name: windowSpec
+ uuid: '03ab8f72-50a5-11e9-a55c-b8f6b1108e05'
window:
(WindowSpec
label: 'Mini Test Runner'
name: 'Mini Test Runner'
+ uuid: 'e9826d32-50a4-11e9-a55c-b8f6b1108e05'
min: (Point 10 10)
bounds: (Rectangle 0 0 600 50)
)
@@ -216,6 +219,7 @@
(ViewSpec
name: 'Box1'
layout: (LayoutFrame 0 0 0 0 0 1 0 1)
+ uuid: 'e9827192-50a4-11e9-a55c-b8f6b1108e05'
backgroundChannel: resultBackgroundColorAspect
component:
(SpecCollection
@@ -223,6 +227,7 @@
(HorizontalPanelViewSpec
name: 'RunnerInnerBox'
layout: (LayoutFrame 0 0 0 0 -2 1 0 1)
+ uuid: 'e9827372-50a4-11e9-a55c-b8f6b1108e05'
backgroundChannel: resultBackgroundColorAspect
horizontalLayout: rightSpaceFit
verticalLayout: topSpace
@@ -233,25 +238,16 @@
collection: (
(ViewSpec
name: 'RunnerInfoBox'
+ uuid: 'e98275ca-50a4-11e9-a55c-b8f6b1108e05'
backgroundChannel: resultBackgroundColorAspect
component:
(SpecCollection
collection: (
- (LabelSpec
- label: 'Run tests first!!'
- name: 'ResultName'
- layout: (LayoutFrame 22 0 0 0 0 1 -10 1)
- backgroundChannel: resultBackgroundColorAspect
- foregroundChannel: resultTextForegroundColorAspect
- foregroundColor: (Color 100.0 100.0 100.0)
- translateLabel: true
- labelChannel: resultNameAspect
- adjust: left
- )
(ActionButtonSpec
name: 'Button3'
layout: (LayoutFrame 5 0 3 0 21 0 17 0)
activeHelpKey: pin
+ uuid: 'e98276b0-50a4-11e9-a55c-b8f6b1108e05'
level: 0
visibilityChannel: pinButtonVisibleHolder
backgroundChannel: resultBackgroundColorAspect
@@ -260,15 +256,49 @@
labelChannel: pinIcon
model: pin
)
+ (LabelSpec
+ label: 'Run tests first!!'
+ name: 'ResultName'
+ layout: (LayoutFrame 22 0 -2 0 0 1 -12 1)
+ uuid: 'e9827a5c-50a4-11e9-a55c-b8f6b1108e05'
+ backgroundChannel: resultBackgroundColorAspect
+ foregroundChannel: resultTextForegroundColorAspect
+ foregroundColor: (Color 100.0 100.0 100.0)
+ translateLabel: true
+ labelChannel: resultNameAspect
+ adjust: left
+ )
+ (ViewSpec
+ name: 'ProgressPanel'
+ layout: (LayoutFrame 0 0 -12 1 0 1.0 -6 1)
+ uuid: 'e9827c6e-50a4-11e9-a55c-b8f6b1108e05'
+ initiallyInvisible: true
+ visibilityChannel: progressIndicatorShownHolder
+ backgroundChannel: resultBackgroundColorAspect
+ component:
+ (SpecCollection
+ collection: (
+ (ProgressIndicatorSpec
+ name: 'ProgressIndicator1'
+ layout: (LayoutFrame 5 0 0 0 -5 1 0 1)
+ uuid: 'e9827d90-50a4-11e9-a55c-b8f6b1108e05'
+ model: progressHolder
+ postBuildCallback: postBuildProgressIndicator:
+ )
+ )
+
+ )
+ )
)
)
- extent: (Point 219 31)
+ extent: (Point 206 31)
)
(ActionButtonSpec
label: 'Debug'
name: 'DebugButton'
activeHelpKey: debugSelected
+ uuid: 'e982804c-50a4-11e9-a55c-b8f6b1108e05'
translateLabel: true
model: debug
enableChannel: runEnabledHolder
@@ -278,6 +308,7 @@
label: 'Stop'
name: 'Button2'
activeHelpKey: stopRun
+ uuid: 'e98281fa-50a4-11e9-a55c-b8f6b1108e05'
visibilityChannel: runningHolder
translateLabel: true
model: stop
@@ -287,6 +318,7 @@
label: 'Run'
name: 'Run'
activeHelpKey: runSelected
+ uuid: 'e98283a8-50a4-11e9-a55c-b8f6b1108e05'
visibilityChannel: notRunningHolder
translateLabel: true
model: run
@@ -297,6 +329,7 @@
label: 'Failed'
name: 'Button1'
activeHelpKey: runFailed
+ uuid: 'e982852e-50a4-11e9-a55c-b8f6b1108e05'
visibilityChannel: runFailedButtonVisibleHolder
translateLabel: true
model: runFailed
@@ -307,6 +340,7 @@
label: 'Run All'
name: 'RunAll'
activeHelpKey: runAll
+ uuid: 'e9828696-50a4-11e9-a55c-b8f6b1108e05'
visibilityChannel: runAllButtonVisibleHolder
translateLabel: true
model: runAll
@@ -317,6 +351,7 @@
label: 'Coverage'
name: 'Button4'
activeHelpKey: runAllWithCoverage
+ uuid: 'e98287fe-50a4-11e9-a55c-b8f6b1108e05'
visibilityChannel: runAllButtonVisibleHolder
translateLabel: true
model: runAllWithCoverage
@@ -332,31 +367,13 @@
name: 'ResultInfo'
layout: (LayoutFrame 0 0 -20 1 0 1 0 1)
style: (FontDescription helvetica medium roman 10 #'iso10646-1' nil nil)
+ uuid: 'e9828984-50a4-11e9-a55c-b8f6b1108e05'
backgroundChannel: resultBackgroundColorAspect
foregroundChannel: resultTextForegroundColorAspect
translateLabel: true
labelChannel: resultInfoAspect
adjust: left
)
- (ViewSpec
- name: 'ProgressPanel'
- layout: (LayoutFrame 0 0.75 -17 1 -3 1.0 -5 1)
- initiallyInvisible: true
- visibilityChannel: progressIndicatorShownHolder
- backgroundChannel: resultBackgroundColorAspect
- component:
- (SpecCollection
- collection: (
- (ProgressIndicatorSpec
- name: 'RunningProgress'
- layout: (LayoutFrame 5 0 0 0 -5 1 0 1)
- model: progressHolder
- postBuildCallback: postBuildProgressIndicator:
- )
- )
-
- )
- )
)
)
@@ -506,22 +523,6 @@
!TestRunnerMini methodsFor:'actions'!
-allCoveredClasses
- "return a collection of classes which are covered by the selected
- tests. Requires that the testcase returns a non-empty collection
- from the coveredClasses query"
-
- |testedClasses suite|
-
- testedClasses := Set new.
-
- suite := self suiteForRunAll.
- suite tests do:[:eachTest |
- testedClasses addAll:(eachTest class coveredClasses).
- ].
- ^ testedClasses
-!
-
debug
"run the selected test(s), opening a debugger on error/fail.
Also executes tests which want to be skipped"
@@ -602,6 +603,9 @@
!
pin
+ "create a new pinned runner;
+ that is one in its own top window"
+
| runner screen |
runner := TestRunnerMini new.
@@ -622,6 +626,7 @@
runner open.
"Modified: / 23-09-2014 / 12:05:26 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified (comment): / 27-03-2019 / 16:11:21 / Claus Gittinger"
!
run
@@ -636,7 +641,7 @@
suite := resultHolder value suiteForRun
].
[
- self run:suite
+ self run:suite debug:false coverageContext:nil
] on:TestResult skipped do:[:ex |
ex proceed.
]
@@ -644,19 +649,22 @@
"Created: / 10-03-2010 / 19:42:08 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified: / 22-08-2011 / 09:58:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified: / 09-10-2011 / 10:56:39 / cg"
- "Modified (comment): / 23-03-2019 / 11:39:24 / Claus Gittinger"
+ "Modified: / 27-03-2019 / 16:16:26 / Claus Gittinger"
!
run:suite
- ^self run: suite debug: false
+ ^self run:suite debug:false coverageContext:nil
"Created: / 11-03-2010 / 10:22:59 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified: / 09-06-2012 / 20:23:58 / cg"
"Modified: / 03-12-2012 / 13:59:26 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 27-03-2019 / 16:16:14 / Claus Gittinger"
!
run:suite debug: debug
- self run:suite debug: debug coverageContext: nil
+ self run:suite debug:debug coverageContext:nil
+
+ "Modified (format): / 27-03-2019 / 16:16:05 / Claus Gittinger"
!
run:suite debug: debug coverageContext: coverageContextOrNil
@@ -685,17 +693,22 @@
result := suite
run: result
beforeEachDo:[:test :result |
+ currentTestCaseName := (' (run: ',test getTestName allBold,')').
+ resultHolder changed.
infoHolder notNil ifTrue:[
infoHolder value:('Running "%1-%2"...'
bindWith:test name
- with:test getTestName allBold)
+ with:test getTestName allBold).
+ self window repairDamage.
]
]
afterEachDo:[:test :result |
+ currentTestCaseName := nil.
run := run + 1.
self progressHolder value:(incr * run) truncated "rounded".
infoHolder notNil ifTrue:[
- infoHolder value:('Done.')
+ infoHolder value:('Done.').
+ self window repairDamage.
].
resultHolder setValue:nil; value:suiteAndResult; changed.
]
@@ -721,6 +734,7 @@
"Created: / 03-12-2012 / 13:59:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified: / 18-02-2016 / 16:57:27 / cg"
+ "Modified: / 27-03-2019 / 16:25:24 / Claus Gittinger"
!
runAll
@@ -901,21 +915,30 @@
resultInfoAspect
^ BlockValue
- with:[:model | model isNil ifTrue:[ '' ] ifFalse:[ model info ] ]
+ with:[:model |
+ model isNil
+ ifTrue:[ '' ]
+ ifFalse:[ model info,(currentTestCaseName ? '') ]
+ ]
argument:resultHolder
"Created: / 15-03-2010 / 20:22:44 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified: / 02-08-2011 / 18:20:26 / cg"
+ "Modified: / 27-03-2019 / 16:19:23 / Claus Gittinger"
!
resultNameAspect
- ^ BlockValue
- with:[:model | model isNil ifTrue:[ 'Run the tests!!' ] ifFalse:[ model name ] ]
- argument:resultHolder
+ resultNameAspect isNil ifTrue:[
+ resultNameAspect := BlockValue
+ with:[:model | model isNil ifTrue:[ 'Run the tests!!' ] ifFalse:[ model name ] ]
+ argument:resultHolder.
+ ].
+ ^ resultNameAspect
"Created: / 15-03-2010 / 14:57:10 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified: / 15-03-2010 / 20:17:52 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified: / 02-08-2011 / 18:20:38 / cg"
+ "Modified: / 27-03-2019 / 16:09:41 / Claus Gittinger"
!
resultTextForegroundColorAspect
@@ -1025,7 +1048,7 @@
aspect == #lastTestRunResult ifTrue:[
allTestCases notNil ifTrue:[
(allTestCases includesIdentical: param first) ifTrue:[
- self invalidateSuiteAndResult. "/ updateTestSuiteAndResult.
+ self invalidateSuiteAndResult. "/ updateSuiteAndResult.
self enqueueDelayedAction:[ self updateSuiteAndResult ].
^self
]
@@ -1035,6 +1058,7 @@
super update:aspect with:param from:sender
"Modified: / 23-09-2014 / 10:23:28 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified (comment): / 27-03-2019 / 16:14:24 / Claus Gittinger"
!
updateSuiteAndResult
@@ -1061,18 +1085,25 @@
!
updateTestSuiteAndResult
- | suite suiteAndResult |
+ <resource: #obsolete>
+ "/ ouch: duplicate code
- self runningHolder value ifTrue:[^self].
- allTestCases isEmptyOrNil ifTrue:[^self].
- suiteAndResult := SuiteAndResult
- suite: (suite := self suiteForRun)
- result: (self resultForSuite: suite).
- resultHolder value: suiteAndResult.
+ ^ self updateSuiteAndResult
+"/ | suite suiteAndResult |
+"/
+"/ self runningHolder value ifTrue:[^self].
+"/ allTestCases isEmptyOrNil ifTrue:[^self].
+"/
+"/ suite := self suiteForRun.
+"/ suiteAndResult := SuiteAndResult
+"/ suite: suite
+"/ result: (self resultForSuite: suite).
+"/ resultHolder value: suiteAndResult.
"Created: / 15-03-2010 / 19:41:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified: / 15-03-2010 / 20:55:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified: / 04-06-2012 / 19:03:15 / cg"
+ "Modified: / 27-03-2019 / 16:15:00 / Claus Gittinger"
!
updateVisibility
@@ -1141,6 +1172,22 @@
!TestRunnerMini methodsFor:'queries'!
+allCoveredClasses
+ "return a collection of classes which are covered by the selected
+ tests. Requires that the testcase returns a non-empty collection
+ from the coveredClasses query"
+
+ |testedClasses suite|
+
+ testedClasses := Set new.
+
+ suite := self suiteForRunAll.
+ suite tests do:[:eachTest |
+ testedClasses addAll:(eachTest class coveredClasses).
+ ].
+ ^ testedClasses
+!
+
hasTestCaseSelected
^self allTestCases notEmptyOrNil