Skip to content

Commit

Permalink
Test cleanup and improved performance
Browse files Browse the repository at this point in the history
  • Loading branch information
Eric Winger authored and Eric Winger committed Nov 13, 2018
1 parent 303bbc5 commit 8fda9c4
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 18 deletions.
9 changes: 2 additions & 7 deletions sources/JadeiteAbstractTestCase.cls
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@ ensureRowanSample1Loaded
| projectService |
projectService := RowanProjectService new name: self sampleProjectName.
RowanBrowserService new reloadProjects: (Array with: projectService)
presenter: self projectsPresenter.
self projectsPresenter refreshFromServer!
presenter: self projectsPresenter.!

interestingLoopMethodSource
^'interestingLoop
Expand Down Expand Up @@ -263,12 +262,9 @@ setUp
session := JadeiteTestResource current session.
transcript := JadeiteTestResource current transcript.
projectsBrowser := JadeiteTestResource current projectsBrowser.
self projectsPresenter refreshFromServer.
self ensureRowanSample1Loaded. !

tearDown
super tearDown.
!

testsIssue: aSymbol withTitle: anObject
"send this to help identify which tests test which issues"

Expand Down Expand Up @@ -338,7 +334,6 @@ unloadSampleProject
!JadeiteAbstractTestCase categoriesFor: #selectServicesNamed:in:!private!project browser support!selection! !
!JadeiteAbstractTestCase categoriesFor: #serviceNamed:in:!private!selection! !
!JadeiteAbstractTestCase categoriesFor: #setUp!private!setup teardown! !
!JadeiteAbstractTestCase categoriesFor: #tearDown!private!setup teardown! !
!JadeiteAbstractTestCase categoriesFor: #testsIssue:withTitle:!issue test support!public!support! !
!JadeiteAbstractTestCase categoriesFor: #transcript!public!transcript support! !
!JadeiteAbstractTestCase categoriesFor: #transcriptProjectList!public!transcript support! !
Expand Down
1 change: 0 additions & 1 deletion sources/JadeiteDictionaryBrowserTestCase.cls
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ setUp

tearDown
super tearDown.
self abortTransaction.
dictionaryBrowser ifNotNil: [dictionaryBrowser destroy]!

test_browseReferencesInDictionaryBrowser
Expand Down
38 changes: 29 additions & 9 deletions sources/JadeiteProjectBrowserTestCase.cls
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@ JadeiteProjectBrowserTestCase comment: 'General Jadeite tests. Assumes a logged
!JadeiteProjectBrowserTestCase categoriesForClass!Unclassified! !
!JadeiteProjectBrowserTestCase methodsFor!

cloneRowanSample1
| sample1Path root |
sample1Path := self rowanSample1Path.
root := self rowanProjectsHome.
projectsBrowser currentCard basicCloneProject: sample1Path root: root.
self projectsPresenter refreshFromServer.!

disableTranscriptWrites
(transcriptWritesWereEnabled := transcript isTranscriptInstalled)
ifTrue: [transcript flipTranscript] "turn off gemstone transcript writes for performance"!
Expand Down Expand Up @@ -159,7 +166,9 @@ test_abortWithAbortedClassSelected
self assert: self projectsPresenter selectedClass name = 'TestClass'.
self projectsPresenter topShell abortTransaction.
self
assertIsNil: (self classListPresenter list detect: [:service | service name = 'TestClass'] ifNone: [])!
assertIsNil: (self classListPresenter list detect: [:service | service name = 'TestClass'] ifNone: []).
self cloneRowanSample1.
self ensureRowanSample1Loaded. !

test_addPackageReloadProject
self testsIssue: #issue183
Expand Down Expand Up @@ -1021,15 +1030,15 @@ test_projectDisplaysSync
stay sync'ed automaticall"

"project removal in projects browser"

self denyIsNil: (self projectNamed: 'RowanSample1').
self assert: self transcriptTab isKindOf: JadeiteProjectListPresenter.
self denyIsNil: (self transcriptProjectNamed: 'RowanSample1').
self unloadSampleProject.
self assertIsNil: (self projectNamed: 'RowanSample1').
self assertIsNil: (self transcriptProjectNamed: 'RowanSample1').
"project addition in projects browser"

self cloneRowanSample1.
self ensureRowanSample1Loaded.
[self denyIsNil: (self transcriptProjectNamed: 'RowanSample1').
self denyIsNil: (self projectNamed: 'RowanSample1')]
ensure: [self unloadSampleProject].
Expand All @@ -1044,8 +1053,10 @@ test_projectDisplaysSync
detect: [:projectService | projectService name = self sampleProjectName]
ifNone: []) notNil
ifTrue: [self transcriptTab basicUnloadProjects: (Array with: self sampleProjectName)].
self assertIsNil: (self projectNamed: 'RowanSample1').
self assertIsNil: (self transcriptProjectNamed: 'RowanSample1')!

[self assertIsNil: (self projectNamed: 'RowanSample1').
self assertIsNil: (self transcriptProjectNamed: 'RowanSample1')]
ensure: [self loadRowanSample1InProjectList]!

test_projectRemoved
"Gracefully remove a project from the project list if it was
Expand All @@ -1057,9 +1068,13 @@ test_projectRemoved
self denyIsNil: sampleProject.
self selectServicesNamed: (Array with: 'Rowan') in: self projectListPresenter.
session executeString: 'Rowan projectTools delete deleteProjectNamed: ''RowanSample1'''. "delete project behind tool's back"
self selectServicesNamed: (Array with: 'RowanSample1') in: self projectListPresenter. "expect project to disappear but not walkback"

[self selectServicesNamed: (Array with: 'RowanSample1') in: self projectListPresenter. "expect project to disappear but not walkback"
sampleProject := self projectNamed: 'RowanSample1'.
self assertIsNil: sampleProject!
self assertIsNil: sampleProject]
ensure:
[self cloneRowanSample1.
self ensureRowanSample1Loaded]!

test_refreshFromServer
self selectServicesNamed: (Array with: 'Rowan') in: self projectListPresenter.
Expand Down Expand Up @@ -1102,11 +1117,15 @@ test_removeProject
ifNone: [].
self assertIsNil: targetProject.
"make sure browser cleans itself up"
self assert: self projectListPresenter selections isEmpty.

[self assert: self projectListPresenter selections isEmpty.
self assert: self packageListPresenter list isEmpty.
self assert: self classListPresenter list isEmpty.
self assert: self categoryListPresenter list isEmpty.
self assert: self methodListPresenter list isEmpty!
self assert: self methodListPresenter list isEmpty]
ensure:
[self cloneRowanSample1.
self ensureRowanSample1Loaded]!

test_rowanTestsHierarchy

Expand Down Expand Up @@ -1344,6 +1363,7 @@ test_verifyValidCategory

waitForPresenter: presenter
[presenter list isEmpty] whileTrue: [(Delay forMilliseconds: 50) wait]! !
!JadeiteProjectBrowserTestCase categoriesFor: #cloneRowanSample1!private!project support! !
!JadeiteProjectBrowserTestCase categoriesFor: #disableTranscriptWrites!private! !
!JadeiteProjectBrowserTestCase categoriesFor: #issue170methodCreation!issue test support!private! !
!JadeiteProjectBrowserTestCase categoriesFor: #packageNamed:!private!project support! !
Expand Down
2 changes: 1 addition & 1 deletion sources/JadeiteTestResource.cls
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ setUp
session := GciSession allInstances detect: [:each | each isValidSession] ifNone: [].
transcript := JadeiteTranscript allInstances detect: [:tran | tran gciSession == session] ifNone: [].
projectsBrowser := self openWindow: [transcript openJadeiteProjectsBrowser].
self cloneRowanSample1!
self cloneRowanSample1.!

tearDown
super tearDown.
Expand Down

0 comments on commit 8fda9c4

Please sign in to comment.