modularity goals (was: The Trunk: ToolBuilderTests-fbs.1.mcz)

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

modularity goals (was: The Trunk: ToolBuilderTests-fbs.1.mcz)

Chris Muller-3
There has been a great effort headed up by Frank to organize behaviors
into a hierarchy of packages with no cyclic dependencies.  This is a
great goal and great effort.

But the introduction of this new package (with just two classes)
prompts a need to understand what _all_ the goals are for this
process.  Certainly, everyone agrees we want no cyclic dependencies
between packages.

But this extraction doesn't help that.  Nothing will ever depend on
ToolBuilderTests, so how does this new leaf of the package-dependency
hierarchy, justify its existence in cyberspace?

Getting SUnit completely out of the image will mean ALL packages must
be split between their "-Kernel" and "-Tests" components.  Is that the
plan?

I'm not necessarily against it -- I'm just having trouble articulating
what's wrong with co-location of a package's tests, with the package
itself, and it depending on SUnit vs. not.  SUnit is not that big and
depends on nothing but Core.



On Sat, Dec 7, 2013 at 1:49 PM,  <[hidden email]> wrote:

> Frank Shearar uploaded a new version of ToolBuilderTests to project The Trunk:
> http://source.squeak.org/trunk/ToolBuilderTests-fbs.1.mcz
>
> ==================== Summary ====================
>
> Name: ToolBuilderTests-fbs.1
> Author: fbs
> Time: 7 December 2013, 7:47:14.931 pm
> UUID: f75a55b6-ea0a-4b43-bf08-dfcf82dc99fb
> Ancestors:
>
> ToolBuilder SUnit tests.
>
> ==================== Snapshot ====================
>
> SystemOrganization addCategory: #ToolBuilderTests!
>
> TestCase subclass: #PluggableMenuItemSpecTests
>         instanceVariableNames: ''
>         classVariableNames: ''
>         poolDictionaries: ''
>         category: 'ToolBuilderTests'!
>
> ----- Method: PluggableMenuItemSpecTests>>testBeCheckableMakesItemCheckable (in category 'as yet unclassified') -----
> testBeCheckableMakesItemCheckable
>         | itemSpec |
>         itemSpec := PluggableMenuItemSpec new.
>         itemSpec beCheckable.
>         self assert: itemSpec isCheckable description: 'Item not checkable'.!
>
> ----- Method: PluggableMenuItemSpecTests>>testByDefaultNotCheckable (in category 'as yet unclassified') -----
> testByDefaultNotCheckable
>         | itemSpec |
>         itemSpec := PluggableMenuItemSpec new.
>         self deny: itemSpec isCheckable.!
>
> ----- Method: PluggableMenuItemSpecTests>>testNoMarkerMakesItemChecked (in category 'as yet unclassified') -----
> testNoMarkerMakesItemChecked
>         | itemSpec |
>         itemSpec := PluggableMenuItemSpec new.
>         itemSpec label: '<no>no'.
>         itemSpec analyzeLabel.
>         self assert: itemSpec isCheckable description: 'item not checkable'.
>         self deny: itemSpec checked description: 'item checked'.!
>
> ----- Method: PluggableMenuItemSpecTests>>testOffMarkerMakesItemChecked (in category 'as yet unclassified') -----
> testOffMarkerMakesItemChecked
>         | itemSpec |
>         itemSpec := PluggableMenuItemSpec new.
>         itemSpec label: '<off>off'.
>         itemSpec analyzeLabel.
>         self assert: itemSpec isCheckable description: 'item not checkable'.
>         self deny: itemSpec checked description: 'item checked'.!
>
> ----- Method: PluggableMenuItemSpecTests>>testOnMarkerMakesItemChecked (in category 'as yet unclassified') -----
> testOnMarkerMakesItemChecked
>         | itemSpec |
>         itemSpec := PluggableMenuItemSpec new.
>         itemSpec label: '<on>on'.
>         itemSpec analyzeLabel.
>         self assert: itemSpec isCheckable description: 'item not checkable'.
>         self assert: itemSpec isCheckable description: 'item not checked'.!
>
> ----- Method: PluggableMenuItemSpecTests>>testYesMarkerMakesItemChecked (in category 'as yet unclassified') -----
> testYesMarkerMakesItemChecked
>         | itemSpec |
>         itemSpec := PluggableMenuItemSpec new.
>         itemSpec label: '<yes>on'.
>         itemSpec analyzeLabel.
>         self assert: itemSpec isCheckable description: 'item not checkable'.
>         self assert: itemSpec isCheckable description: 'item not checked'.!
>
> TestCase subclass: #ToolBuilderTests
>         instanceVariableNames: 'builder widget queries'
>         classVariableNames: ''
>         poolDictionaries: ''
>         category: 'ToolBuilderTests'!
>
> !ToolBuilderTests commentStamp: 'ar 2/11/2005 15:01' prior: 0!
> Some tests to make sure ToolBuilder does what it says.!
>
> ----- Method: ToolBuilderTests class>>isAbstract (in category 'testing') -----
> isAbstract
>         ^self == ToolBuilderTests!
>
> ----- Method: ToolBuilderTests>>acceptWidgetText (in category 'support') -----
> acceptWidgetText
>         "accept text in widget"
>         ^ self subclassResponsibility!
>
> ----- Method: ToolBuilderTests>>assertItemFiresWith: (in category 'tests-menus') -----
> assertItemFiresWith: aBlock
>         | spec |
>         spec := builder pluggableMenuSpec new.
>         spec model: self.
>         aBlock value: spec.
>         widget := builder build: spec.
>         queries := IdentitySet new.
>         self fireMenuItemWidget.
>         self assert: (queries includes: #fireMenuAction)!
>
> ----- Method: ToolBuilderTests>>buttonWidgetEnabled (in category 'support') -----
> buttonWidgetEnabled
>         "Answer whether the current widget (a button) is currently enabled"
>
>         ^ widget getModelState!
>
> ----- Method: ToolBuilderTests>>changeListWidget (in category 'support') -----
> changeListWidget
>         "Change the list widget's selection index"
>         self subclassResponsibility!
>
> ----- Method: ToolBuilderTests>>expectedButtonSideEffects (in category 'support') -----
> expectedButtonSideEffects
>         "side effect queries we expect to see on buttons"
>         ^#()!
>
> ----- Method: ToolBuilderTests>>fireButton (in category 'tests-button') -----
> fireButton
>         queries add: #fireButton.!
>
> ----- Method: ToolBuilderTests>>fireButtonWidget (in category 'support') -----
> fireButtonWidget
>         "Fire the widget, e.g., perform what is needed for the guy to trigger its action"
>         self subclassResponsibility!
>
> ----- Method: ToolBuilderTests>>fireMenuAction (in category 'tests-menus') -----
> fireMenuAction
>         queries add: #fireMenuAction!
>
> ----- Method: ToolBuilderTests>>fireMenuItemWidget (in category 'tests-menus') -----
> fireMenuItemWidget
>         self subclassResponsibility!
>
> ----- Method: ToolBuilderTests>>getChildren (in category 'tests-panel') -----
> getChildren
>         queries add: #getChildren.
>         ^#()!
>
> ----- Method: ToolBuilderTests>>getChildrenOf: (in category 'tests-trees') -----
> getChildrenOf: item
>         queries add: #getChildrenOf.
>         ^(1 to: 9) asArray!
>
> ----- Method: ToolBuilderTests>>getColor (in category 'tests-text') -----
> getColor
>         queries add: #getColor.
>         ^Color tan!
>
> ----- Method: ToolBuilderTests>>getEnabled (in category 'tests-button') -----
> getEnabled
>         queries add: #getEnabled.
>         ^true!
>
> ----- Method: ToolBuilderTests>>getHelpOf: (in category 'tests-trees') -----
> getHelpOf: item
>         ^'help'!
>
> ----- Method: ToolBuilderTests>>getIconOf: (in category 'tests-trees') -----
> getIconOf: item
>         queries add: #getIconOf.
>         ^nil!
>
> ----- Method: ToolBuilderTests>>getLabel (in category 'tests-button') -----
> getLabel
>         queries add: #getLabel.
>         ^'TestLabel'!
>
> ----- Method: ToolBuilderTests>>getLabelOf: (in category 'tests-trees') -----
> getLabelOf: item
>         queries add: #getLabelOf.
>         ^item asString!
>
> ----- Method: ToolBuilderTests>>getList (in category 'tests-lists') -----
> getList
>         queries add: #getList.
>         ^(1 to: 100) collect:[:i| i printString].!
>
> ----- Method: ToolBuilderTests>>getListIndex (in category 'tests-lists') -----
> getListIndex
>         queries add: #getListIndex.
>         ^13!
>
> ----- Method: ToolBuilderTests>>getListSelection (in category 'tests-lists') -----
> getListSelection
>         queries add: #getListSelection.
>         ^'55'!
>
> ----- Method: ToolBuilderTests>>getMenu: (in category 'tests-lists') -----
> getMenu: aMenu
>         queries add: #getMenu.
>         ^aMenu!
>
> ----- Method: ToolBuilderTests>>getRoots (in category 'tests-trees') -----
> getRoots
>         queries add: #getRoots.
>         ^(1 to: 9) asArray!
>
> ----- Method: ToolBuilderTests>>getState (in category 'tests-button') -----
> getState
>         queries add: #getState.
>         ^true!
>
> ----- Method: ToolBuilderTests>>getText (in category 'tests-text') -----
> getText
>         queries add: #getText.
>         ^Text new!
>
> ----- Method: ToolBuilderTests>>getTextSelection (in category 'tests-text') -----
> getTextSelection
>         queries add: #getTextSelection.
>         ^(1 to: 0)!
>
> ----- Method: ToolBuilderTests>>getTreeSelectionPath (in category 'tests-trees') -----
> getTreeSelectionPath
>         queries add: #getTreeSelectionPath.
>         ^{2. 4. 3}!
>
> ----- Method: ToolBuilderTests>>hasChildren: (in category 'tests-trees') -----
> hasChildren: item
>         queries add: #hasChildren.
>         ^true!
>
> ----- Method: ToolBuilderTests>>keyPress: (in category 'tests-lists') -----
> keyPress: key
>         queries add: #keyPress.!
>
> ----- Method: ToolBuilderTests>>makeButton (in category 'tests-button') -----
> makeButton
>         | spec |
>         spec := self makeButtonSpec.
>         widget := builder build: spec.
>         ^widget!
>
> ----- Method: ToolBuilderTests>>makeButtonSpec (in category 'tests-button') -----
> makeButtonSpec
>         | spec |
>         spec := builder pluggableButtonSpec new.
>         spec name: #button.
>         spec model: self.
>         spec label: #getLabel.
>         spec color: #getColor.
>         spec state: #getState.
>         spec enabled: #getEnabled.
>         ^spec!
>
> ----- Method: ToolBuilderTests>>makeInputField (in category 'tests-input') -----
> makeInputField
>         | spec |
>         spec := self makeInputFieldSpec.
>         widget := builder build: spec.!
>
> ----- Method: ToolBuilderTests>>makeInputFieldSpec (in category 'tests-input') -----
> makeInputFieldSpec
>         | spec |
>         spec := builder pluggableInputFieldSpec new.
>         spec name: #input.
>         spec model: self.
>         spec getText: #getText.
>         spec selection: #getTextSelection.
>         spec color: #getColor.
>         "<-- the following cannot be tested very well -->"
>         spec setText: #setText:.
>         spec menu: #getMenu:.
>         ^spec!
>
> ----- Method: ToolBuilderTests>>makeItemList (in category 'tests-lists') -----
> makeItemList
>         | spec |
>         spec := self makeItemListSpec.
>         widget := builder build: spec.!
>
> ----- Method: ToolBuilderTests>>makeItemListSpec (in category 'tests-lists') -----
> makeItemListSpec
>         | spec |
>         spec := builder pluggableListSpec new.
>         spec name: #list.
>         spec model: self.
>         spec list: #getList.
>         spec getSelected: #getListSelection.
>         "<-- the following cannot be tested very well -->"
>         spec setSelected: #setListSelection:.
>         spec menu: #getMenu:.
>         spec keyPress: #keyPress:.
>         ^spec!
>
> ----- Method: ToolBuilderTests>>makeList (in category 'tests-lists') -----
> makeList
>         | spec |
>         spec := self makeListSpec.
>         widget := builder build: spec.!
>
> ----- Method: ToolBuilderTests>>makeListSpec (in category 'tests-lists') -----
> makeListSpec
>         | spec |
>         spec := builder pluggableListSpec new.
>         spec name: #list.
>         spec model: self.
>         spec list: #getList.
>         spec getIndex: #getListIndex.
>         "<-- the following cannot be tested very well -->"
>         spec setIndex: #setListIndex:.
>         spec menu: #getMenu:.
>         spec keyPress: #keyPress:.
>         ^spec!
>
> ----- Method: ToolBuilderTests>>makePanel (in category 'tests-panel') -----
> makePanel
>         | spec |
>         spec := self makePanelSpec.
>         widget := builder build: spec.!
>
> ----- Method: ToolBuilderTests>>makePanelSpec (in category 'tests-panel') -----
> makePanelSpec
>         | spec |
>         spec := builder pluggablePanelSpec new.
>         spec name: #panel.
>         spec model: self.
>         spec children: #getChildren.
>         ^spec!
>
> ----- Method: ToolBuilderTests>>makeText (in category 'tests-text') -----
> makeText
>         | spec |
>         spec := self makeTextSpec.
>         widget := builder build: spec.!
>
> ----- Method: ToolBuilderTests>>makeTextSpec (in category 'tests-text') -----
> makeTextSpec
>         | spec |
>         spec := builder pluggableTextSpec new.
>         spec name: #text.
>         spec model: self.
>         spec getText: #getText.
>         spec selection: #getTextSelection.
>         spec color: #getColor.
>         "<-- the following cannot be tested very well -->"
>         spec setText: #setText:.
>         spec menu: #getMenu:.
>         ^spec!
>
> ----- Method: ToolBuilderTests>>makeTree (in category 'tests-trees') -----
> makeTree
>         | spec |
>         spec := self makeTreeSpec.
>         widget := builder build: spec.!
>
> ----- Method: ToolBuilderTests>>makeTreeSpec (in category 'tests-trees') -----
> makeTreeSpec
>         | spec |
>         spec := builder pluggableTreeSpec new.
>         spec name: #tree.
>         spec model: self.
>         spec roots: #getRoots.
>         "<-- the following cannot be tested very well -->"
>         spec getSelectedPath: #getTreeSelectionPath.
>         spec getChildren: #getChildrenOf:.
>         spec hasChildren: #hasChildren:.
>         spec label: #getLabelOf:.
>         spec icon: #getIconOf:.
>         spec help: #getHelpOf:.
>         spec setSelected: #setTreeSelection:.
>         spec menu: #getMenu:.
>         spec keyPress: #keyPress:.
>         ^spec!
>
> ----- Method: ToolBuilderTests>>makeWindow (in category 'tests-window') -----
> makeWindow
>         | spec |
>         spec := self makeWindowSpec.
>         widget := builder build: spec.!
>
> ----- Method: ToolBuilderTests>>makeWindowSpec (in category 'tests-window') -----
> makeWindowSpec
>         | spec |
>         spec := builder pluggableWindowSpec new.
>         spec name: #window.
>         spec model: self.
>         spec children: #getChildren.
>         spec label: #getLabel.
>         spec closeAction: #noteWindowClosed.
>         ^spec!
>
> ----- Method: ToolBuilderTests>>noteWindowClosed (in category 'tests-window') -----
> noteWindowClosed
>         queries add: #noteWindowClosed.!
>
> ----- Method: ToolBuilderTests>>openWindow (in category 'tests-window') -----
> openWindow
>         | spec |
>         spec := self makeWindowSpec.
>         widget := builder open: spec.!
>
> ----- Method: ToolBuilderTests>>returnFalse (in category 'support') -----
> returnFalse
>         ^false!
>
> ----- Method: ToolBuilderTests>>returnTrue (in category 'support') -----
> returnTrue
>         ^true!
>
> ----- Method: ToolBuilderTests>>setListIndex: (in category 'tests-lists') -----
> setListIndex: index
>         queries add: #setListIndex.!
>
> ----- Method: ToolBuilderTests>>setListSelection: (in category 'tests-lists') -----
> setListSelection: newIndex
>         queries add: #setListSelection.!
>
> ----- Method: ToolBuilderTests>>setText: (in category 'tests-text') -----
> setText: newText
>         queries add: #setText.
>         ^false!
>
> ----- Method: ToolBuilderTests>>setTreeSelection: (in category 'tests-trees') -----
> setTreeSelection: node
>         queries add: #setTreeSelection.!
>
> ----- Method: ToolBuilderTests>>setUp (in category 'support') -----
> setUp
>         queries := IdentitySet new.!
>
> ----- Method: ToolBuilderTests>>shutDown (in category 'support') -----
> shutDown
>         self myDependents: nil!
>
> ----- Method: ToolBuilderTests>>testAddTargetSelectorArgumentList (in category 'tests-menus') -----
> testAddTargetSelectorArgumentList
>         self assertItemFiresWith:
>                 [:spec | spec
>                                 add: 'Menu Item'
>                                 target: self
>                                 selector: #fireMenuAction
>                                 argumentList: #()]!
>
> ----- Method: ToolBuilderTests>>testButtonFiresBlock (in category 'tests-button') -----
> testButtonFiresBlock
>         | spec |
>         spec := builder pluggableButtonSpec new.
>         spec model: self.
>         spec action: [self fireButton].
>         widget := builder build: spec.
>         queries := IdentitySet new.
>         self fireButtonWidget.
>         self assert: (queries includes: #fireButton).!
>
> ----- Method: ToolBuilderTests>>testButtonFiresMessage (in category 'tests-button') -----
> testButtonFiresMessage
>         | spec |
>         spec := builder pluggableButtonSpec new.
>         spec model: self.
>         spec action: (MessageSend receiver: self selector: #fireButton arguments: #()).
>         widget := builder build: spec.
>         queries := IdentitySet new.
>         self fireButtonWidget.
>         self assert: (queries includes: #fireButton).!
>
> ----- Method: ToolBuilderTests>>testButtonFiresSymbol (in category 'tests-button') -----
> testButtonFiresSymbol
>         | spec |
>         spec := builder pluggableButtonSpec new.
>         spec model: self.
>         spec action: #fireButton.
>         widget := builder build: spec.
>         queries := IdentitySet new.
>         self fireButtonWidget.
>         self assert: (queries includes: #fireButton).!
>
> ----- Method: ToolBuilderTests>>testButtonInitiallyDisabled (in category 'tests-button') -----
> testButtonInitiallyDisabled
>         | spec |
>         spec := builder pluggableButtonSpec new.
>         spec model: self.
>         spec label: #getLabel.
>         spec color: #getColor.
>         spec state: #getState.
>         spec enabled: #returnFalse.
>         widget := builder build: spec.
>         self deny: (self buttonWidgetEnabled)!
>
> ----- Method: ToolBuilderTests>>testButtonInitiallyDisabledSelector (in category 'tests-button') -----
> testButtonInitiallyDisabledSelector
>         | spec |
>         spec := builder pluggableButtonSpec new.
>         spec model: self.
>         spec label: #getLabel.
>         spec color: #getColor.
>         spec state: #getState.
>         spec enabled: #returnFalse.
>         widget := builder build: spec.
>         self deny: (self buttonWidgetEnabled)!
>
> ----- Method: ToolBuilderTests>>testButtonInitiallyEnabled (in category 'tests-button') -----
> testButtonInitiallyEnabled
>         | spec |
>         spec := builder pluggableButtonSpec new.
>         spec model: self.
>         spec label: #getLabel.
>         spec color: #getColor.
>         spec state: #getState.
>         spec enabled: #returnTrue.
>         widget := builder build: spec.
>         self assert: (self buttonWidgetEnabled)!
>
> ----- Method: ToolBuilderTests>>testButtonInitiallyEnabledSelector (in category 'tests-button') -----
> testButtonInitiallyEnabledSelector
>         | spec |
>         spec := builder pluggableButtonSpec new.
>         spec model: self.
>         spec label: #getLabel.
>         spec color: #getColor.
>         spec state: #getState.
>         spec enabled: #returnTrue.
>         widget := builder build: spec.
>         self assert: (self buttonWidgetEnabled)!
>
> ----- Method: ToolBuilderTests>>testButtonWidgetID (in category 'tests-button') -----
> testButtonWidgetID
>         self makeButton.
>         self assert: (builder widgetAt: #button) == widget.!
>
> ----- Method: ToolBuilderTests>>testGetButtonColor (in category 'tests-button') -----
> testGetButtonColor
>         self makeButton.
>         queries := IdentitySet new.
>         self changed: #getColor.
>         self assert: (queries includes: #getColor).
>         self assert: self widgetColor = self getColor.!
>
> ----- Method: ToolBuilderTests>>testGetButtonEnabled (in category 'tests-button') -----
> testGetButtonEnabled
>         self makeButton.
>         queries := IdentitySet new.
>         self changed: #getEnabled.
>         self assert: (queries includes: #getEnabled).!
>
> ----- Method: ToolBuilderTests>>testGetButtonLabel (in category 'tests-button') -----
> testGetButtonLabel
>         self makeButton.
>         queries := IdentitySet new.
>         self changed: #getLabel.
>         self assert: (queries includes: #getLabel).!
>
> ----- Method: ToolBuilderTests>>testGetButtonSideEffects (in category 'tests-button') -----
> testGetButtonSideEffects
>         self makeButton.
>         queries := IdentitySet new.
>         self changed: #testSignalWithNoDiscernableEffect.
>         self expectedButtonSideEffects do:[:sym|
>                 self assert: (queries includes: sym).
>                 queries remove: sym.
>         ].
>         self assert: queries isEmpty.!
>
> ----- Method: ToolBuilderTests>>testGetButtonState (in category 'tests-button') -----
> testGetButtonState
>         self makeButton.
>         queries := IdentitySet new.
>         self changed: #getState.
>         self assert: (queries includes: #getState).!
>
> ----- Method: ToolBuilderTests>>testGetInputFieldColor (in category 'tests-input') -----
> testGetInputFieldColor
>         self makeInputField.
>         queries := IdentitySet new.
>         self changed: #getColor.
>         self assert: (queries includes: #getColor).
>         self assert: self widgetColor = self getColor.!
>
> ----- Method: ToolBuilderTests>>testGetInputFieldSelection (in category 'tests-input') -----
> testGetInputFieldSelection
>         self makeInputField.
>         queries := IdentitySet new.
>         self changed: #getTextSelection.
>         self assert: (queries includes: #getTextSelection).!
>
> ----- Method: ToolBuilderTests>>testGetInputFieldSideEffectFree (in category 'tests-input') -----
> testGetInputFieldSideEffectFree
>         self makeInputField.
>         queries := IdentitySet new.
>         self changed: #testSignalWithNoDiscernableEffect.
>         self assert: queries isEmpty.!
>
> ----- Method: ToolBuilderTests>>testGetInputFieldText (in category 'tests-input') -----
> testGetInputFieldText
>         self makeInputField.
>         queries := IdentitySet new.
>         self changed: #getText.
>         self assert: (queries includes: #getText).!
>
> ----- Method: ToolBuilderTests>>testGetItemListSideEffectFree (in category 'tests-lists') -----
> testGetItemListSideEffectFree
>         self makeItemList.
>         queries := IdentitySet new.
>         self changed: #testSignalWithNoDiscernableEffect.
>         self assert: queries isEmpty.!
>
> ----- Method: ToolBuilderTests>>testGetList (in category 'tests-lists') -----
> testGetList
>         self makeList.
>         queries := IdentitySet new.
>         self changed: #getList.
>         self assert: (queries includes: #getList).!
>
> ----- Method: ToolBuilderTests>>testGetListIndex (in category 'tests-lists') -----
> testGetListIndex
>         self makeList.
>         queries := IdentitySet new.
>         self changed: #getListIndex.
>         self assert: (queries includes: #getListIndex).!
>
> ----- Method: ToolBuilderTests>>testGetListSelection (in category 'tests-lists') -----
> testGetListSelection
>         self makeItemList.
>         queries := IdentitySet new.
>         self changed: #getListSelection.
>         self assert: (queries includes: #getListSelection).!
>
> ----- Method: ToolBuilderTests>>testGetListSideEffectFree (in category 'tests-lists') -----
> testGetListSideEffectFree
>         self makeList.
>         queries := IdentitySet new.
>         self changed: #testSignalWithNoDiscernableEffect.
>         self assert: queries isEmpty.!
>
> ----- Method: ToolBuilderTests>>testGetPanelChildren (in category 'tests-panel') -----
> testGetPanelChildren
>         self makePanel.
>         queries := IdentitySet new.
>         self changed: #getChildren.
>         self assert: (queries includes: #getChildren).!
>
> ----- Method: ToolBuilderTests>>testGetPanelSideEffectFree (in category 'tests-panel') -----
> testGetPanelSideEffectFree
>         self makePanel.
>         queries := IdentitySet new.
>         self changed: #testSignalWithNoDiscernableEffect.
>         self assert: queries isEmpty.!
>
> ----- Method: ToolBuilderTests>>testGetText (in category 'tests-text') -----
> testGetText
>         self makeText.
>         queries := IdentitySet new.
>         self changed: #getText.
>         self assert: (queries includes: #getText).!
>
> ----- Method: ToolBuilderTests>>testGetTextColor (in category 'tests-text') -----
> testGetTextColor
>         self makeText.
>         queries := IdentitySet new.
>         self changed: #getColor.
>         self assert: (queries includes: #getColor).
>         self assert: self widgetColor = self getColor.!
>
> ----- Method: ToolBuilderTests>>testGetTextSelection (in category 'tests-text') -----
> testGetTextSelection
>         self makeText.
>         queries := IdentitySet new.
>         self changed: #getTextSelection.
>         self assert: (queries includes: #getTextSelection).!
>
> ----- Method: ToolBuilderTests>>testGetTextSideEffectFree (in category 'tests-text') -----
> testGetTextSideEffectFree
>         self makeText.
>         queries := IdentitySet new.
>         self changed: #testSignalWithNoDiscernableEffect.
>         self assert: queries isEmpty.!
>
> ----- Method: ToolBuilderTests>>testGetWindowChildren (in category 'tests-window') -----
> testGetWindowChildren
>         self makeWindow.
>         queries := IdentitySet new.
>         self changed: #getChildren.
>         self assert: (queries includes: #getChildren).!
>
> ----- Method: ToolBuilderTests>>testGetWindowLabel (in category 'tests-window') -----
> testGetWindowLabel
>         self makeWindow.
>         queries := IdentitySet new.
>         self changed: #getLabel.
>         self assert: (queries includes: #getLabel).!
>
> ----- Method: ToolBuilderTests>>testGetWindowSideEffectFree (in category 'tests-window') -----
> testGetWindowSideEffectFree
>         self makeWindow.
>         queries := IdentitySet new.
>         self changed: #testSignalWithNoDiscernableEffect.
>         self assert: queries isEmpty.!
>
> ----- Method: ToolBuilderTests>>testInputWidgetID (in category 'tests-input') -----
> testInputWidgetID
>         self makeInputField.
>         self assert: (builder widgetAt: #input) == widget.!
>
> ----- Method: ToolBuilderTests>>testItemListWidgetID (in category 'tests-lists') -----
> testItemListWidgetID
>         self makeItemList.
>         self assert: (builder widgetAt: #list) == widget.!
>
> ----- Method: ToolBuilderTests>>testListWidgetID (in category 'tests-lists') -----
> testListWidgetID
>         self makeList.
>         self assert: (builder widgetAt: #list) == widget.!
>
> ----- Method: ToolBuilderTests>>testPanelWidgetID (in category 'tests-panel') -----
> testPanelWidgetID
>         self makePanel.
>         self assert: (builder widgetAt: #panel) == widget.!
>
> ----- Method: ToolBuilderTests>>testSetInputField (in category 'tests-input') -----
> testSetInputField
>         self makeInputField.
>         queries := IdentitySet new.
>         self acceptWidgetText.
>         self assert: (queries includes: #setText).!
>
> ----- Method: ToolBuilderTests>>testSetListIndex (in category 'tests-lists') -----
> testSetListIndex
>         self makeList.
>         queries := IdentitySet new.
>         self changeListWidget.
>         self assert: (queries includes: #setListIndex).!
>
> ----- Method: ToolBuilderTests>>testSetListSelection (in category 'tests-lists') -----
> testSetListSelection
>         self makeItemList.
>         queries := IdentitySet new.
>         self changeListWidget.
>         self assert: (queries includes: #setListSelection).!
>
> ----- Method: ToolBuilderTests>>testSetText (in category 'tests-text') -----
> testSetText
>         self makeText.
>         queries := IdentitySet new.
>         self acceptWidgetText.
>         self assert: (queries includes: #setText).!
>
> ----- Method: ToolBuilderTests>>testTextWidgetID (in category 'tests-text') -----
> testTextWidgetID
>         self makeText.
>         self assert: (builder widgetAt: #text) == widget!
>
> ----- Method: ToolBuilderTests>>testTreeExpandPath (in category 'tests-trees') -----
> testTreeExpandPath
>         "@@@@: REMOVE THIS - it's a hack (changed: #openPath)"
>         self makeTree.
>         queries := IdentitySet new.
>         self changed: {#openPath. '4'. '2'. '3'}.
>         self waitTick.
>         self assert: (queries includes: #getChildrenOf).
>         self assert: (queries includes: #setTreeSelection).
>         self assert: (queries includes: #getLabelOf).
> !
>
> ----- Method: ToolBuilderTests>>testTreeExpandPathFirst (in category 'tests-trees') -----
> testTreeExpandPathFirst
>         "@@@@: REMOVE THIS - it's a hack (changed: #openPath)"
>         self makeTree.
>         queries := IdentitySet new.
>         self changed: {#openPath. '1'. '2'. '2'}.
>         self waitTick.
>         self assert: (queries includes: #getChildrenOf).
>         self assert: (queries includes: #setTreeSelection).
>         self assert: (queries includes: #getLabelOf).
> !
>
> ----- Method: ToolBuilderTests>>testTreeGetSelectionPath (in category 'tests-trees') -----
> testTreeGetSelectionPath
>         self makeTree.
>         queries := IdentitySet new.
>         self changed: #getTreeSelectionPath.
>         self waitTick.
>         self assert: (queries includes: #getTreeSelectionPath).
>         self assert: (queries includes: #getChildrenOf).
>         self assert: (queries includes: #setTreeSelection).
> !
>
> ----- Method: ToolBuilderTests>>testTreeRoots (in category 'tests-trees') -----
> testTreeRoots
>         self makeTree.
>         queries := IdentitySet new.
>         self changed: #getRoots.
>         self assert: (queries includes: #getRoots).!
>
> ----- Method: ToolBuilderTests>>testTreeWidgetID (in category 'tests-trees') -----
> testTreeWidgetID
>         self makeTree.
>         self assert: (builder widgetAt: #tree) == widget.!
>
> ----- Method: ToolBuilderTests>>testWindowCloseAction (in category 'tests-window') -----
> testWindowCloseAction
>         self openWindow.
>         builder close: widget.
>         self assert: (queries includes: #noteWindowClosed).!
>
> ----- Method: ToolBuilderTests>>testWindowID (in category 'tests-window') -----
> testWindowID
>         self makeWindow.
>         self assert: (builder widgetAt: #window) == widget.!
>
> ----- Method: ToolBuilderTests>>waitTick (in category 'support') -----
> waitTick
>         ^nil!
>
> ----- Method: ToolBuilderTests>>widgetColor (in category 'support') -----
> widgetColor
>         "Answer color from widget"
>         self subclassResponsibility
>
>         "NOTE: You can bail out if you don't know how to get the color from the widget:
>                 ^self getColor
>         will work."!
>
>

Reply | Threaded
Open this post in threaded view
|

Re: modularity goals (was: The Trunk: ToolBuilderTests-fbs.1.mcz)

Nicolas Cellier
Yes, separating tests is a good practice and already almost universal practice in current Squeak, as well as in many 3rd party packages.

If you don't want to create a specific package, then there is a blob named 'Tests' already, but I'd rather see this blob split into pieces. The reason is that if you want to test an image constructed from parts, you might want to test those parts exclusively.


2013/12/9 Chris Muller <[hidden email]>
There has been a great effort headed up by Frank to organize behaviors
into a hierarchy of packages with no cyclic dependencies.  This is a
great goal and great effort.

But the introduction of this new package (with just two classes)
prompts a need to understand what _all_ the goals are for this
process.  Certainly, everyone agrees we want no cyclic dependencies
between packages.

But this extraction doesn't help that.  Nothing will ever depend on
ToolBuilderTests, so how does this new leaf of the package-dependency
hierarchy, justify its existence in cyberspace?

Getting SUnit completely out of the image will mean ALL packages must
be split between their "-Kernel" and "-Tests" components.  Is that the
plan?

I'm not necessarily against it -- I'm just having trouble articulating
what's wrong with co-location of a package's tests, with the package
itself, and it depending on SUnit vs. not.  SUnit is not that big and
depends on nothing but Core.



On Sat, Dec 7, 2013 at 1:49 PM,  <[hidden email]> wrote:
> Frank Shearar uploaded a new version of ToolBuilderTests to project The Trunk:
> http://source.squeak.org/trunk/ToolBuilderTests-fbs.1.mcz
>
> ==================== Summary ====================
>
> Name: ToolBuilderTests-fbs.1
> Author: fbs
> Time: 7 December 2013, 7:47:14.931 pm
> UUID: f75a55b6-ea0a-4b43-bf08-dfcf82dc99fb
> Ancestors:
>
> ToolBuilder SUnit tests.
>
> ==================== Snapshot ====================
>
> SystemOrganization addCategory: #ToolBuilderTests!
>
> TestCase subclass: #PluggableMenuItemSpecTests
>         instanceVariableNames: ''
>         classVariableNames: ''
>         poolDictionaries: ''
>         category: 'ToolBuilderTests'!
>
> ----- Method: PluggableMenuItemSpecTests>>testBeCheckableMakesItemCheckable (in category 'as yet unclassified') -----
> testBeCheckableMakesItemCheckable
>         | itemSpec |
>         itemSpec := PluggableMenuItemSpec new.
>         itemSpec beCheckable.
>         self assert: itemSpec isCheckable description: 'Item not checkable'.!
>
> ----- Method: PluggableMenuItemSpecTests>>testByDefaultNotCheckable (in category 'as yet unclassified') -----
> testByDefaultNotCheckable
>         | itemSpec |
>         itemSpec := PluggableMenuItemSpec new.
>         self deny: itemSpec isCheckable.!
>
> ----- Method: PluggableMenuItemSpecTests>>testNoMarkerMakesItemChecked (in category 'as yet unclassified') -----
> testNoMarkerMakesItemChecked
>         | itemSpec |
>         itemSpec := PluggableMenuItemSpec new.
>         itemSpec label: '<no>no'.
>         itemSpec analyzeLabel.
>         self assert: itemSpec isCheckable description: 'item not checkable'.
>         self deny: itemSpec checked description: 'item checked'.!
>
> ----- Method: PluggableMenuItemSpecTests>>testOffMarkerMakesItemChecked (in category 'as yet unclassified') -----
> testOffMarkerMakesItemChecked
>         | itemSpec |
>         itemSpec := PluggableMenuItemSpec new.
>         itemSpec label: '<off>off'.
>         itemSpec analyzeLabel.
>         self assert: itemSpec isCheckable description: 'item not checkable'.
>         self deny: itemSpec checked description: 'item checked'.!
>
> ----- Method: PluggableMenuItemSpecTests>>testOnMarkerMakesItemChecked (in category 'as yet unclassified') -----
> testOnMarkerMakesItemChecked
>         | itemSpec |
>         itemSpec := PluggableMenuItemSpec new.
>         itemSpec label: '<on>on'.
>         itemSpec analyzeLabel.
>         self assert: itemSpec isCheckable description: 'item not checkable'.
>         self assert: itemSpec isCheckable description: 'item not checked'.!
>
> ----- Method: PluggableMenuItemSpecTests>>testYesMarkerMakesItemChecked (in category 'as yet unclassified') -----
> testYesMarkerMakesItemChecked
>         | itemSpec |
>         itemSpec := PluggableMenuItemSpec new.
>         itemSpec label: '<yes>on'.
>         itemSpec analyzeLabel.
>         self assert: itemSpec isCheckable description: 'item not checkable'.
>         self assert: itemSpec isCheckable description: 'item not checked'.!
>
> TestCase subclass: #ToolBuilderTests
>         instanceVariableNames: 'builder widget queries'
>         classVariableNames: ''
>         poolDictionaries: ''
>         category: 'ToolBuilderTests'!
>
> !ToolBuilderTests commentStamp: 'ar 2/11/2005 15:01' prior: 0!
> Some tests to make sure ToolBuilder does what it says.!
>
> ----- Method: ToolBuilderTests class>>isAbstract (in category 'testing') -----
> isAbstract
>         ^self == ToolBuilderTests!
>
> ----- Method: ToolBuilderTests>>acceptWidgetText (in category 'support') -----
> acceptWidgetText
>         "accept text in widget"
>         ^ self subclassResponsibility!
>
> ----- Method: ToolBuilderTests>>assertItemFiresWith: (in category 'tests-menus') -----
> assertItemFiresWith: aBlock
>         | spec |
>         spec := builder pluggableMenuSpec new.
>         spec model: self.
>         aBlock value: spec.
>         widget := builder build: spec.
>         queries := IdentitySet new.
>         self fireMenuItemWidget.
>         self assert: (queries includes: #fireMenuAction)!
>
> ----- Method: ToolBuilderTests>>buttonWidgetEnabled (in category 'support') -----
> buttonWidgetEnabled
>         "Answer whether the current widget (a button) is currently enabled"
>
>         ^ widget getModelState!
>
> ----- Method: ToolBuilderTests>>changeListWidget (in category 'support') -----
> changeListWidget
>         "Change the list widget's selection index"
>         self subclassResponsibility!
>
> ----- Method: ToolBuilderTests>>expectedButtonSideEffects (in category 'support') -----
> expectedButtonSideEffects
>         "side effect queries we expect to see on buttons"
>         ^#()!
>
> ----- Method: ToolBuilderTests>>fireButton (in category 'tests-button') -----
> fireButton
>         queries add: #fireButton.!
>
> ----- Method: ToolBuilderTests>>fireButtonWidget (in category 'support') -----
> fireButtonWidget
>         "Fire the widget, e.g., perform what is needed for the guy to trigger its action"
>         self subclassResponsibility!
>
> ----- Method: ToolBuilderTests>>fireMenuAction (in category 'tests-menus') -----
> fireMenuAction
>         queries add: #fireMenuAction!
>
> ----- Method: ToolBuilderTests>>fireMenuItemWidget (in category 'tests-menus') -----
> fireMenuItemWidget
>         self subclassResponsibility!
>
> ----- Method: ToolBuilderTests>>getChildren (in category 'tests-panel') -----
> getChildren
>         queries add: #getChildren.
>         ^#()!
>
> ----- Method: ToolBuilderTests>>getChildrenOf: (in category 'tests-trees') -----
> getChildrenOf: item
>         queries add: #getChildrenOf.
>         ^(1 to: 9) asArray!
>
> ----- Method: ToolBuilderTests>>getColor (in category 'tests-text') -----
> getColor
>         queries add: #getColor.
>         ^Color tan!
>
> ----- Method: ToolBuilderTests>>getEnabled (in category 'tests-button') -----
> getEnabled
>         queries add: #getEnabled.
>         ^true!
>
> ----- Method: ToolBuilderTests>>getHelpOf: (in category 'tests-trees') -----
> getHelpOf: item
>         ^'help'!
>
> ----- Method: ToolBuilderTests>>getIconOf: (in category 'tests-trees') -----
> getIconOf: item
>         queries add: #getIconOf.
>         ^nil!
>
> ----- Method: ToolBuilderTests>>getLabel (in category 'tests-button') -----
> getLabel
>         queries add: #getLabel.
>         ^'TestLabel'!
>
> ----- Method: ToolBuilderTests>>getLabelOf: (in category 'tests-trees') -----
> getLabelOf: item
>         queries add: #getLabelOf.
>         ^item asString!
>
> ----- Method: ToolBuilderTests>>getList (in category 'tests-lists') -----
> getList
>         queries add: #getList.
>         ^(1 to: 100) collect:[:i| i printString].!
>
> ----- Method: ToolBuilderTests>>getListIndex (in category 'tests-lists') -----
> getListIndex
>         queries add: #getListIndex.
>         ^13!
>
> ----- Method: ToolBuilderTests>>getListSelection (in category 'tests-lists') -----
> getListSelection
>         queries add: #getListSelection.
>         ^'55'!
>
> ----- Method: ToolBuilderTests>>getMenu: (in category 'tests-lists') -----
> getMenu: aMenu
>         queries add: #getMenu.
>         ^aMenu!
>
> ----- Method: ToolBuilderTests>>getRoots (in category 'tests-trees') -----
> getRoots
>         queries add: #getRoots.
>         ^(1 to: 9) asArray!
>
> ----- Method: ToolBuilderTests>>getState (in category 'tests-button') -----
> getState
>         queries add: #getState.
>         ^true!
>
> ----- Method: ToolBuilderTests>>getText (in category 'tests-text') -----
> getText
>         queries add: #getText.
>         ^Text new!
>
> ----- Method: ToolBuilderTests>>getTextSelection (in category 'tests-text') -----
> getTextSelection
>         queries add: #getTextSelection.
>         ^(1 to: 0)!
>
> ----- Method: ToolBuilderTests>>getTreeSelectionPath (in category 'tests-trees') -----
> getTreeSelectionPath
>         queries add: #getTreeSelectionPath.
>         ^{2. 4. 3}!
>
> ----- Method: ToolBuilderTests>>hasChildren: (in category 'tests-trees') -----
> hasChildren: item
>         queries add: #hasChildren.
>         ^true!
>
> ----- Method: ToolBuilderTests>>keyPress: (in category 'tests-lists') -----
> keyPress: key
>         queries add: #keyPress.!
>
> ----- Method: ToolBuilderTests>>makeButton (in category 'tests-button') -----
> makeButton
>         | spec |
>         spec := self makeButtonSpec.
>         widget := builder build: spec.
>         ^widget!
>
> ----- Method: ToolBuilderTests>>makeButtonSpec (in category 'tests-button') -----
> makeButtonSpec
>         | spec |
>         spec := builder pluggableButtonSpec new.
>         spec name: #button.
>         spec model: self.
>         spec label: #getLabel.
>         spec color: #getColor.
>         spec state: #getState.
>         spec enabled: #getEnabled.
>         ^spec!
>
> ----- Method: ToolBuilderTests>>makeInputField (in category 'tests-input') -----
> makeInputField
>         | spec |
>         spec := self makeInputFieldSpec.
>         widget := builder build: spec.!
>
> ----- Method: ToolBuilderTests>>makeInputFieldSpec (in category 'tests-input') -----
> makeInputFieldSpec
>         | spec |
>         spec := builder pluggableInputFieldSpec new.
>         spec name: #input.
>         spec model: self.
>         spec getText: #getText.
>         spec selection: #getTextSelection.
>         spec color: #getColor.
>         "<-- the following cannot be tested very well -->"
>         spec setText: #setText:.
>         spec menu: #getMenu:.
>         ^spec!
>
> ----- Method: ToolBuilderTests>>makeItemList (in category 'tests-lists') -----
> makeItemList
>         | spec |
>         spec := self makeItemListSpec.
>         widget := builder build: spec.!
>
> ----- Method: ToolBuilderTests>>makeItemListSpec (in category 'tests-lists') -----
> makeItemListSpec
>         | spec |
>         spec := builder pluggableListSpec new.
>         spec name: #list.
>         spec model: self.
>         spec list: #getList.
>         spec getSelected: #getListSelection.
>         "<-- the following cannot be tested very well -->"
>         spec setSelected: #setListSelection:.
>         spec menu: #getMenu:.
>         spec keyPress: #keyPress:.
>         ^spec!
>
> ----- Method: ToolBuilderTests>>makeList (in category 'tests-lists') -----
> makeList
>         | spec |
>         spec := self makeListSpec.
>         widget := builder build: spec.!
>
> ----- Method: ToolBuilderTests>>makeListSpec (in category 'tests-lists') -----
> makeListSpec
>         | spec |
>         spec := builder pluggableListSpec new.
>         spec name: #list.
>         spec model: self.
>         spec list: #getList.
>         spec getIndex: #getListIndex.
>         "<-- the following cannot be tested very well -->"
>         spec setIndex: #setListIndex:.
>         spec menu: #getMenu:.
>         spec keyPress: #keyPress:.
>         ^spec!
>
> ----- Method: ToolBuilderTests>>makePanel (in category 'tests-panel') -----
> makePanel
>         | spec |
>         spec := self makePanelSpec.
>         widget := builder build: spec.!
>
> ----- Method: ToolBuilderTests>>makePanelSpec (in category 'tests-panel') -----
> makePanelSpec
>         | spec |
>         spec := builder pluggablePanelSpec new.
>         spec name: #panel.
>         spec model: self.
>         spec children: #getChildren.
>         ^spec!
>
> ----- Method: ToolBuilderTests>>makeText (in category 'tests-text') -----
> makeText
>         | spec |
>         spec := self makeTextSpec.
>         widget := builder build: spec.!
>
> ----- Method: ToolBuilderTests>>makeTextSpec (in category 'tests-text') -----
> makeTextSpec
>         | spec |
>         spec := builder pluggableTextSpec new.
>         spec name: #text.
>         spec model: self.
>         spec getText: #getText.
>         spec selection: #getTextSelection.
>         spec color: #getColor.
>         "<-- the following cannot be tested very well -->"
>         spec setText: #setText:.
>         spec menu: #getMenu:.
>         ^spec!
>
> ----- Method: ToolBuilderTests>>makeTree (in category 'tests-trees') -----
> makeTree
>         | spec |
>         spec := self makeTreeSpec.
>         widget := builder build: spec.!
>
> ----- Method: ToolBuilderTests>>makeTreeSpec (in category 'tests-trees') -----
> makeTreeSpec
>         | spec |
>         spec := builder pluggableTreeSpec new.
>         spec name: #tree.
>         spec model: self.
>         spec roots: #getRoots.
>         "<-- the following cannot be tested very well -->"
>         spec getSelectedPath: #getTreeSelectionPath.
>         spec getChildren: #getChildrenOf:.
>         spec hasChildren: #hasChildren:.
>         spec label: #getLabelOf:.
>         spec icon: #getIconOf:.
>         spec help: #getHelpOf:.
>         spec setSelected: #setTreeSelection:.
>         spec menu: #getMenu:.
>         spec keyPress: #keyPress:.
>         ^spec!
>
> ----- Method: ToolBuilderTests>>makeWindow (in category 'tests-window') -----
> makeWindow
>         | spec |
>         spec := self makeWindowSpec.
>         widget := builder build: spec.!
>
> ----- Method: ToolBuilderTests>>makeWindowSpec (in category 'tests-window') -----
> makeWindowSpec
>         | spec |
>         spec := builder pluggableWindowSpec new.
>         spec name: #window.
>         spec model: self.
>         spec children: #getChildren.
>         spec label: #getLabel.
>         spec closeAction: #noteWindowClosed.
>         ^spec!
>
> ----- Method: ToolBuilderTests>>noteWindowClosed (in category 'tests-window') -----
> noteWindowClosed
>         queries add: #noteWindowClosed.!
>
> ----- Method: ToolBuilderTests>>openWindow (in category 'tests-window') -----
> openWindow
>         | spec |
>         spec := self makeWindowSpec.
>         widget := builder open: spec.!
>
> ----- Method: ToolBuilderTests>>returnFalse (in category 'support') -----
> returnFalse
>         ^false!
>
> ----- Method: ToolBuilderTests>>returnTrue (in category 'support') -----
> returnTrue
>         ^true!
>
> ----- Method: ToolBuilderTests>>setListIndex: (in category 'tests-lists') -----
> setListIndex: index
>         queries add: #setListIndex.!
>
> ----- Method: ToolBuilderTests>>setListSelection: (in category 'tests-lists') -----
> setListSelection: newIndex
>         queries add: #setListSelection.!
>
> ----- Method: ToolBuilderTests>>setText: (in category 'tests-text') -----
> setText: newText
>         queries add: #setText.
>         ^false!
>
> ----- Method: ToolBuilderTests>>setTreeSelection: (in category 'tests-trees') -----
> setTreeSelection: node
>         queries add: #setTreeSelection.!
>
> ----- Method: ToolBuilderTests>>setUp (in category 'support') -----
> setUp
>         queries := IdentitySet new.!
>
> ----- Method: ToolBuilderTests>>shutDown (in category 'support') -----
> shutDown
>         self myDependents: nil!
>
> ----- Method: ToolBuilderTests>>testAddTargetSelectorArgumentList (in category 'tests-menus') -----
> testAddTargetSelectorArgumentList
>         self assertItemFiresWith:
>                 [:spec | spec
>                                 add: 'Menu Item'
>                                 target: self
>                                 selector: #fireMenuAction
>                                 argumentList: #()]!
>
> ----- Method: ToolBuilderTests>>testButtonFiresBlock (in category 'tests-button') -----
> testButtonFiresBlock
>         | spec |
>         spec := builder pluggableButtonSpec new.
>         spec model: self.
>         spec action: [self fireButton].
>         widget := builder build: spec.
>         queries := IdentitySet new.
>         self fireButtonWidget.
>         self assert: (queries includes: #fireButton).!
>
> ----- Method: ToolBuilderTests>>testButtonFiresMessage (in category 'tests-button') -----
> testButtonFiresMessage
>         | spec |
>         spec := builder pluggableButtonSpec new.
>         spec model: self.
>         spec action: (MessageSend receiver: self selector: #fireButton arguments: #()).
>         widget := builder build: spec.
>         queries := IdentitySet new.
>         self fireButtonWidget.
>         self assert: (queries includes: #fireButton).!
>
> ----- Method: ToolBuilderTests>>testButtonFiresSymbol (in category 'tests-button') -----
> testButtonFiresSymbol
>         | spec |
>         spec := builder pluggableButtonSpec new.
>         spec model: self.
>         spec action: #fireButton.
>         widget := builder build: spec.
>         queries := IdentitySet new.
>         self fireButtonWidget.
>         self assert: (queries includes: #fireButton).!
>
> ----- Method: ToolBuilderTests>>testButtonInitiallyDisabled (in category 'tests-button') -----
> testButtonInitiallyDisabled
>         | spec |
>         spec := builder pluggableButtonSpec new.
>         spec model: self.
>         spec label: #getLabel.
>         spec color: #getColor.
>         spec state: #getState.
>         spec enabled: #returnFalse.
>         widget := builder build: spec.
>         self deny: (self buttonWidgetEnabled)!
>
> ----- Method: ToolBuilderTests>>testButtonInitiallyDisabledSelector (in category 'tests-button') -----
> testButtonInitiallyDisabledSelector
>         | spec |
>         spec := builder pluggableButtonSpec new.
>         spec model: self.
>         spec label: #getLabel.
>         spec color: #getColor.
>         spec state: #getState.
>         spec enabled: #returnFalse.
>         widget := builder build: spec.
>         self deny: (self buttonWidgetEnabled)!
>
> ----- Method: ToolBuilderTests>>testButtonInitiallyEnabled (in category 'tests-button') -----
> testButtonInitiallyEnabled
>         | spec |
>         spec := builder pluggableButtonSpec new.
>         spec model: self.
>         spec label: #getLabel.
>         spec color: #getColor.
>         spec state: #getState.
>         spec enabled: #returnTrue.
>         widget := builder build: spec.
>         self assert: (self buttonWidgetEnabled)!
>
> ----- Method: ToolBuilderTests>>testButtonInitiallyEnabledSelector (in category 'tests-button') -----
> testButtonInitiallyEnabledSelector
>         | spec |
>         spec := builder pluggableButtonSpec new.
>         spec model: self.
>         spec label: #getLabel.
>         spec color: #getColor.
>         spec state: #getState.
>         spec enabled: #returnTrue.
>         widget := builder build: spec.
>         self assert: (self buttonWidgetEnabled)!
>
> ----- Method: ToolBuilderTests>>testButtonWidgetID (in category 'tests-button') -----
> testButtonWidgetID
>         self makeButton.
>         self assert: (builder widgetAt: #button) == widget.!
>
> ----- Method: ToolBuilderTests>>testGetButtonColor (in category 'tests-button') -----
> testGetButtonColor
>         self makeButton.
>         queries := IdentitySet new.
>         self changed: #getColor.
>         self assert: (queries includes: #getColor).
>         self assert: self widgetColor = self getColor.!
>
> ----- Method: ToolBuilderTests>>testGetButtonEnabled (in category 'tests-button') -----
> testGetButtonEnabled
>         self makeButton.
>         queries := IdentitySet new.
>         self changed: #getEnabled.
>         self assert: (queries includes: #getEnabled).!
>
> ----- Method: ToolBuilderTests>>testGetButtonLabel (in category 'tests-button') -----
> testGetButtonLabel
>         self makeButton.
>         queries := IdentitySet new.
>         self changed: #getLabel.
>         self assert: (queries includes: #getLabel).!
>
> ----- Method: ToolBuilderTests>>testGetButtonSideEffects (in category 'tests-button') -----
> testGetButtonSideEffects
>         self makeButton.
>         queries := IdentitySet new.
>         self changed: #testSignalWithNoDiscernableEffect.
>         self expectedButtonSideEffects do:[:sym|
>                 self assert: (queries includes: sym).
>                 queries remove: sym.
>         ].
>         self assert: queries isEmpty.!
>
> ----- Method: ToolBuilderTests>>testGetButtonState (in category 'tests-button') -----
> testGetButtonState
>         self makeButton.
>         queries := IdentitySet new.
>         self changed: #getState.
>         self assert: (queries includes: #getState).!
>
> ----- Method: ToolBuilderTests>>testGetInputFieldColor (in category 'tests-input') -----
> testGetInputFieldColor
>         self makeInputField.
>         queries := IdentitySet new.
>         self changed: #getColor.
>         self assert: (queries includes: #getColor).
>         self assert: self widgetColor = self getColor.!
>
> ----- Method: ToolBuilderTests>>testGetInputFieldSelection (in category 'tests-input') -----
> testGetInputFieldSelection
>         self makeInputField.
>         queries := IdentitySet new.
>         self changed: #getTextSelection.
>         self assert: (queries includes: #getTextSelection).!
>
> ----- Method: ToolBuilderTests>>testGetInputFieldSideEffectFree (in category 'tests-input') -----
> testGetInputFieldSideEffectFree
>         self makeInputField.
>         queries := IdentitySet new.
>         self changed: #testSignalWithNoDiscernableEffect.
>         self assert: queries isEmpty.!
>
> ----- Method: ToolBuilderTests>>testGetInputFieldText (in category 'tests-input') -----
> testGetInputFieldText
>         self makeInputField.
>         queries := IdentitySet new.
>         self changed: #getText.
>         self assert: (queries includes: #getText).!
>
> ----- Method: ToolBuilderTests>>testGetItemListSideEffectFree (in category 'tests-lists') -----
> testGetItemListSideEffectFree
>         self makeItemList.
>         queries := IdentitySet new.
>         self changed: #testSignalWithNoDiscernableEffect.
>         self assert: queries isEmpty.!
>
> ----- Method: ToolBuilderTests>>testGetList (in category 'tests-lists') -----
> testGetList
>         self makeList.
>         queries := IdentitySet new.
>         self changed: #getList.
>         self assert: (queries includes: #getList).!
>
> ----- Method: ToolBuilderTests>>testGetListIndex (in category 'tests-lists') -----
> testGetListIndex
>         self makeList.
>         queries := IdentitySet new.
>         self changed: #getListIndex.
>         self assert: (queries includes: #getListIndex).!
>
> ----- Method: ToolBuilderTests>>testGetListSelection (in category 'tests-lists') -----
> testGetListSelection
>         self makeItemList.
>         queries := IdentitySet new.
>         self changed: #getListSelection.
>         self assert: (queries includes: #getListSelection).!
>
> ----- Method: ToolBuilderTests>>testGetListSideEffectFree (in category 'tests-lists') -----
> testGetListSideEffectFree
>         self makeList.
>         queries := IdentitySet new.
>         self changed: #testSignalWithNoDiscernableEffect.
>         self assert: queries isEmpty.!
>
> ----- Method: ToolBuilderTests>>testGetPanelChildren (in category 'tests-panel') -----
> testGetPanelChildren
>         self makePanel.
>         queries := IdentitySet new.
>         self changed: #getChildren.
>         self assert: (queries includes: #getChildren).!
>
> ----- Method: ToolBuilderTests>>testGetPanelSideEffectFree (in category 'tests-panel') -----
> testGetPanelSideEffectFree
>         self makePanel.
>         queries := IdentitySet new.
>         self changed: #testSignalWithNoDiscernableEffect.
>         self assert: queries isEmpty.!
>
> ----- Method: ToolBuilderTests>>testGetText (in category 'tests-text') -----
> testGetText
>         self makeText.
>         queries := IdentitySet new.
>         self changed: #getText.
>         self assert: (queries includes: #getText).!
>
> ----- Method: ToolBuilderTests>>testGetTextColor (in category 'tests-text') -----
> testGetTextColor
>         self makeText.
>         queries := IdentitySet new.
>         self changed: #getColor.
>         self assert: (queries includes: #getColor).
>         self assert: self widgetColor = self getColor.!
>
> ----- Method: ToolBuilderTests>>testGetTextSelection (in category 'tests-text') -----
> testGetTextSelection
>         self makeText.
>         queries := IdentitySet new.
>         self changed: #getTextSelection.
>         self assert: (queries includes: #getTextSelection).!
>
> ----- Method: ToolBuilderTests>>testGetTextSideEffectFree (in category 'tests-text') -----
> testGetTextSideEffectFree
>         self makeText.
>         queries := IdentitySet new.
>         self changed: #testSignalWithNoDiscernableEffect.
>         self assert: queries isEmpty.!
>
> ----- Method: ToolBuilderTests>>testGetWindowChildren (in category 'tests-window') -----
> testGetWindowChildren
>         self makeWindow.
>         queries := IdentitySet new.
>         self changed: #getChildren.
>         self assert: (queries includes: #getChildren).!
>
> ----- Method: ToolBuilderTests>>testGetWindowLabel (in category 'tests-window') -----
> testGetWindowLabel
>         self makeWindow.
>         queries := IdentitySet new.
>         self changed: #getLabel.
>         self assert: (queries includes: #getLabel).!
>
> ----- Method: ToolBuilderTests>>testGetWindowSideEffectFree (in category 'tests-window') -----
> testGetWindowSideEffectFree
>         self makeWindow.
>         queries := IdentitySet new.
>         self changed: #testSignalWithNoDiscernableEffect.
>         self assert: queries isEmpty.!
>
> ----- Method: ToolBuilderTests>>testInputWidgetID (in category 'tests-input') -----
> testInputWidgetID
>         self makeInputField.
>         self assert: (builder widgetAt: #input) == widget.!
>
> ----- Method: ToolBuilderTests>>testItemListWidgetID (in category 'tests-lists') -----
> testItemListWidgetID
>         self makeItemList.
>         self assert: (builder widgetAt: #list) == widget.!
>
> ----- Method: ToolBuilderTests>>testListWidgetID (in category 'tests-lists') -----
> testListWidgetID
>         self makeList.
>         self assert: (builder widgetAt: #list) == widget.!
>
> ----- Method: ToolBuilderTests>>testPanelWidgetID (in category 'tests-panel') -----
> testPanelWidgetID
>         self makePanel.
>         self assert: (builder widgetAt: #panel) == widget.!
>
> ----- Method: ToolBuilderTests>>testSetInputField (in category 'tests-input') -----
> testSetInputField
>         self makeInputField.
>         queries := IdentitySet new.
>         self acceptWidgetText.
>         self assert: (queries includes: #setText).!
>
> ----- Method: ToolBuilderTests>>testSetListIndex (in category 'tests-lists') -----
> testSetListIndex
>         self makeList.
>         queries := IdentitySet new.
>         self changeListWidget.
>         self assert: (queries includes: #setListIndex).!
>
> ----- Method: ToolBuilderTests>>testSetListSelection (in category 'tests-lists') -----
> testSetListSelection
>         self makeItemList.
>         queries := IdentitySet new.
>         self changeListWidget.
>         self assert: (queries includes: #setListSelection).!
>
> ----- Method: ToolBuilderTests>>testSetText (in category 'tests-text') -----
> testSetText
>         self makeText.
>         queries := IdentitySet new.
>         self acceptWidgetText.
>         self assert: (queries includes: #setText).!
>
> ----- Method: ToolBuilderTests>>testTextWidgetID (in category 'tests-text') -----
> testTextWidgetID
>         self makeText.
>         self assert: (builder widgetAt: #text) == widget!
>
> ----- Method: ToolBuilderTests>>testTreeExpandPath (in category 'tests-trees') -----
> testTreeExpandPath
>         "@@@@: REMOVE THIS - it's a hack (changed: #openPath)"
>         self makeTree.
>         queries := IdentitySet new.
>         self changed: {#openPath. '4'. '2'. '3'}.
>         self waitTick.
>         self assert: (queries includes: #getChildrenOf).
>         self assert: (queries includes: #setTreeSelection).
>         self assert: (queries includes: #getLabelOf).
> !
>
> ----- Method: ToolBuilderTests>>testTreeExpandPathFirst (in category 'tests-trees') -----
> testTreeExpandPathFirst
>         "@@@@: REMOVE THIS - it's a hack (changed: #openPath)"
>         self makeTree.
>         queries := IdentitySet new.
>         self changed: {#openPath. '1'. '2'. '2'}.
>         self waitTick.
>         self assert: (queries includes: #getChildrenOf).
>         self assert: (queries includes: #setTreeSelection).
>         self assert: (queries includes: #getLabelOf).
> !
>
> ----- Method: ToolBuilderTests>>testTreeGetSelectionPath (in category 'tests-trees') -----
> testTreeGetSelectionPath
>         self makeTree.
>         queries := IdentitySet new.
>         self changed: #getTreeSelectionPath.
>         self waitTick.
>         self assert: (queries includes: #getTreeSelectionPath).
>         self assert: (queries includes: #getChildrenOf).
>         self assert: (queries includes: #setTreeSelection).
> !
>
> ----- Method: ToolBuilderTests>>testTreeRoots (in category 'tests-trees') -----
> testTreeRoots
>         self makeTree.
>         queries := IdentitySet new.
>         self changed: #getRoots.
>         self assert: (queries includes: #getRoots).!
>
> ----- Method: ToolBuilderTests>>testTreeWidgetID (in category 'tests-trees') -----
> testTreeWidgetID
>         self makeTree.
>         self assert: (builder widgetAt: #tree) == widget.!
>
> ----- Method: ToolBuilderTests>>testWindowCloseAction (in category 'tests-window') -----
> testWindowCloseAction
>         self openWindow.
>         builder close: widget.
>         self assert: (queries includes: #noteWindowClosed).!
>
> ----- Method: ToolBuilderTests>>testWindowID (in category 'tests-window') -----
> testWindowID
>         self makeWindow.
>         self assert: (builder widgetAt: #window) == widget.!
>
> ----- Method: ToolBuilderTests>>waitTick (in category 'support') -----
> waitTick
>         ^nil!
>
> ----- Method: ToolBuilderTests>>widgetColor (in category 'support') -----
> widgetColor
>         "Answer color from widget"
>         self subclassResponsibility
>
>         "NOTE: You can bail out if you don't know how to get the color from the widget:
>                 ^self getColor
>         will work."!
>
>




Reply | Threaded
Open this post in threaded view
|

Re: modularity goals (was: The Trunk: ToolBuilderTests-fbs.1.mcz)

Frank Shearar-3
On 09 Dec 2013, at 7:07, Nicolas Cellier <[hidden email]> wrote:

Yes, separating tests is a good practice and already almost universal practice in current Squeak, as well as in many 3rd party packages.

If you don't want to create a specific package, then there is a blob named 'Tests' already, but I'd rather see this blob split into pieces. The reason is that if you want to test an image constructed from parts, you might want to test those parts exclusively.


2013/12/9 Chris Muller <[hidden email]>
There has been a great effort headed up by Frank to organize behaviors
into a hierarchy of packages with no cyclic dependencies.  This is a
great goal and great effort.

But the introduction of this new package (with just two classes)
prompts a need to understand what _all_ the goals are for this
process.  Certainly, everyone agrees we want no cyclic dependencies
between packages.

But this extraction doesn't help that.  Nothing will ever depend on
ToolBuilderTests, so how does this new leaf of the package-dependency
hierarchy, justify its existence in cyberspace?

ToolBuilder no longer depends on SUnit. I fail to see how that's bad.

Getting SUnit completely out of the image will mean ALL packages must
be split between their "-Kernel" and "-Tests" components.  Is that the
plan?

I suppose eventually, yes. What's the point of unloading ST80 but leaving its tests in Tests?

I'm not necessarily against it -- I'm just having trouble articulating
what's wrong with co-location of a package's tests, with the package
itself, and it depending on SUnit vs. not.  SUnit is not that big and
depends on nothing but Core.

I do not understand why a GUI specification should depend on a test framework.

In the long term, yes, I would like to break Tests up, so that we can unload more and more things. It's not something I'm pushing for because it's trivial to fix (and Tests is already inloadable) and we have much more difficult problems to solve.

frank

On Sat, Dec 7, 2013 at 1:49 PM,  <[hidden email]> wrote:
> Frank Shearar uploaded a new version of ToolBuilderTests to project The Trunk:
> http://source.squeak.org/trunk/ToolBuilderTests-fbs.1.mcz
>
> ==================== Summary ====================
>
> Name: ToolBuilderTests-fbs.1
> Author: fbs
> Time: 7 December 2013, 7:47:14.931 pm
> UUID: f75a55b6-ea0a-4b43-bf08-dfcf82dc99fb
> Ancestors:
>
> ToolBuilder SUnit tests.
>
> ==================== Snapshot ====================
>
> SystemOrganization addCategory: #ToolBuilderTests!
>
> TestCase subclass: #PluggableMenuItemSpecTests
>         instanceVariableNames: ''
>         classVariableNames: ''
>         poolDictionaries: ''
>         category: 'ToolBuilderTests'!
>
> ----- Method: PluggableMenuItemSpecTests>>testBeCheckableMakesItemCheckable (in category 'as yet unclassified') -----
> testBeCheckableMakesItemCheckable
>         | itemSpec |
>         itemSpec := PluggableMenuItemSpec new.
>         itemSpec beCheckable.
>         self assert: itemSpec isCheckable description: 'Item not checkable'.!
>
> ----- Method: PluggableMenuItemSpecTests>>testByDefaultNotCheckable (in category 'as yet unclassified') -----
> testByDefaultNotCheckable
>         | itemSpec |
>         itemSpec := PluggableMenuItemSpec new.
>         self deny: itemSpec isCheckable.!
>
> ----- Method: PluggableMenuItemSpecTests>>testNoMarkerMakesItemChecked (in category 'as yet unclassified') -----
> testNoMarkerMakesItemChecked
>         | itemSpec |
>         itemSpec := PluggableMenuItemSpec new.
>         itemSpec label: '<no>no'.
>         itemSpec analyzeLabel.
>         self assert: itemSpec isCheckable description: 'item not checkable'.
>         self deny: itemSpec checked description: 'item checked'.!
>
> ----- Method: PluggableMenuItemSpecTests>>testOffMarkerMakesItemChecked (in category 'as yet unclassified') -----
> testOffMarkerMakesItemChecked
>         | itemSpec |
>         itemSpec := PluggableMenuItemSpec new.
>         itemSpec label: '<off>off'.
>         itemSpec analyzeLabel.
>         self assert: itemSpec isCheckable description: 'item not checkable'.
>         self deny: itemSpec checked description: 'item checked'.!
>
> ----- Method: PluggableMenuItemSpecTests>>testOnMarkerMakesItemChecked (in category 'as yet unclassified') -----
> testOnMarkerMakesItemChecked
>         | itemSpec |
>         itemSpec := PluggableMenuItemSpec new.
>         itemSpec label: '<on>on'.
>         itemSpec analyzeLabel.
>         self assert: itemSpec isCheckable description: 'item not checkable'.
>         self assert: itemSpec isCheckable description: 'item not checked'.!
>
> ----- Method: PluggableMenuItemSpecTests>>testYesMarkerMakesItemChecked (in category 'as yet unclassified') -----
> testYesMarkerMakesItemChecked
>         | itemSpec |
>         itemSpec := PluggableMenuItemSpec new.
>         itemSpec label: '<yes>on'.
>         itemSpec analyzeLabel.
>         self assert: itemSpec isCheckable description: 'item not checkable'.
>         self assert: itemSpec isCheckable description: 'item not checked'.!
>
> TestCase subclass: #ToolBuilderTests
>         instanceVariableNames: 'builder widget queries'
>         classVariableNames: ''
>         poolDictionaries: ''
>         category: 'ToolBuilderTests'!
>
> !ToolBuilderTests commentStamp: 'ar 2/11/2005 15:01' prior: 0!
> Some tests to make sure ToolBuilder does what it says.!
>
> ----- Method: ToolBuilderTests class>>isAbstract (in category 'testing') -----
> isAbstract
>         ^self == ToolBuilderTests!
>
> ----- Method: ToolBuilderTests>>acceptWidgetText (in category 'support') -----
> acceptWidgetText
>         "accept text in widget"
>         ^ self subclassResponsibility!
>
> ----- Method: ToolBuilderTests>>assertItemFiresWith: (in category 'tests-menus') -----
> assertItemFiresWith: aBlock
>         | spec |
>         spec := builder pluggableMenuSpec new.
>         spec model: self.
>         aBlock value: spec.
>         widget := builder build: spec.
>         queries := IdentitySet new.
>         self fireMenuItemWidget.
>         self assert: (queries includes: #fireMenuAction)!
>
> ----- Method: ToolBuilderTests>>buttonWidgetEnabled (in category 'support') -----
> buttonWidgetEnabled
>         "Answer whether the current widget (a button) is currently enabled"
>
>         ^ widget getModelState!
>
> ----- Method: ToolBuilderTests>>changeListWidget (in category 'support') -----
> changeListWidget
>         "Change the list widget's selection index"
>         self subclassResponsibility!
>
> ----- Method: ToolBuilderTests>>expectedButtonSideEffects (in category 'support') -----
> expectedButtonSideEffects
>         "side effect queries we expect to see on buttons"
>         ^#()!
>
> ----- Method: ToolBuilderTests>>fireButton (in category 'tests-button') -----
> fireButton
>         queries add: #fireButton.!
>
> ----- Method: ToolBuilderTests>>fireButtonWidget (in category 'support') -----
> fireButtonWidget
>         "Fire the widget, e.g., perform what is needed for the guy to trigger its action"
>         self subclassResponsibility!
>
> ----- Method: ToolBuilderTests>>fireMenuAction (in category 'tests-menus') -----
> fireMenuAction
>         queries add: #fireMenuAction!
>
> ----- Method: ToolBuilderTests>>fireMenuItemWidget (in category 'tests-menus') -----
> fireMenuItemWidget
>         self subclassResponsibility!
>
> ----- Method: ToolBuilderTests>>getChildren (in category 'tests-panel') -----
> getChildren
>         queries add: #getChildren.
>         ^#()!
>
> ----- Method: ToolBuilderTests>>getChildrenOf: (in category 'tests-trees') -----
> getChildrenOf: item
>         queries add: #getChildrenOf.
>         ^(1 to: 9) asArray!
>
> ----- Method: ToolBuilderTests>>getColor (in category 'tests-text') -----
> getColor
>         queries add: #getColor.
>         ^Color tan!
>
> ----- Method: ToolBuilderTests>>getEnabled (in category 'tests-button') -----
> getEnabled
>         queries add: #getEnabled.
>         ^true!
>
> ----- Method: ToolBuilderTests>>getHelpOf: (in category 'tests-trees') -----
> getHelpOf: item
>         ^'help'!
>
> ----- Method: ToolBuilderTests>>getIconOf: (in category 'tests-trees') -----
> getIconOf: item
>         queries add: #getIconOf.
>         ^nil!
>
> ----- Method: ToolBuilderTests>>getLabel (in category 'tests-button') -----
> getLabel
>         queries add: #getLabel.
>         ^'TestLabel'!
>
> ----- Method: ToolBuilderTests>>getLabelOf: (in category 'tests-trees') -----
> getLabelOf: item
>         queries add: #getLabelOf.
>         ^item asString!
>
> ----- Method: ToolBuilderTests>>getList (in category 'tests-lists') -----
> getList
>         queries add: #getList.
>         ^(1 to: 100) collect:[:i| i printString].!
>
> ----- Method: ToolBuilderTests>>getListIndex (in category 'tests-lists') -----
> getListIndex
>         queries add: #getListIndex.
>         ^13!
>
> ----- Method: ToolBuilderTests>>getListSelection (in category 'tests-lists') -----
> getListSelection
>         queries add: #getListSelection.
>         ^'55'!
>
> ----- Method: ToolBuilderTests>>getMenu: (in category 'tests-lists') -----
> getMenu: aMenu
>         queries add: #getMenu.
>         ^aMenu!
>
> ----- Method: ToolBuilderTests>>getRoots (in category 'tests-trees') -----
> getRoots
>         queries add: #getRoots.
>         ^(1 to: 9) asArray!
>
> ----- Method: ToolBuilderTests>>getState (in category 'tests-button') -----
> getState
>         queries add: #getState.
>         ^true!
>
> ----- Method: ToolBuilderTests>>getText (in category 'tests-text') -----
> getText
>         queries add: #getText.
>         ^Text new!
>
> ----- Method: ToolBuilderTests>>getTextSelection (in category 'tests-text') -----
> getTextSelection
>         queries add: #getTextSelection.
>         ^(1 to: 0)!
>
> ----- Method: ToolBuilderTests>>getTreeSelectionPath (in category 'tests-trees') -----
> getTreeSelectionPath
>         queries add: #getTreeSelectionPath.
>         ^{2. 4. 3}!
>
> ----- Method: ToolBuilderTests>>hasChildren: (in category 'tests-trees') -----
> hasChildren: item
>         queries add: #hasChildren.
>         ^true!
>
> ----- Method: ToolBuilderTests>>keyPress: (in category 'tests-lists') -----
> keyPress: key
>         queries add: #keyPress.!
>
> ----- Method: ToolBuilderTests>>makeButton (in category 'tests-button') -----
> makeButton
>         | spec |
>         spec := self makeButtonSpec.
>         widget := builder build: spec.
>         ^widget!
>
> ----- Method: ToolBuilderTests>>makeButtonSpec (in category 'tests-button') -----
> makeButtonSpec
>         | spec |
>         spec := builder pluggableButtonSpec new.
>         spec name: #button.
>         spec model: self.
>         spec label: #getLabel.
>         spec color: #getColor.
>         spec state: #getState.
>         spec enabled: #getEnabled.
>         ^spec!
>
> ----- Method: ToolBuilderTests>>makeInputField (in category 'tests-input') -----
> makeInputField
>         | spec |
>         spec := self makeInputFieldSpec.
>         widget := builder build: spec.!
>
> ----- Method: ToolBuilderTests>>makeInputFieldSpec (in category 'tests-input') -----
> makeInputFieldSpec
>         | spec |
>         spec := builder pluggableInputFieldSpec new.
>         spec name: #input.
>         spec model: self.
>         spec getText: #getText.
>         spec selection: #getTextSelection.
>         spec color: #getColor.
>         "<-- the following cannot be tested very well -->"
>         spec setText: #setText:.
>         spec menu: #getMenu:.
>         ^spec!
>
> ----- Method: ToolBuilderTests>>makeItemList (in category 'tests-lists') -----
> makeItemList
>         | spec |
>         spec := self makeItemListSpec.
>         widget := builder build: spec.!
>
> ----- Method: ToolBuilderTests>>makeItemListSpec (in category 'tests-lists') -----
> makeItemListSpec
>         | spec |
>         spec := builder pluggableListSpec new.
>         spec name: #list.
>         spec model: self.
>         spec list: #getList.
>         spec getSelected: #getListSelection.
>         "<-- the following cannot be tested very well -->"
>         spec setSelected: #setListSelection:.
>         spec menu: #getMenu:.
>         spec keyPress: #keyPress:.
>         ^spec!
>
> ----- Method: ToolBuilderTests>>makeList (in category 'tests-lists') -----
> makeList
>         | spec |
>         spec := self makeListSpec.
>         widget := builder build: spec.!
>
> ----- Method: ToolBuilderTests>>makeListSpec (in category 'tests-lists') -----
> makeListSpec
>         | spec |
>         spec := builder pluggableListSpec new.
>         spec name: #list.
>         spec model: self.
>         spec list: #getList.
>         spec getIndex: #getListIndex.
>         "<-- the following cannot be tested very well -->"
>         spec setIndex: #setListIndex:.
>         spec menu: #getMenu:.
>         spec keyPress: #keyPress:.
>         ^spec!
>
> ----- Method: ToolBuilderTests>>makePanel (in category 'tests-panel') -----
> makePanel
>         | spec |
>         spec := self makePanelSpec.
>         widget := builder build: spec.!
>
> ----- Method: ToolBuilderTests>>makePanelSpec (in category 'tests-panel') -----
> makePanelSpec
>         | spec |
>         spec := builder pluggablePanelSpec new.
>         spec name: #panel.
>         spec model: self.
>         spec children: #getChildren.
>         ^spec!
>
> ----- Method: ToolBuilderTests>>makeText (in category 'tests-text') -----
> makeText
>         | spec |
>         spec := self makeTextSpec.
>         widget := builder build: spec.!
>
> ----- Method: ToolBuilderTests>>makeTextSpec (in category 'tests-text') -----
> makeTextSpec
>         | spec |
>         spec := builder pluggableTextSpec new.
>         spec name: #text.
>         spec model: self.
>         spec getText: #getText.
>         spec selection: #getTextSelection.
>         spec color: #getColor.
>         "<-- the following cannot be tested very well -->"
>         spec setText: #setText:.
>         spec menu: #getMenu:.
>         ^spec!
>
> ----- Method: ToolBuilderTests>>makeTree (in category 'tests-trees') -----
> makeTree
>         | spec |
>         spec := self makeTreeSpec.
>         widget := builder build: spec.!
>
> ----- Method: ToolBuilderTests>>makeTreeSpec (in category 'tests-trees') -----
> makeTreeSpec
>         | spec |
>         spec := builder pluggableTreeSpec new.
>         spec name: #tree.
>         spec model: self.
>         spec roots: #getRoots.
>         "<-- the following cannot be tested very well -->"
>         spec getSelectedPath: #getTreeSelectionPath.
>         spec getChildren: #getChildrenOf:.
>         spec hasChildren: #hasChildren:.
>         spec label: #getLabelOf:.
>         spec icon: #getIconOf:.
>         spec help: #getHelpOf:.
>         spec setSelected: #setTreeSelection:.
>         spec menu: #getMenu:.
>         spec keyPress: #keyPress:.
>         ^spec!
>
> ----- Method: ToolBuilderTests>>makeWindow (in category 'tests-window') -----
> makeWindow
>         | spec |
>         spec := self makeWindowSpec.
>         widget := builder build: spec.!
>
> ----- Method: ToolBuilderTests>>makeWindowSpec (in category 'tests-window') -----
> makeWindowSpec
>         | spec |
>         spec := builder pluggableWindowSpec new.
>         spec name: #window.
>         spec model: self.
>         spec children: #getChildren.
>         spec label: #getLabel.
>         spec closeAction: #noteWindowClosed.
>         ^spec!
>
> ----- Method: ToolBuilderTests>>noteWindowClosed (in category 'tests-window') -----
> noteWindowClosed
>         queries add: #noteWindowClosed.!
>
> ----- Method: ToolBuilderTests>>openWindow (in category 'tests-window') -----
> openWindow
>         | spec |
>         spec := self makeWindowSpec.
>         widget := builder open: spec.!
>
> ----- Method: ToolBuilderTests>>returnFalse (in category 'support') -----
> returnFalse
>         ^false!
>
> ----- Method: ToolBuilderTests>>returnTrue (in category 'support') -----
> returnTrue
>         ^true!
>
> ----- Method: ToolBuilderTests>>setListIndex: (in category 'tests-lists') -----
> setListIndex: index
>         queries add: #setListIndex.!
>
> ----- Method: ToolBuilderTests>>setListSelection: (in category 'tests-lists') -----
> setListSelection: newIndex
>         queries add: #setListSelection.!
>
> ----- Method: ToolBuilderTests>>setText: (in category 'tests-text') -----
> setText: newText
>         queries add: #setText.
>         ^false!
>
> ----- Method: ToolBuilderTests>>setTreeSelection: (in category 'tests-trees') -----
> setTreeSelection: node
>         queries add: #setTreeSelection.!
>
> ----- Method: ToolBuilderTests>>setUp (in category 'support') -----
> setUp
>         queries := IdentitySet new.!
>
> ----- Method: ToolBuilderTests>>shutDown (in category 'support') -----
> shutDown
>         self myDependents: nil!
>
> ----- Method: ToolBuilderTests>>testAddTargetSelectorArgumentList (in category 'tests-menus') -----
> testAddTargetSelectorArgumentList
>         self assertItemFiresWith:
>                 [:spec | spec
>                                 add: 'Menu Item'
>                                 target: self
>                                 selector: #fireMenuAction
>                                 argumentList: #()]!
>
> ----- Method: ToolBuilderTests>>testButtonFiresBlock (in category 'tests-button') -----
> testButtonFiresBlock
>         | spec |
>         spec := builder pluggableButtonSpec new.
>         spec model: self.
>         spec action: [self fireButton].
>         widget := builder build: spec.
>         queries := IdentitySet new.
>         self fireButtonWidget.
>         self assert: (queries includes: #fireButton).!
>
> ----- Method: ToolBuilderTests>>testButtonFiresMessage (in category 'tests-button') -----
> testButtonFiresMessage
>         | spec |
>         spec := builder pluggableButtonSpec new.
>         spec model: self.
>         spec action: (MessageSend receiver: self selector: #fireButton arguments: #()).
>         widget := builder build: spec.
>         queries := IdentitySet new.
>         self fireButtonWidget.
>         self assert: (queries includes: #fireButton).!
>
> ----- Method: ToolBuilderTests>>testButtonFiresSymbol (in category 'tests-button') -----
> testButtonFiresSymbol
>         | spec |
>         spec := builder pluggableButtonSpec new.
>         spec model: self.
>         spec action: #fireButton.
>         widget := builder build: spec.
>         queries := IdentitySet new.
>         self fireButtonWidget.
>         self assert: (queries includes: #fireButton).!
>
> ----- Method: ToolBuilderTests>>testButtonInitiallyDisabled (in category 'tests-button') -----
> testButtonInitiallyDisabled
>         | spec |
>         spec := builder pluggableButtonSpec new.
>         spec model: self.
>         spec label: #getLabel.
>         spec color: #getColor.
>         spec state: #getState.
>         spec enabled: #returnFalse.
>         widget := builder build: spec.
>         self deny: (self buttonWidgetEnabled)!
>
> ----- Method: ToolBuilderTests>>testButtonInitiallyDisabledSelector (in category 'tests-button') -----
> testButtonInitiallyDisabledSelector
>         | spec |
>         spec := builder pluggableButtonSpec new.
>         spec model: self.
>         spec label: #getLabel.
>         spec color: #getColor.
>         spec state: #getState.
>         spec enabled: #returnFalse.
>         widget := builder build: spec.
>         self deny: (self buttonWidgetEnabled)!
>
> ----- Method: ToolBuilderTests>>testButtonInitiallyEnabled (in category 'tests-button') -----
> testButtonInitiallyEnabled
>         | spec |
>         spec := builder pluggableButtonSpec new.
>         spec model: self.
>         spec label: #getLabel.
>         spec color: #getColor.
>         spec state: #getState.
>         spec enabled: #returnTrue.
>         widget := builder build: spec.
>         self assert: (self buttonWidgetEnabled)!
>
> ----- Method: ToolBuilderTests>>testButtonInitiallyEnabledSelector (in category 'tests-button') -----
> testButtonInitiallyEnabledSelector
>         | spec |
>         spec := builder pluggableButtonSpec new.
>         spec model: self.
>         spec label: #getLabel.
>         spec color: #getColor.
>         spec state: #getState.
>         spec enabled: #returnTrue.
>         widget := builder build: spec.
>         self assert: (self buttonWidgetEnabled)!
>
> ----- Method: ToolBuilderTests>>testButtonWidgetID (in category 'tests-button') -----
> testButtonWidgetID
>         self makeButton.
>         self assert: (builder widgetAt: #button) == widget.!
>
> ----- Method: ToolBuilderTests>>testGetButtonColor (in category 'tests-button') -----
> testGetButtonColor
>         self makeButton.
>         queries := IdentitySet new.
>         self changed: #getColor.
>         self assert: (queries includes: #getColor).
>         self assert: self widgetColor = self getColor.!
>
> ----- Method: ToolBuilderTests>>testGetButtonEnabled (in category 'tests-button') -----
> testGetButtonEnabled
>         self makeButton.
>         queries := IdentitySet new.
>         self changed: #getEnabled.
>         self assert: (queries includes: #getEnabled).!
>
> ----- Method: ToolBuilderTests>>testGetButtonLabel (in category 'tests-button') -----
> testGetButtonLabel
>         self makeButton.
>         queries := IdentitySet new.
>         self changed: #getLabel.
>         self assert: (queries includes: #getLabel).!
>
> ----- Method: ToolBuilderTests>>testGetButtonSideEffects (in category 'tests-button') -----
> testGetButtonSideEffects
>         self makeButton.
>         queries := IdentitySet new.
>         self changed: #testSignalWithNoDiscernableEffect.
>         self expectedButtonSideEffects do:[:sym|
>                 self assert: (queries includes: sym).
>                 queries remove: sym.
>         ].
>         self assert: queries isEmpty.!
>
> ----- Method: ToolBuilderTests>>testGetButtonState (in category 'tests-button') -----
> testGetButtonState
>         self makeButton.
>         queries := IdentitySet new.
>         self changed: #getState.
>         self assert: (queries includes: #getState).!
>
> ----- Method: ToolBuilderTests>>testGetInputFieldColor (in category 'tests-input') -----
> testGetInputFieldColor
>         self makeInputField.
>         queries := IdentitySet new.
>         self changed: #getColor.
>         self assert: (queries includes: #getColor).
>         self assert: self widgetColor = self getColor.!
>
> ----- Method: ToolBuilderTests>>testGetInputFieldSelection (in category 'tests-input') -----
> testGetInputFieldSelection
>         self makeInputField.
>         queries := IdentitySet new.
>         self changed: #getTextSelection.
>         self assert: (queries includes: #getTextSelection).!
>
> ----- Method: ToolBuilderTests>>testGetInputFieldSideEffectFree (in category 'tests-input') -----
> testGetInputFieldSideEffectFree
>         self makeInputField.
>         queries := IdentitySet new.
>         self changed: #testSignalWithNoDiscernableEffect.
>         self assert: queries isEmpty.!
>
> ----- Method: ToolBuilderTests>>testGetInputFieldText (in category 'tests-input') -----
> testGetInputFieldText
>         self makeInputField.
>         queries := IdentitySet new.
>         self changed: #getText.
>         self assert: (queries includes: #getText).!
>
> ----- Method: ToolBuilderTests>>testGetItemListSideEffectFree (in category 'tests-lists') -----
> testGetItemListSideEffectFree
>         self makeItemList.
>         queries := IdentitySet new.
>         self changed: #testSignalWithNoDiscernableEffect.
>         self assert: queries isEmpty.!
>
> ----- Method: ToolBuilderTests>>testGetList (in category 'tests-lists') -----
> testGetList
>         self makeList.
>         queries := IdentitySet new.
>         self changed: #getList.
>         self assert: (queries includes: #getList).!
>
> ----- Method: ToolBuilderTests>>testGetListIndex (in category 'tests-lists') -----
> testGetListIndex
>         self makeList.
>         queries := IdentitySet new.
>         self changed: #getListIndex.
>         self assert: (queries includes: #getListIndex).!
>
> ----- Method: ToolBuilderTests>>testGetListSelection (in category 'tests-lists') -----
> testGetListSelection
>         self makeItemList.
>         queries := IdentitySet new.
>         self changed: #getListSelection.
>         self assert: (queries includes: #getListSelection).!
>
> ----- Method: ToolBuilderTests>>testGetListSideEffectFree (in category 'tests-lists') -----
> testGetListSideEffectFree
>         self makeList.
>         queries := IdentitySet new.
>         self changed: #testSignalWithNoDiscernableEffect.
>         self assert: queries isEmpty.!
>
> ----- Method: ToolBuilderTests>>testGetPanelChildren (in category 'tests-panel') -----
> testGetPanelChildren
>         self makePanel.
>         queries := IdentitySet new.
>         self changed: #getChildren.
>         self assert: (queries includes: #getChildren).!
>
> ----- Method: ToolBuilderTests>>testGetPanelSideEffectFree (in category 'tests-panel') -----
> testGetPanelSideEffectFree
>         self makePanel.
>         queries := IdentitySet new.
>         self changed: #testSignalWithNoDiscernableEffect.
>         self assert: queries isEmpty.!
>
> ----- Method: ToolBuilderTests>>testGetText (in category 'tests-text') -----
> testGetText
>         self makeText.
>         queries := IdentitySet new.
>         self changed: #getText.
>         self assert: (queries includes: #getText).!
>
> ----- Method: ToolBuilderTests>>testGetTextColor (in category 'tests-text') -----
> testGetTextColor
>         self makeText.
>         queries := IdentitySet new.
>         self changed: #getColor.
>         self assert: (queries includes: #getColor).
>         self assert: self widgetColor = self getColor.!
>
> ----- Method: ToolBuilderTests>>testGetTextSelection (in category 'tests-text') -----
> testGetTextSelection
>         self makeText.
>         queries := IdentitySet new.
>         self changed: #getTextSelection.
>         self assert: (queries includes: #getTextSelection).!
>
> ----- Method: ToolBuilderTests>>testGetTextSideEffectFree (in category 'tests-text') -----
> testGetTextSideEffectFree
>         self makeText.
>         queries := IdentitySet new.
>         self changed: #testSignalWithNoDiscernableEffect.
>         self assert: queries isEmpty.!
>
> ----- Method: ToolBuilderTests>>testGetWindowChildren (in category 'tests-window') -----
> testGetWindowChildren
>         self makeWindow.
>         queries := IdentitySet new.
>         self changed: #getChildren.
>         self assert: (queries includes: #getChildren).!
>
> ----- Method: ToolBuilderTests>>testGetWindowLabel (in category 'tests-window') -----
> testGetWindowLabel
>         self makeWindow.
>         queries := IdentitySet new.
>         self changed: #getLabel.
>         self assert: (queries includes: #getLabel).!
>
> ----- Method: ToolBuilderTests>>testGetWindowSideEffectFree (in category 'tests-window') -----
> testGetWindowSideEffectFree
>         self makeWindow.
>         queries := IdentitySet new.
>         self changed: #testSignalWithNoDiscernableEffect.
>         self assert: queries isEmpty.!
>
> ----- Method: ToolBuilderTests>>testInputWidgetID (in category 'tests-input') -----
> testInputWidgetID
>         self makeInputField.
>         self assert: (builder widgetAt: #input) == widget.!
>
> ----- Method: ToolBuilderTests>>testItemListWidgetID (in category 'tests-lists') -----
> testItemListWidgetID
>         self makeItemList.
>         self assert: (builder widgetAt: #list) == widget.!
>
> ----- Method: ToolBuilderTests>>testListWidgetID (in category 'tests-lists') -----
> testListWidgetID
>         self makeList.
>         self assert: (builder widgetAt: #list) == widget.!
>
> ----- Method: ToolBuilderTests>>testPanelWidgetID (in category 'tests-panel') -----
> testPanelWidgetID
>         self makePanel.
>         self assert: (builder widgetAt: #panel) == widget.!
>
> ----- Method: ToolBuilderTests>>testSetInputField (in category 'tests-input') -----
> testSetInputField
>         self makeInputField.
>         queries := IdentitySet new.
>         self acceptWidgetText.
>         self assert: (queries includes: #setText).!
>
> ----- Method: ToolBuilderTests>>testSetListIndex (in category 'tests-lists') -----
> testSetListIndex
>         self makeList.
>         queries := IdentitySet new.
>         self changeListWidget.
>         self assert: (queries includes: #setListIndex).!
>
> ----- Method: ToolBuilderTests>>testSetListSelection (in category 'tests-lists') -----
> testSetListSelection
>         self makeItemList.
>         queries := IdentitySet new.
>         self changeListWidget.
>         self assert: (queries includes: #setListSelection).!
>
> ----- Method: ToolBuilderTests>>testSetText (in category 'tests-text') -----
> testSetText
>         self makeText.
>         queries := IdentitySet new.
>         self acceptWidgetText.
>         self assert: (queries includes: #setText).!
>
> ----- Method: ToolBuilderTests>>testTextWidgetID (in category 'tests-text') -----
> testTextWidgetID
>         self makeText.
>         self assert: (builder widgetAt: #text) == widget!
>
> ----- Method: ToolBuilderTests>>testTreeExpandPath (in category 'tests-trees') -----
> testTreeExpandPath
>         "@@@@: REMOVE THIS - it's a hack (changed: #openPath)"
>         self makeTree.
>         queries := IdentitySet new.
>         self changed: {#openPath. '4'. '2'. '3'}.
>         self waitTick.
>         self assert: (queries includes: #getChildrenOf).
>         self assert: (queries includes: #setTreeSelection).
>         self assert: (queries includes: #getLabelOf).
> !
>
> ----- Method: ToolBuilderTests>>testTreeExpandPathFirst (in category 'tests-trees') -----
> testTreeExpandPathFirst
>         "@@@@: REMOVE THIS - it's a hack (changed: #openPath)"
>         self makeTree.
>         queries := IdentitySet new.
>         self changed: {#openPath. '1'. '2'. '2'}.
>         self waitTick.
>         self assert: (queries includes: #getChildrenOf).
>         self assert: (queries includes: #setTreeSelection).
>         self assert: (queries includes: #getLabelOf).
> !
>
> ----- Method: ToolBuilderTests>>testTreeGetSelectionPath (in category 'tests-trees') -----
> testTreeGetSelectionPath
>         self makeTree.
>         queries := IdentitySet new.
>         self changed: #getTreeSelectionPath.
>         self waitTick.
>         self assert: (queries includes: #getTreeSelectionPath).
>         self assert: (queries includes: #getChildrenOf).
>         self assert: (queries includes: #setTreeSelection).
> !
>
> ----- Method: ToolBuilderTests>>testTreeRoots (in category 'tests-trees') -----
> testTreeRoots
>         self makeTree.
>         queries := IdentitySet new.
>         self changed: #getRoots.
>         self assert: (queries includes: #getRoots).!
>
> ----- Method: ToolBuilderTests>>testTreeWidgetID (in category 'tests-trees') -----
> testTreeWidgetID
>         self makeTree.
>         self assert: (builder widgetAt: #tree) == widget.!
>
> ----- Method: ToolBuilderTests>>testWindowCloseAction (in category 'tests-window') -----
> testWindowCloseAction
>         self openWindow.
>         builder close: widget.
>         self assert: (queries includes: #noteWindowClosed).!
>
> ----- Method: ToolBuilderTests>>testWindowID (in category 'tests-window') -----
> testWindowID
>         self makeWindow.
>         self assert: (builder widgetAt: #window) == widget.!
>
> ----- Method: ToolBuilderTests>>waitTick (in category 'support') -----
> waitTick
>         ^nil!
>
> ----- Method: ToolBuilderTests>>widgetColor (in category 'support') -----
> widgetColor
>         "Answer color from widget"
>         self subclassResponsibility
>
>         "NOTE: You can bail out if you don't know how to get the color from the widget:
>                 ^self getColor
>         will work."!
>
>





Reply | Threaded
Open this post in threaded view
|

Re: modularity goals (was: The Trunk: ToolBuilderTests-fbs.1.mcz)

David T. Lewis
On Mon, Dec 09, 2013 at 08:25:39AM +0000, Frank Shearar wrote:

> On 09 Dec 2013, at 7:07, Nicolas Cellier <[hidden email]> wrote:
>
> > Yes, separating tests is a good practice and already almost universal practice in current Squeak, as well as in many 3rd party packages.
> >
> > If you don't want to create a specific package, then there is a blob named 'Tests' already, but I'd rather see this blob split into pieces. The reason is that if you want to test an image constructed from parts, you might want to test those parts exclusively.
> >
> >
> > 2013/12/9 Chris Muller <[hidden email]>
> > There has been a great effort headed up by Frank to organize behaviors
> > into a hierarchy of packages with no cyclic dependencies.  This is a
> > great goal and great effort.
> >
> > But the introduction of this new package (with just two classes)
> > prompts a need to understand what _all_ the goals are for this
> > process.  Certainly, everyone agrees we want no cyclic dependencies
> > between packages.
> >
> > But this extraction doesn't help that.  Nothing will ever depend on
> > ToolBuilderTests, so how does this new leaf of the package-dependency
> > hierarchy, justify its existence in cyberspace?
>
> ToolBuilder no longer depends on SUnit. I fail to see how that's bad.
>
> > Getting SUnit completely out of the image will mean ALL packages must
> > be split between their "-Kernel" and "-Tests" components.  Is that the
> > plan?
>
> I suppose eventually, yes. What's the point of unloading ST80 but leaving its tests in Tests?

I do not understand your example. Which tests are you referring to?
I don't see any ST80 tests in the Tests category.

I'm just asking for clarification.

Dave


Reply | Threaded
Open this post in threaded view
|

Re: modularity goals (was: The Trunk: ToolBuilderTests-fbs.1.mcz)

Frank Shearar-3
On 9 December 2013 13:08, David T. Lewis <[hidden email]> wrote:

> On Mon, Dec 09, 2013 at 08:25:39AM +0000, Frank Shearar wrote:
>> On 09 Dec 2013, at 7:07, Nicolas Cellier <[hidden email]> wrote:
>>
>> > Yes, separating tests is a good practice and already almost universal practice in current Squeak, as well as in many 3rd party packages.
>> >
>> > If you don't want to create a specific package, then there is a blob named 'Tests' already, but I'd rather see this blob split into pieces. The reason is that if you want to test an image constructed from parts, you might want to test those parts exclusively.
>> >
>> >
>> > 2013/12/9 Chris Muller <[hidden email]>
>> > There has been a great effort headed up by Frank to organize behaviors
>> > into a hierarchy of packages with no cyclic dependencies.  This is a
>> > great goal and great effort.
>> >
>> > But the introduction of this new package (with just two classes)
>> > prompts a need to understand what _all_ the goals are for this
>> > process.  Certainly, everyone agrees we want no cyclic dependencies
>> > between packages.
>> >
>> > But this extraction doesn't help that.  Nothing will ever depend on
>> > ToolBuilderTests, so how does this new leaf of the package-dependency
>> > hierarchy, justify its existence in cyberspace?
>>
>> ToolBuilder no longer depends on SUnit. I fail to see how that's bad.
>>
>> > Getting SUnit completely out of the image will mean ALL packages must
>> > be split between their "-Kernel" and "-Tests" components.  Is that the
>> > plan?
>>
>> I suppose eventually, yes. What's the point of unloading ST80 but leaving its tests in Tests?
>
> I do not understand your example. Which tests are you referring to?
> I don't see any ST80 tests in the Tests category.
>
> I'm just asking for clarification.

I'm using ST80 to illustrate what I want to see. ST80's tests are
indeed in a separate package. Imagine that they were in Tests, though.
Then you could only unload ST80 if you were prepared to accept a whole
pile of broken tests. But since ST80's tests are in their own package,
ST80 can be completely unloaded from an image.

Conversely, imagine if XMLParser had tests, and those tests were in
Tests. If I unloaded XMLParser, I'd have a bunch of tests failing
because all of XMLParser's classes were missing.

frank

> Dave
>
>

Reply | Threaded
Open this post in threaded view
|

Re: modularity goals (was: The Trunk: ToolBuilderTests-fbs.1.mcz)

David T. Lewis
On Mon, Dec 09, 2013 at 01:18:27PM +0000, Frank Shearar wrote:

> On 9 December 2013 13:08, David T. Lewis <[hidden email]> wrote:
> > On Mon, Dec 09, 2013 at 08:25:39AM +0000, Frank Shearar wrote:
> >> On 09 Dec 2013, at 7:07, Nicolas Cellier <[hidden email]> wrote:
> >>
> >> > Yes, separating tests is a good practice and already almost universal practice in current Squeak, as well as in many 3rd party packages.
> >> >
> >> > If you don't want to create a specific package, then there is a blob named 'Tests' already, but I'd rather see this blob split into pieces. The reason is that if you want to test an image constructed from parts, you might want to test those parts exclusively.
> >> >
> >> >
> >> > 2013/12/9 Chris Muller <[hidden email]>
> >> > There has been a great effort headed up by Frank to organize behaviors
> >> > into a hierarchy of packages with no cyclic dependencies.  This is a
> >> > great goal and great effort.
> >> >
> >> > But the introduction of this new package (with just two classes)
> >> > prompts a need to understand what _all_ the goals are for this
> >> > process.  Certainly, everyone agrees we want no cyclic dependencies
> >> > between packages.
> >> >
> >> > But this extraction doesn't help that.  Nothing will ever depend on
> >> > ToolBuilderTests, so how does this new leaf of the package-dependency
> >> > hierarchy, justify its existence in cyberspace?
> >>
> >> ToolBuilder no longer depends on SUnit. I fail to see how that's bad.
> >>
> >> > Getting SUnit completely out of the image will mean ALL packages must
> >> > be split between their "-Kernel" and "-Tests" components.  Is that the
> >> > plan?
> >>
> >> I suppose eventually, yes. What's the point of unloading ST80 but leaving its tests in Tests?
> >
> > I do not understand your example. Which tests are you referring to?
> > I don't see any ST80 tests in the Tests category.
> >
> > I'm just asking for clarification.
>
> I'm using ST80 to illustrate what I want to see. ST80's tests are
> indeed in a separate package. Imagine that they were in Tests, though.
> Then you could only unload ST80 if you were prepared to accept a whole
> pile of broken tests. But since ST80's tests are in their own package,
> ST80 can be completely unloaded from an image.
>
> Conversely, imagine if XMLParser had tests, and those tests were in
> Tests. If I unloaded XMLParser, I'd have a bunch of tests failing
> because all of XMLParser's classes were missing.
>

OK, I understand now. Thanks.

Dave

Reply | Threaded
Open this post in threaded view
|

Re: modularity goals (was: The Trunk: ToolBuilderTests-fbs.1.mcz)

Chris Muller-3
In reply to this post by Frank Shearar-3
>> There has been a great effort headed up by Frank to organize behaviors
>> into a hierarchy of packages with no cyclic dependencies.  This is a
>> great goal and great effort.
>>
>> But the introduction of this new package (with just two classes)
>> prompts a need to understand what _all_ the goals are for this
>> process.  Certainly, everyone agrees we want no cyclic dependencies
>> between packages.
>>
>> But this extraction doesn't help that.  Nothing will ever depend on
>> ToolBuilderTests, so how does this new leaf of the package-dependency
>> hierarchy, justify its existence in cyberspace?
>
> ToolBuilder no longer depends on SUnit. I fail to see how that's bad.

Not "bad" -- where did you get that?  Frank, I hope you don't feel
badgered, my only goal in stimulating these discussions is to
establish and maintain consensus about _what_ we want from the
modularization effort, and _why_ we want it.  To wit:

  - What we want:  A coherent hierarchy of behaviors with no cycles
between the nodes of the hierarchy.
  - Why we want it (1):  Coherence and Reusability.  A system with
well-defined package responsibilities expresses its structure merely
by the delineation of behaviors chosen by the developers.
  - Why we want it (2):  Configuration.  Via the following manner:  1)
start with some "Core" (Kernel + Collections + Exceptions + a few
others), 2) ADD packages to it necessary for some vertical purpose.

  - ??  (anything else?)

I started this thread because this new package does not seem to
contribute toward the first three bullets.  That does not mean it
should not be done, only that as a community to give it due
consideration.

>> Getting SUnit completely out of the image will mean ALL packages must
>> be split between their "-Kernel" and "-Tests" components.  Is that the
>> plan?
>
> I suppose eventually, yes. What's the point of unloading ST80 but leaving
> its tests in Tests?

I never suggested anything close to that..

>> I'm not necessarily against it -- I'm just having trouble articulating
>> what's wrong with co-location of a package's tests, with the package
>> itself, and it depending on SUnit vs. not.  SUnit is not that big and
>> depends on nothing but Core.
>
> I do not understand why a GUI specification should depend on a test
> framework.

So one can run its tests and know that the GUI-specification is
performing correctly, of course!  :)  Before deploying an image to
production is a good time to run tests.

To which you might respond:  "So then load up SUnit and
ToolBuilderTests and run them, silly!"  But that's beside the question
of asking, "_why_ were they separated in the first place?"  Because it
wasn't for module reusability, nor to eliminate any dependency
cycles..

It keeps sounding like it's about "size".  That, even though we cannot
achieve optimal size, we can get "closer" to optimal with more and
smaller packages..  But at the cost of a more soupy package
hierarchy..

But you've said a few times it's not about size so...?

Reply | Threaded
Open this post in threaded view
|

Re: modularity goals (was: The Trunk: ToolBuilderTests-fbs.1.mcz)

Frank Shearar-3
On 9 December 2013 20:50, Chris Muller <[hidden email]> wrote:

>>> There has been a great effort headed up by Frank to organize behaviors
>>> into a hierarchy of packages with no cyclic dependencies.  This is a
>>> great goal and great effort.
>>>
>>> But the introduction of this new package (with just two classes)
>>> prompts a need to understand what _all_ the goals are for this
>>> process.  Certainly, everyone agrees we want no cyclic dependencies
>>> between packages.
>>>
>>> But this extraction doesn't help that.  Nothing will ever depend on
>>> ToolBuilderTests, so how does this new leaf of the package-dependency
>>> hierarchy, justify its existence in cyberspace?

I should have added - its status as a leaf is irrelevant to the topic,
because the most visible packages - applications like Magma, EToys,
and so on - will usually be leaves.

>> ToolBuilder no longer depends on SUnit. I fail to see how that's bad.
>
> Not "bad" -- where did you get that?  Frank, I hope you don't feel
> badgered, my only goal in stimulating these discussions is to
> establish and maintain consensus about _what_ we want from the
> modularization effort, and _why_ we want it.  To wit:
>
>   - What we want:  A coherent hierarchy of behaviors with no cycles
> between the nodes of the hierarchy.
>   - Why we want it (1):  Coherence and Reusability.  A system with
> well-defined package responsibilities expresses its structure merely
> by the delineation of behaviors chosen by the developers.
>   - Why we want it (2):  Configuration.  Via the following manner:  1)
> start with some "Core" (Kernel + Collections + Exceptions + a few
> others), 2) ADD packages to it necessary for some vertical purpose.
>
>   - ??  (anything else?)
>
> I started this thread because this new package does not seem to
> contribute toward the first three bullets.  That does not mean it
> should not be done, only that as a community to give it due
> consideration.

Bullet point 1 (coherence) contains an implicit principle - the
principle of least authority^Wdependency. That is, a package should
depend on other packages as little as possible. ToolBuilder doesn't
use SUnit, doesn't need SUnit, so shouldn't have a dependency on SUnit
forced just because of its tests.

>>> Getting SUnit completely out of the image will mean ALL packages must
>>> be split between their "-Kernel" and "-Tests" components.  Is that the
>>> plan?
>>
>> I suppose eventually, yes. What's the point of unloading ST80 but leaving
>> its tests in Tests?
>
> I never suggested anything close to that..

I was trying to answer your question about whether to bundle tests
together with the package. In this case, my point is, like I said to
David, that the tests of a package being in the Tests package means
that those packages can't be properly unloaded.

>>> I'm not necessarily against it -- I'm just having trouble articulating
>>> what's wrong with co-location of a package's tests, with the package
>>> itself, and it depending on SUnit vs. not.  SUnit is not that big and
>>> depends on nothing but Core.
>>
>> I do not understand why a GUI specification should depend on a test
>> framework.
>
> So one can run its tests and know that the GUI-specification is
> performing correctly, of course!  :)  Before deploying an image to
> production is a good time to run tests.

:) But of course you don't mean that the _specs_themselves_ should
depend on TestCase. But if you bundle the thing-under-test together
with the tests, you can't separate the two.

> To which you might respond:  "So then load up SUnit and
> ToolBuilderTests and run them, silly!"  But that's beside the question
> of asking, "_why_ were they separated in the first place?"  Because it
> wasn't for module reusability, nor to eliminate any dependency
> cycles..

In this particular case, it was for aesthetic reasons. It makes no
sense to me for ToolBuilder to depend on SUnit. SUnit contributes
nothing towards ToolBuilder's _functionality_. We already have a load
of Test packages - CollectionsTests, MorphicTests, HelpSystem-Tests,
ToolsTests, etc., so it seemed a no-brainer to add a ToolBuilderTests.

> It keeps sounding like it's about "size".  That, even though we cannot
> achieve optimal size, we can get "closer" to optimal with more and
> smaller packages..  But at the cost of a more soupy package
> hierarchy..
>
> But you've said a few times it's not about size so...?

It's about grouping things together things that belong together. Now,
I realise that Foo's tests belong with Foo, and they do, in a sense...
I suppose mainly I care very much about _these_ dependencies because
they're very low in the stack. If you wrote a Squeak application that
bundled its tests in the same package, well, that's OK. But it's OK
because its effect is limited to the application, not the entire
system.

I do appreciate your point that an excessive number of fine-grained
packages would be daunting to manage. I try not to create new
packages. In this case, it seemed like the natural thing to do.

frank

Reply | Threaded
Open this post in threaded view
|

Re: modularity goals (was: The Trunk: ToolBuilderTests-fbs.1.mcz)

Eliot Miranda-2
In reply to this post by Chris Muller-3



On Sun, Dec 8, 2013 at 4:34 PM, Chris Muller <[hidden email]> wrote:
There has been a great effort headed up by Frank to organize behaviors
into a hierarchy of packages with no cyclic dependencies.  This is a
great goal and great effort.

But the introduction of this new package (with just two classes)
prompts a need to understand what _all_ the goals are for this
process.  Certainly, everyone agrees we want no cyclic dependencies
between packages.

But this extraction doesn't help that.  Nothing will ever depend on
ToolBuilderTests, so how does this new leaf of the package-dependency
hierarchy, justify its existence in cyberspace?

Getting SUnit completely out of the image will mean ALL packages must
be split between their "-Kernel" and "-Tests" components.  Is that the
plan?

Well, splitting development from deployment is always important if the package in question is of the complexity that it has those two halves.  Whether splitting development into tests and non-tests development makes sense is a matter of taste ({deployment, development, tests} is better named but its also more tedious than {deployment, tests}, I can imaging people getting more confused when they can't develop a package without loading tests than without loading development).

This split is not merely academic.  It is also important.  Consider a substantial FFI, say to a database such as MySQL, or a graphics system such as OpenGL.  The development of these will depend on substantial tool support for parsing header files, etc, etc.  It's not reasonable to require that the deployment of such a beast entail deploying with the entire C development tools, which is likely what will happen without the separation.
 

I'm not necessarily against it -- I'm just having trouble articulating
what's wrong with co-location of a package's tests, with the package
itself, and it depending on SUnit vs. not.  SUnit is not that big and
depends on nothing but Core.

Cuz with complex packages it drags in complex development-time-only code (and itself may have secondary dependencies) that causes bloat.  Cuz separating deployment from development makes much clearer what the run-time, deployment deoendencies of the package are.  Cuz a small core is likely impracticably hard to build without this practice.


On Sat, Dec 7, 2013 at 1:49 PM,  <[hidden email]> wrote:
> Frank Shearar uploaded a new version of ToolBuilderTests to project The Trunk:
> http://source.squeak.org/trunk/ToolBuilderTests-fbs.1.mcz
>
> ==================== Summary ====================
>
> Name: ToolBuilderTests-fbs.1
> Author: fbs
> Time: 7 December 2013, 7:47:14.931 pm
> UUID: f75a55b6-ea0a-4b43-bf08-dfcf82dc99fb
> Ancestors:
>
> ToolBuilder SUnit tests.
>
> ==================== Snapshot ====================
>
> SystemOrganization addCategory: #ToolBuilderTests!
>
> TestCase subclass: #PluggableMenuItemSpecTests
>         instanceVariableNames: ''
>         classVariableNames: ''
>         poolDictionaries: ''
>         category: 'ToolBuilderTests'!
>
> ----- Method: PluggableMenuItemSpecTests>>testBeCheckableMakesItemCheckable (in category 'as yet unclassified') -----
> testBeCheckableMakesItemCheckable
>         | itemSpec |
>         itemSpec := PluggableMenuItemSpec new.
>         itemSpec beCheckable.
>         self assert: itemSpec isCheckable description: 'Item not checkable'.!
>
> ----- Method: PluggableMenuItemSpecTests>>testByDefaultNotCheckable (in category 'as yet unclassified') -----
> testByDefaultNotCheckable
>         | itemSpec |
>         itemSpec := PluggableMenuItemSpec new.
>         self deny: itemSpec isCheckable.!
>
> ----- Method: PluggableMenuItemSpecTests>>testNoMarkerMakesItemChecked (in category 'as yet unclassified') -----
> testNoMarkerMakesItemChecked
>         | itemSpec |
>         itemSpec := PluggableMenuItemSpec new.
>         itemSpec label: '<no>no'.
>         itemSpec analyzeLabel.
>         self assert: itemSpec isCheckable description: 'item not checkable'.
>         self deny: itemSpec checked description: 'item checked'.!
>
> ----- Method: PluggableMenuItemSpecTests>>testOffMarkerMakesItemChecked (in category 'as yet unclassified') -----
> testOffMarkerMakesItemChecked
>         | itemSpec |
>         itemSpec := PluggableMenuItemSpec new.
>         itemSpec label: '<off>off'.
>         itemSpec analyzeLabel.
>         self assert: itemSpec isCheckable description: 'item not checkable'.
>         self deny: itemSpec checked description: 'item checked'.!
>
> ----- Method: PluggableMenuItemSpecTests>>testOnMarkerMakesItemChecked (in category 'as yet unclassified') -----
> testOnMarkerMakesItemChecked
>         | itemSpec |
>         itemSpec := PluggableMenuItemSpec new.
>         itemSpec label: '<on>on'.
>         itemSpec analyzeLabel.
>         self assert: itemSpec isCheckable description: 'item not checkable'.
>         self assert: itemSpec isCheckable description: 'item not checked'.!
>
> ----- Method: PluggableMenuItemSpecTests>>testYesMarkerMakesItemChecked (in category 'as yet unclassified') -----
> testYesMarkerMakesItemChecked
>         | itemSpec |
>         itemSpec := PluggableMenuItemSpec new.
>         itemSpec label: '<yes>on'.
>         itemSpec analyzeLabel.
>         self assert: itemSpec isCheckable description: 'item not checkable'.
>         self assert: itemSpec isCheckable description: 'item not checked'.!
>
> TestCase subclass: #ToolBuilderTests
>         instanceVariableNames: 'builder widget queries'
>         classVariableNames: ''
>         poolDictionaries: ''
>         category: 'ToolBuilderTests'!
>
> !ToolBuilderTests commentStamp: 'ar 2/11/2005 15:01' prior: 0!
> Some tests to make sure ToolBuilder does what it says.!
>
> ----- Method: ToolBuilderTests class>>isAbstract (in category 'testing') -----
> isAbstract
>         ^self == ToolBuilderTests!
>
> ----- Method: ToolBuilderTests>>acceptWidgetText (in category 'support') -----
> acceptWidgetText
>         "accept text in widget"
>         ^ self subclassResponsibility!
>
> ----- Method: ToolBuilderTests>>assertItemFiresWith: (in category 'tests-menus') -----
> assertItemFiresWith: aBlock
>         | spec |
>         spec := builder pluggableMenuSpec new.
>         spec model: self.
>         aBlock value: spec.
>         widget := builder build: spec.
>         queries := IdentitySet new.
>         self fireMenuItemWidget.
>         self assert: (queries includes: #fireMenuAction)!
>
> ----- Method: ToolBuilderTests>>buttonWidgetEnabled (in category 'support') -----
> buttonWidgetEnabled
>         "Answer whether the current widget (a button) is currently enabled"
>
>         ^ widget getModelState!
>
> ----- Method: ToolBuilderTests>>changeListWidget (in category 'support') -----
> changeListWidget
>         "Change the list widget's selection index"
>         self subclassResponsibility!
>
> ----- Method: ToolBuilderTests>>expectedButtonSideEffects (in category 'support') -----
> expectedButtonSideEffects
>         "side effect queries we expect to see on buttons"
>         ^#()!
>
> ----- Method: ToolBuilderTests>>fireButton (in category 'tests-button') -----
> fireButton
>         queries add: #fireButton.!
>
> ----- Method: ToolBuilderTests>>fireButtonWidget (in category 'support') -----
> fireButtonWidget
>         "Fire the widget, e.g., perform what is needed for the guy to trigger its action"
>         self subclassResponsibility!
>
> ----- Method: ToolBuilderTests>>fireMenuAction (in category 'tests-menus') -----
> fireMenuAction
>         queries add: #fireMenuAction!
>
> ----- Method: ToolBuilderTests>>fireMenuItemWidget (in category 'tests-menus') -----
> fireMenuItemWidget
>         self subclassResponsibility!
>
> ----- Method: ToolBuilderTests>>getChildren (in category 'tests-panel') -----
> getChildren
>         queries add: #getChildren.
>         ^#()!
>
> ----- Method: ToolBuilderTests>>getChildrenOf: (in category 'tests-trees') -----
> getChildrenOf: item
>         queries add: #getChildrenOf.
>         ^(1 to: 9) asArray!
>
> ----- Method: ToolBuilderTests>>getColor (in category 'tests-text') -----
> getColor
>         queries add: #getColor.
>         ^Color tan!
>
> ----- Method: ToolBuilderTests>>getEnabled (in category 'tests-button') -----
> getEnabled
>         queries add: #getEnabled.
>         ^true!
>
> ----- Method: ToolBuilderTests>>getHelpOf: (in category 'tests-trees') -----
> getHelpOf: item
>         ^'help'!
>
> ----- Method: ToolBuilderTests>>getIconOf: (in category 'tests-trees') -----
> getIconOf: item
>         queries add: #getIconOf.
>         ^nil!
>
> ----- Method: ToolBuilderTests>>getLabel (in category 'tests-button') -----
> getLabel
>         queries add: #getLabel.
>         ^'TestLabel'!
>
> ----- Method: ToolBuilderTests>>getLabelOf: (in category 'tests-trees') -----
> getLabelOf: item
>         queries add: #getLabelOf.
>         ^item asString!
>
> ----- Method: ToolBuilderTests>>getList (in category 'tests-lists') -----
> getList
>         queries add: #getList.
>         ^(1 to: 100) collect:[:i| i printString].!
>
> ----- Method: ToolBuilderTests>>getListIndex (in category 'tests-lists') -----
> getListIndex
>         queries add: #getListIndex.
>         ^13!
>
> ----- Method: ToolBuilderTests>>getListSelection (in category 'tests-lists') -----
> getListSelection
>         queries add: #getListSelection.
>         ^'55'!
>
> ----- Method: ToolBuilderTests>>getMenu: (in category 'tests-lists') -----
> getMenu: aMenu
>         queries add: #getMenu.
>         ^aMenu!
>
> ----- Method: ToolBuilderTests>>getRoots (in category 'tests-trees') -----
> getRoots
>         queries add: #getRoots.
>         ^(1 to: 9) asArray!
>
> ----- Method: ToolBuilderTests>>getState (in category 'tests-button') -----
> getState
>         queries add: #getState.
>         ^true!
>
> ----- Method: ToolBuilderTests>>getText (in category 'tests-text') -----
> getText
>         queries add: #getText.
>         ^Text new!
>
> ----- Method: ToolBuilderTests>>getTextSelection (in category 'tests-text') -----
> getTextSelection
>         queries add: #getTextSelection.
>         ^(1 to: 0)!
>
> ----- Method: ToolBuilderTests>>getTreeSelectionPath (in category 'tests-trees') -----
> getTreeSelectionPath
>         queries add: #getTreeSelectionPath.
>         ^{2. 4. 3}!
>
> ----- Method: ToolBuilderTests>>hasChildren: (in category 'tests-trees') -----
> hasChildren: item
>         queries add: #hasChildren.
>         ^true!
>
> ----- Method: ToolBuilderTests>>keyPress: (in category 'tests-lists') -----
> keyPress: key
>         queries add: #keyPress.!
>
> ----- Method: ToolBuilderTests>>makeButton (in category 'tests-button') -----
> makeButton
>         | spec |
>         spec := self makeButtonSpec.
>         widget := builder build: spec.
>         ^widget!
>
> ----- Method: ToolBuilderTests>>makeButtonSpec (in category 'tests-button') -----
> makeButtonSpec
>         | spec |
>         spec := builder pluggableButtonSpec new.
>         spec name: #button.
>         spec model: self.
>         spec label: #getLabel.
>         spec color: #getColor.
>         spec state: #getState.
>         spec enabled: #getEnabled.
>         ^spec!
>
> ----- Method: ToolBuilderTests>>makeInputField (in category 'tests-input') -----
> makeInputField
>         | spec |
>         spec := self makeInputFieldSpec.
>         widget := builder build: spec.!
>
> ----- Method: ToolBuilderTests>>makeInputFieldSpec (in category 'tests-input') -----
> makeInputFieldSpec
>         | spec |
>         spec := builder pluggableInputFieldSpec new.
>         spec name: #input.
>         spec model: self.
>         spec getText: #getText.
>         spec selection: #getTextSelection.
>         spec color: #getColor.
>         "<-- the following cannot be tested very well -->"
>         spec setText: #setText:.
>         spec menu: #getMenu:.
>         ^spec!
>
> ----- Method: ToolBuilderTests>>makeItemList (in category 'tests-lists') -----
> makeItemList
>         | spec |
>         spec := self makeItemListSpec.
>         widget := builder build: spec.!
>
> ----- Method: ToolBuilderTests>>makeItemListSpec (in category 'tests-lists') -----
> makeItemListSpec
>         | spec |
>         spec := builder pluggableListSpec new.
>         spec name: #list.
>         spec model: self.
>         spec list: #getList.
>         spec getSelected: #getListSelection.
>         "<-- the following cannot be tested very well -->"
>         spec setSelected: #setListSelection:.
>         spec menu: #getMenu:.
>         spec keyPress: #keyPress:.
>         ^spec!
>
> ----- Method: ToolBuilderTests>>makeList (in category 'tests-lists') -----
> makeList
>         | spec |
>         spec := self makeListSpec.
>         widget := builder build: spec.!
>
> ----- Method: ToolBuilderTests>>makeListSpec (in category 'tests-lists') -----
> makeListSpec
>         | spec |
>         spec := builder pluggableListSpec new.
>         spec name: #list.
>         spec model: self.
>         spec list: #getList.
>         spec getIndex: #getListIndex.
>         "<-- the following cannot be tested very well -->"
>         spec setIndex: #setListIndex:.
>         spec menu: #getMenu:.
>         spec keyPress: #keyPress:.
>         ^spec!
>
> ----- Method: ToolBuilderTests>>makePanel (in category 'tests-panel') -----
> makePanel
>         | spec |
>         spec := self makePanelSpec.
>         widget := builder build: spec.!
>
> ----- Method: ToolBuilderTests>>makePanelSpec (in category 'tests-panel') -----
> makePanelSpec
>         | spec |
>         spec := builder pluggablePanelSpec new.
>         spec name: #panel.
>         spec model: self.
>         spec children: #getChildren.
>         ^spec!
>
> ----- Method: ToolBuilderTests>>makeText (in category 'tests-text') -----
> makeText
>         | spec |
>         spec := self makeTextSpec.
>         widget := builder build: spec.!
>
> ----- Method: ToolBuilderTests>>makeTextSpec (in category 'tests-text') -----
> makeTextSpec
>         | spec |
>         spec := builder pluggableTextSpec new.
>         spec name: #text.
>         spec model: self.
>         spec getText: #getText.
>         spec selection: #getTextSelection.
>         spec color: #getColor.
>         "<-- the following cannot be tested very well -->"
>         spec setText: #setText:.
>         spec menu: #getMenu:.
>         ^spec!
>
> ----- Method: ToolBuilderTests>>makeTree (in category 'tests-trees') -----
> makeTree
>         | spec |
>         spec := self makeTreeSpec.
>         widget := builder build: spec.!
>
> ----- Method: ToolBuilderTests>>makeTreeSpec (in category 'tests-trees') -----
> makeTreeSpec
>         | spec |
>         spec := builder pluggableTreeSpec new.
>         spec name: #tree.
>         spec model: self.
>         spec roots: #getRoots.
>         "<-- the following cannot be tested very well -->"
>         spec getSelectedPath: #getTreeSelectionPath.
>         spec getChildren: #getChildrenOf:.
>         spec hasChildren: #hasChildren:.
>         spec label: #getLabelOf:.
>         spec icon: #getIconOf:.
>         spec help: #getHelpOf:.
>         spec setSelected: #setTreeSelection:.
>         spec menu: #getMenu:.
>         spec keyPress: #keyPress:.
>         ^spec!
>
> ----- Method: ToolBuilderTests>>makeWindow (in category 'tests-window') -----
> makeWindow
>         | spec |
>         spec := self makeWindowSpec.
>         widget := builder build: spec.!
>
> ----- Method: ToolBuilderTests>>makeWindowSpec (in category 'tests-window') -----
> makeWindowSpec
>         | spec |
>         spec := builder pluggableWindowSpec new.
>         spec name: #window.
>         spec model: self.
>         spec children: #getChildren.
>         spec label: #getLabel.
>         spec closeAction: #noteWindowClosed.
>         ^spec!
>
> ----- Method: ToolBuilderTests>>noteWindowClosed (in category 'tests-window') -----
> noteWindowClosed
>         queries add: #noteWindowClosed.!
>
> ----- Method: ToolBuilderTests>>openWindow (in category 'tests-window') -----
> openWindow
>         | spec |
>         spec := self makeWindowSpec.
>         widget := builder open: spec.!
>
> ----- Method: ToolBuilderTests>>returnFalse (in category 'support') -----
> returnFalse
>         ^false!
>
> ----- Method: ToolBuilderTests>>returnTrue (in category 'support') -----
> returnTrue
>         ^true!
>
> ----- Method: ToolBuilderTests>>setListIndex: (in category 'tests-lists') -----
> setListIndex: index
>         queries add: #setListIndex.!
>
> ----- Method: ToolBuilderTests>>setListSelection: (in category 'tests-lists') -----
> setListSelection: newIndex
>         queries add: #setListSelection.!
>
> ----- Method: ToolBuilderTests>>setText: (in category 'tests-text') -----
> setText: newText
>         queries add: #setText.
>         ^false!
>
> ----- Method: ToolBuilderTests>>setTreeSelection: (in category 'tests-trees') -----
> setTreeSelection: node
>         queries add: #setTreeSelection.!
>
> ----- Method: ToolBuilderTests>>setUp (in category 'support') -----
> setUp
>         queries := IdentitySet new.!
>
> ----- Method: ToolBuilderTests>>shutDown (in category 'support') -----
> shutDown
>         self myDependents: nil!
>
> ----- Method: ToolBuilderTests>>testAddTargetSelectorArgumentList (in category 'tests-menus') -----
> testAddTargetSelectorArgumentList
>         self assertItemFiresWith:
>                 [:spec | spec
>                                 add: 'Menu Item'
>                                 target: self
>                                 selector: #fireMenuAction
>                                 argumentList: #()]!
>
> ----- Method: ToolBuilderTests>>testButtonFiresBlock (in category 'tests-button') -----
> testButtonFiresBlock
>         | spec |
>         spec := builder pluggableButtonSpec new.
>         spec model: self.
>         spec action: [self fireButton].
>         widget := builder build: spec.
>         queries := IdentitySet new.
>         self fireButtonWidget.
>         self assert: (queries includes: #fireButton).!
>
> ----- Method: ToolBuilderTests>>testButtonFiresMessage (in category 'tests-button') -----
> testButtonFiresMessage
>         | spec |
>         spec := builder pluggableButtonSpec new.
>         spec model: self.
>         spec action: (MessageSend receiver: self selector: #fireButton arguments: #()).
>         widget := builder build: spec.
>         queries := IdentitySet new.
>         self fireButtonWidget.
>         self assert: (queries includes: #fireButton).!
>
> ----- Method: ToolBuilderTests>>testButtonFiresSymbol (in category 'tests-button') -----
> testButtonFiresSymbol
>         | spec |
>         spec := builder pluggableButtonSpec new.
>         spec model: self.
>         spec action: #fireButton.
>         widget := builder build: spec.
>         queries := IdentitySet new.
>         self fireButtonWidget.
>         self assert: (queries includes: #fireButton).!
>
> ----- Method: ToolBuilderTests>>testButtonInitiallyDisabled (in category 'tests-button') -----
> testButtonInitiallyDisabled
>         | spec |
>         spec := builder pluggableButtonSpec new.
>         spec model: self.
>         spec label: #getLabel.
>         spec color: #getColor.
>         spec state: #getState.
>         spec enabled: #returnFalse.
>         widget := builder build: spec.
>         self deny: (self buttonWidgetEnabled)!
>
> ----- Method: ToolBuilderTests>>testButtonInitiallyDisabledSelector (in category 'tests-button') -----
> testButtonInitiallyDisabledSelector
>         | spec |
>         spec := builder pluggableButtonSpec new.
>         spec model: self.
>         spec label: #getLabel.
>         spec color: #getColor.
>         spec state: #getState.
>         spec enabled: #returnFalse.
>         widget := builder build: spec.
>         self deny: (self buttonWidgetEnabled)!
>
> ----- Method: ToolBuilderTests>>testButtonInitiallyEnabled (in category 'tests-button') -----
> testButtonInitiallyEnabled
>         | spec |
>         spec := builder pluggableButtonSpec new.
>         spec model: self.
>         spec label: #getLabel.
>         spec color: #getColor.
>         spec state: #getState.
>         spec enabled: #returnTrue.
>         widget := builder build: spec.
>         self assert: (self buttonWidgetEnabled)!
>
> ----- Method: ToolBuilderTests>>testButtonInitiallyEnabledSelector (in category 'tests-button') -----
> testButtonInitiallyEnabledSelector
>         | spec |
>         spec := builder pluggableButtonSpec new.
>         spec model: self.
>         spec label: #getLabel.
>         spec color: #getColor.
>         spec state: #getState.
>         spec enabled: #returnTrue.
>         widget := builder build: spec.
>         self assert: (self buttonWidgetEnabled)!
>
> ----- Method: ToolBuilderTests>>testButtonWidgetID (in category 'tests-button') -----
> testButtonWidgetID
>         self makeButton.
>         self assert: (builder widgetAt: #button) == widget.!
>
> ----- Method: ToolBuilderTests>>testGetButtonColor (in category 'tests-button') -----
> testGetButtonColor
>         self makeButton.
>         queries := IdentitySet new.
>         self changed: #getColor.
>         self assert: (queries includes: #getColor).
>         self assert: self widgetColor = self getColor.!
>
> ----- Method: ToolBuilderTests>>testGetButtonEnabled (in category 'tests-button') -----
> testGetButtonEnabled
>         self makeButton.
>         queries := IdentitySet new.
>         self changed: #getEnabled.
>         self assert: (queries includes: #getEnabled).!
>
> ----- Method: ToolBuilderTests>>testGetButtonLabel (in category 'tests-button') -----
> testGetButtonLabel
>         self makeButton.
>         queries := IdentitySet new.
>         self changed: #getLabel.
>         self assert: (queries includes: #getLabel).!
>
> ----- Method: ToolBuilderTests>>testGetButtonSideEffects (in category 'tests-button') -----
> testGetButtonSideEffects
>         self makeButton.
>         queries := IdentitySet new.
>         self changed: #testSignalWithNoDiscernableEffect.
>         self expectedButtonSideEffects do:[:sym|
>                 self assert: (queries includes: sym).
>                 queries remove: sym.
>         ].
>         self assert: queries isEmpty.!
>
> ----- Method: ToolBuilderTests>>testGetButtonState (in category 'tests-button') -----
> testGetButtonState
>         self makeButton.
>         queries := IdentitySet new.
>         self changed: #getState.
>         self assert: (queries includes: #getState).!
>
> ----- Method: ToolBuilderTests>>testGetInputFieldColor (in category 'tests-input') -----
> testGetInputFieldColor
>         self makeInputField.
>         queries := IdentitySet new.
>         self changed: #getColor.
>         self assert: (queries includes: #getColor).
>         self assert: self widgetColor = self getColor.!
>
> ----- Method: ToolBuilderTests>>testGetInputFieldSelection (in category 'tests-input') -----
> testGetInputFieldSelection
>         self makeInputField.
>         queries := IdentitySet new.
>         self changed: #getTextSelection.
>         self assert: (queries includes: #getTextSelection).!
>
> ----- Method: ToolBuilderTests>>testGetInputFieldSideEffectFree (in category 'tests-input') -----
> testGetInputFieldSideEffectFree
>         self makeInputField.
>         queries := IdentitySet new.
>         self changed: #testSignalWithNoDiscernableEffect.
>         self assert: queries isEmpty.!
>
> ----- Method: ToolBuilderTests>>testGetInputFieldText (in category 'tests-input') -----
> testGetInputFieldText
>         self makeInputField.
>         queries := IdentitySet new.
>         self changed: #getText.
>         self assert: (queries includes: #getText).!
>
> ----- Method: ToolBuilderTests>>testGetItemListSideEffectFree (in category 'tests-lists') -----
> testGetItemListSideEffectFree
>         self makeItemList.
>         queries := IdentitySet new.
>         self changed: #testSignalWithNoDiscernableEffect.
>         self assert: queries isEmpty.!
>
> ----- Method: ToolBuilderTests>>testGetList (in category 'tests-lists') -----
> testGetList
>         self makeList.
>         queries := IdentitySet new.
>         self changed: #getList.
>         self assert: (queries includes: #getList).!
>
> ----- Method: ToolBuilderTests>>testGetListIndex (in category 'tests-lists') -----
> testGetListIndex
>         self makeList.
>         queries := IdentitySet new.
>         self changed: #getListIndex.
>         self assert: (queries includes: #getListIndex).!
>
> ----- Method: ToolBuilderTests>>testGetListSelection (in category 'tests-lists') -----
> testGetListSelection
>         self makeItemList.
>         queries := IdentitySet new.
>         self changed: #getListSelection.
>         self assert: (queries includes: #getListSelection).!
>
> ----- Method: ToolBuilderTests>>testGetListSideEffectFree (in category 'tests-lists') -----
> testGetListSideEffectFree
>         self makeList.
>         queries := IdentitySet new.
>         self changed: #testSignalWithNoDiscernableEffect.
>         self assert: queries isEmpty.!
>
> ----- Method: ToolBuilderTests>>testGetPanelChildren (in category 'tests-panel') -----
> testGetPanelChildren
>         self makePanel.
>         queries := IdentitySet new.
>         self changed: #getChildren.
>         self assert: (queries includes: #getChildren).!
>
> ----- Method: ToolBuilderTests>>testGetPanelSideEffectFree (in category 'tests-panel') -----
> testGetPanelSideEffectFree
>         self makePanel.
>         queries := IdentitySet new.
>         self changed: #testSignalWithNoDiscernableEffect.
>         self assert: queries isEmpty.!
>
> ----- Method: ToolBuilderTests>>testGetText (in category 'tests-text') -----
> testGetText
>         self makeText.
>         queries := IdentitySet new.
>         self changed: #getText.
>         self assert: (queries includes: #getText).!
>
> ----- Method: ToolBuilderTests>>testGetTextColor (in category 'tests-text') -----
> testGetTextColor
>         self makeText.
>         queries := IdentitySet new.
>         self changed: #getColor.
>         self assert: (queries includes: #getColor).
>         self assert: self widgetColor = self getColor.!
>
> ----- Method: ToolBuilderTests>>testGetTextSelection (in category 'tests-text') -----
> testGetTextSelection
>         self makeText.
>         queries := IdentitySet new.
>         self changed: #getTextSelection.
>         self assert: (queries includes: #getTextSelection).!
>
> ----- Method: ToolBuilderTests>>testGetTextSideEffectFree (in category 'tests-text') -----
> testGetTextSideEffectFree
>         self makeText.
>         queries := IdentitySet new.
>         self changed: #testSignalWithNoDiscernableEffect.
>         self assert: queries isEmpty.!
>
> ----- Method: ToolBuilderTests>>testGetWindowChildren (in category 'tests-window') -----
> testGetWindowChildren
>         self makeWindow.
>         queries := IdentitySet new.
>         self changed: #getChildren.
>         self assert: (queries includes: #getChildren).!
>
> ----- Method: ToolBuilderTests>>testGetWindowLabel (in category 'tests-window') -----
> testGetWindowLabel
>         self makeWindow.
>         queries := IdentitySet new.
>         self changed: #getLabel.
>         self assert: (queries includes: #getLabel).!
>
> ----- Method: ToolBuilderTests>>testGetWindowSideEffectFree (in category 'tests-window') -----
> testGetWindowSideEffectFree
>         self makeWindow.
>         queries := IdentitySet new.
>         self changed: #testSignalWithNoDiscernableEffect.
>         self assert: queries isEmpty.!
>
> ----- Method: ToolBuilderTests>>testInputWidgetID (in category 'tests-input') -----
> testInputWidgetID
>         self makeInputField.
>         self assert: (builder widgetAt: #input) == widget.!
>
> ----- Method: ToolBuilderTests>>testItemListWidgetID (in category 'tests-lists') -----
> testItemListWidgetID
>         self makeItemList.
>         self assert: (builder widgetAt: #list) == widget.!
>
> ----- Method: ToolBuilderTests>>testListWidgetID (in category 'tests-lists') -----
> testListWidgetID
>         self makeList.
>         self assert: (builder widgetAt: #list) == widget.!
>
> ----- Method: ToolBuilderTests>>testPanelWidgetID (in category 'tests-panel') -----
> testPanelWidgetID
>         self makePanel.
>         self assert: (builder widgetAt: #panel) == widget.!
>
> ----- Method: ToolBuilderTests>>testSetInputField (in category 'tests-input') -----
> testSetInputField
>         self makeInputField.
>         queries := IdentitySet new.
>         self acceptWidgetText.
>         self assert: (queries includes: #setText).!
>
> ----- Method: ToolBuilderTests>>testSetListIndex (in category 'tests-lists') -----
> testSetListIndex
>         self makeList.
>         queries := IdentitySet new.
>         self changeListWidget.
>         self assert: (queries includes: #setListIndex).!
>
> ----- Method: ToolBuilderTests>>testSetListSelection (in category 'tests-lists') -----
> testSetListSelection
>         self makeItemList.
>         queries := IdentitySet new.
>         self changeListWidget.
>         self assert: (queries includes: #setListSelection).!
>
> ----- Method: ToolBuilderTests>>testSetText (in category 'tests-text') -----
> testSetText
>         self makeText.
>         queries := IdentitySet new.
>         self acceptWidgetText.
>         self assert: (queries includes: #setText).!
>
> ----- Method: ToolBuilderTests>>testTextWidgetID (in category 'tests-text') -----
> testTextWidgetID
>         self makeText.
>         self assert: (builder widgetAt: #text) == widget!
>
> ----- Method: ToolBuilderTests>>testTreeExpandPath (in category 'tests-trees') -----
> testTreeExpandPath
>         "@@@@: REMOVE THIS - it's a hack (changed: #openPath)"
>         self makeTree.
>         queries := IdentitySet new.
>         self changed: {#openPath. '4'. '2'. '3'}.
>         self waitTick.
>         self assert: (queries includes: #getChildrenOf).
>         self assert: (queries includes: #setTreeSelection).
>         self assert: (queries includes: #getLabelOf).
> !
>
> ----- Method: ToolBuilderTests>>testTreeExpandPathFirst (in category 'tests-trees') -----
> testTreeExpandPathFirst
>         "@@@@: REMOVE THIS - it's a hack (changed: #openPath)"
>         self makeTree.
>         queries := IdentitySet new.
>         self changed: {#openPath. '1'. '2'. '2'}.
>         self waitTick.
>         self assert: (queries includes: #getChildrenOf).
>         self assert: (queries includes: #setTreeSelection).
>         self assert: (queries includes: #getLabelOf).
> !
>
> ----- Method: ToolBuilderTests>>testTreeGetSelectionPath (in category 'tests-trees') -----
> testTreeGetSelectionPath
>         self makeTree.
>         queries := IdentitySet new.
>         self changed: #getTreeSelectionPath.
>         self waitTick.
>         self assert: (queries includes: #getTreeSelectionPath).
>         self assert: (queries includes: #getChildrenOf).
>         self assert: (queries includes: #setTreeSelection).
> !
>
> ----- Method: ToolBuilderTests>>testTreeRoots (in category 'tests-trees') -----
> testTreeRoots
>         self makeTree.
>         queries := IdentitySet new.
>         self changed: #getRoots.
>         self assert: (queries includes: #getRoots).!
>
> ----- Method: ToolBuilderTests>>testTreeWidgetID (in category 'tests-trees') -----
> testTreeWidgetID
>         self makeTree.
>         self assert: (builder widgetAt: #tree) == widget.!
>
> ----- Method: ToolBuilderTests>>testWindowCloseAction (in category 'tests-window') -----
> testWindowCloseAction
>         self openWindow.
>         builder close: widget.
>         self assert: (queries includes: #noteWindowClosed).!
>
> ----- Method: ToolBuilderTests>>testWindowID (in category 'tests-window') -----
> testWindowID
>         self makeWindow.
>         self assert: (builder widgetAt: #window) == widget.!
>
> ----- Method: ToolBuilderTests>>waitTick (in category 'support') -----
> waitTick
>         ^nil!
>
> ----- Method: ToolBuilderTests>>widgetColor (in category 'support') -----
> widgetColor
>         "Answer color from widget"
>         self subclassResponsibility
>
>         "NOTE: You can bail out if you don't know how to get the color from the widget:
>                 ^self getColor
>         will work."!
>
>




--
best,
Eliot


Reply | Threaded
Open this post in threaded view
|

Re: modularity goals (was: The Trunk: ToolBuilderTests-fbs.1.mcz)

Chris Muller-3
In reply to this post by Frank Shearar-3
I want you to know, several of my packages like Ma-Serialization and
Magma DO separate out a "-Tests" package from the core functionality
-- because they're biggish.  For me, it was only when the tests were
so minor in size that I decided I didn't warrant the extra "line item"
in the package list, file-directories, etc.

> I do appreciate your point that an excessive number of fine-grained
> packages would be daunting to manage. I try not to create new
> packages. In this case, it seemed like the natural thing to do.

I _am_ glad for what you said above.  We definitely agree it's a
natural thing to do, if not always the threshold of when we should do
it.  Not a big deal for "-Tests" packages.

>> So one can run its tests and know that the GUI-specification is
>> performing correctly, of course!  :)  Before deploying an image to
>> production is a good time to run tests.
>
> :) But of course you don't mean that the _specs_themselves_ should
> depend on TestCase. But if you bundle the thing-under-test together
> with the tests, you can't separate the two.

This is why I said earlier that stripping was not being given due consideration.

Shrinking/stripping activities are already a regular part of
Configuration-for-deployment.

Much less so for configuring a development image.  That's the time
when I "want everything" and as few complications as possible to get
there.

I can relent for this "-Tests" idiom but, mark my words Frank, I'm
watching you!  :)  If tiny new packages besides "-Tests" start
appearing, we'll be having this conversation again.

PS -- Since it was for aesthetic reasons, it would be better and more
consistent if it were named "ToolBuilder-Tests" instead of
"ToolBuilderTests".

Reply | Threaded
Open this post in threaded view
|

Re: modularity goals (was: The Trunk: ToolBuilderTests-fbs.1.mcz)

Eliot Miranda-2



On Mon, Dec 9, 2013 at 3:37 PM, Chris Muller <[hidden email]> wrote:
I want you to know, several of my packages like Ma-Serialization and
Magma DO separate out a "-Tests" package from the core functionality
-- because they're biggish.  For me, it was only when the tests were
so minor in size that I decided I didn't warrant the extra "line item"
in the package list, file-directories, etc.

> I do appreciate your point that an excessive number of fine-grained
> packages would be daunting to manage. I try not to create new
> packages. In this case, it seemed like the natural thing to do.

I _am_ glad for what you said above.  We definitely agree it's a
natural thing to do, if not always the threshold of when we should do
it.  Not a big deal for "-Tests" packages.

>> So one can run its tests and know that the GUI-specification is
>> performing correctly, of course!  :)  Before deploying an image to
>> production is a good time to run tests.
>
> :) But of course you don't mean that the _specs_themselves_ should
> depend on TestCase. But if you bundle the thing-under-test together
> with the tests, you can't separate the two.

This is why I said earlier that stripping was not being given due consideration.

Shrinking/stripping activities are already a regular part of
Configuration-for-deployment.

Much less so for configuring a development image.  That's the time
when I "want everything" and as few complications as possible to get
there.

I can relent for this "-Tests" idiom but, mark my words Frank, I'm
watching you!  :)  If tiny new packages besides "-Tests" start
appearing, we'll be having this conversation again.

PS -- Since it was for aesthetic reasons, it would be better and more
consistent if it were named "ToolBuilder-Tests" instead of
"ToolBuilderTests".

Sure, but then Monticello forces you to have as many packages as there are ToolBuilder-Foo thingies, right?  That's ok for ToolBuilder, but for Tools it doesn't fly.  It forces
Tools-Deployment-Base, Tools-Deployment-Browser, Tools-Deployment-Debugger et al so one can have Tools-Deployment & Tools-Tests.  This is better long-term (can pattern e.g. match off Foo-Deployment) but more work up-front than moving Tools-Tests to ToolsTests.

--
best,
Eliot