Skip to content

Commit

Permalink
create desired test environment for every test in the suite. Remove i…
Browse files Browse the repository at this point in the history
…mplementations of runTestsBy:
  • Loading branch information
pavel-krivanek committed Nov 22, 2019
1 parent 882b055 commit 8354cb0
Show file tree
Hide file tree
Showing 11 changed files with 30 additions and 60 deletions.
7 changes: 3 additions & 4 deletions src/DrTests-CommentsToTests/DTCommentToTest.class.st
Expand Up @@ -87,10 +87,9 @@ DTCommentToTest >> runSuite: aTestSuite withResult: aResult [
DTCommentToTest >> runTestSuites: testSuites [
| result |
result := TestAsserter classForTestResult new.
CurrentExecutionEnvironment
runTestsBy: [ testSuites
do: [ :testSuite | self runSuite: testSuite withResult: result ]
displayingProgress: 'Running Tests' ].
testSuites
do: [ :testSuite | self runSuite: testSuite withResult: result ]
displayingProgress: 'Running Tests'.
^ result
]

Expand Down
7 changes: 3 additions & 4 deletions src/DrTests-TestCoverage/DTTestCoverage.class.st
Expand Up @@ -109,10 +109,9 @@ DTTestCoverage >> runSuite: aTestSuite withResult: aResult [
DTTestCoverage >> runTestSuites: testSuites [
| result |
result := TestAsserter classForTestResult new.
CurrentExecutionEnvironment
runTestsBy: [ testSuites
do: [ :testSuite | self runSuite: testSuite withResult: result ]
displayingProgress: 'Running Tests' ].
testSuites
do: [ :testSuite | self runSuite: testSuite withResult: result ]
displayingProgress: 'Running Tests'.
]

{ #category : #api }
Expand Down
8 changes: 3 additions & 5 deletions src/DrTests-TestsRunner/DTTestsRunner.class.st
Expand Up @@ -139,11 +139,9 @@ DTTestsRunner >> runSuite: aTestSuite withResult: aResult [
DTTestsRunner >> runTestSuites: testSuites [
|result|
result := TestAsserter classForTestResult new.
CurrentExecutionEnvironment runTestsBy: [
testSuites
do: [:testSuite | self runSuite: testSuite withResult: result ]
displayingProgress: 'Running Tests'
].
testSuites
do: [:testSuite | self runSuite: testSuite withResult: result ]
displayingProgress: 'Running Tests'.
^ result
]

Expand Down
9 changes: 6 additions & 3 deletions src/JenkinsTools-Core/HDTestReport.class.st
Expand Up @@ -169,9 +169,12 @@ HDTestReport >> run [

{ #category : #running }
HDTestReport >> runAll [
CurrentExecutionEnvironment runTestsBy: [
suite tests do: [ :each | each run: self ]
]

suite tests do: [ :aTestCase |
| testEnv |
testEnv := aTestCase executionEnvironmentClass new.
testEnv beActiveDuring: [
aTestCase run: self ] ]
]

{ #category : #running }
Expand Down
6 changes: 0 additions & 6 deletions src/SUnit-Core/CurrentExecutionEnvironment.extension.st
Expand Up @@ -6,9 +6,3 @@ CurrentExecutionEnvironment class >> runTestCase: aTestCase [
self value runTestCase: aTestCase

]

{ #category : #'*SUnit-Core' }
CurrentExecutionEnvironment class >> runTestsBy: aBlock [

self value runTestsBy: aBlock
]
6 changes: 0 additions & 6 deletions src/SUnit-Core/DefaultExecutionEnvironment.extension.st
Expand Up @@ -9,9 +9,3 @@ DefaultExecutionEnvironment >> runTestCase: aTestCase [
testEnv beActiveDuring: [
testEnv runTestCase: aTestCase]
]

{ #category : #'*SUnit-Core' }
DefaultExecutionEnvironment >> runTestsBy: aBlock [

TestExecutionEnvironment new beActiveDuring: aBlock
]
6 changes: 0 additions & 6 deletions src/SUnit-Core/ExecutionEnvironment.extension.st
Expand Up @@ -5,9 +5,3 @@ ExecutionEnvironment >> runTestCase: aTestCase [

self subclassResponsibility
]

{ #category : #'*SUnit-Core' }
ExecutionEnvironment >> runTestsBy: aBlock [

self subclassResponsibility
]
2 changes: 1 addition & 1 deletion src/SUnit-Core/TestCase.class.st
Expand Up @@ -821,5 +821,5 @@ TestCase >> tearDown [

{ #category : #accessing }
TestCase >> timeLimit: aDuration [
^TestExecutionEnvironment maxTimeForTest: aDuration
^CurrentExecutionEnvironment value maxTimeForTest: aDuration
]
12 changes: 0 additions & 12 deletions src/SUnit-Core/TestExecutionEnvironment.class.st
Expand Up @@ -54,12 +54,6 @@ TestExecutionEnvironment class >> fuelIgnoredInstanceVariableNames [
^#('watchDogProcess' 'watchDogSemaphore' 'forkedProcesses' 'failedProcesses')
]

{ #category : #controlling }
TestExecutionEnvironment class >> maxTimeForTest: aDuration [

CurrentExecutionEnvironment value maxTimeForTest: aDuration
]

{ #category : #controlling }
TestExecutionEnvironment class >> resetFailures [

Expand Down Expand Up @@ -197,12 +191,6 @@ TestExecutionEnvironment >> runTestCaseSafelly: aTestCase [
err pass ]
]

{ #category : #controlling }
TestExecutionEnvironment >> runTestsBy: aBlock [

aBlock value
]

{ #category : #accessing }
TestExecutionEnvironment >> testCase [
^ testCase
Expand Down
19 changes: 11 additions & 8 deletions src/SUnit-Core/TestSuite.class.st
Expand Up @@ -127,19 +127,22 @@ TestSuite >> run [

{ #category : #running }
TestSuite >> run: aResult [
CurrentExecutionEnvironment runTestsBy: [
self runUnmanaged: aResult ]

self runTestsInOnwEnvironments: aResult
]

{ #category : #running }
TestSuite >> runUnmanaged: aResult [
TestSuite >> runTestsInOnwEnvironments: aResult [
self setUp.
[ self tests
do: [ :each |
each run: aResult.
self announceTest: each.
self changed: each ] ]
ensure: [ self tearDown ]
do: [ :aTestCase |
| testEnv |
testEnv := aTestCase executionEnvironmentClass new.
testEnv beActiveDuring: [
aTestCase run: aResult.
self announceTest: aTestCase.
self changed: aTestCase ] ]
] ensure: [ self tearDown ]
]

{ #category : #running }
Expand Down
8 changes: 3 additions & 5 deletions src/SUnit-UI/TestRunner.class.st
Expand Up @@ -893,11 +893,9 @@ TestRunner >> runTest: aTestCase [

{ #category : #actions }
TestRunner >> runTestSuites: testSuites [
CurrentExecutionEnvironment runTestsBy: [
testSuites
do: [:testSuite | self runSuite: testSuite]
displayingProgress: 'Running Tests'
]
testSuites
do: [:testSuite | self runSuite: testSuite]
displayingProgress: 'Running Tests'
]

{ #category : #'history saving' }
Expand Down

0 comments on commit 8354cb0

Please sign in to comment.