Skip to content

Commit 623dd28

Browse files
author
Durieux Pol
committed
fix #98
1 parent fba74ed commit 623dd28

File tree

3 files changed

+20
-45
lines changed

3 files changed

+20
-45
lines changed

src/MuTalk-Model/MTAnalysis.class.st

+16-20
Original file line numberDiff line numberDiff line change
@@ -157,12 +157,13 @@ MTAnalysis >> generateResults [
157157
MTAnalysis >> initialTestRun [
158158
"Runs all tests once and filters them"
159159

160-
| results |
161-
results := testCases collect: [ :aTestCase | aTestCase run ].
162-
160+
testCases do: [ :aTestCase | aTestCase run ].
161+
163162
"The test filter is initialized lazily here because the default one needs the run time of tests, so the initial test run must be executed first"
164-
self testFilter validateFailuresIn: results.
165-
testCases := testFilter filterTests: testCases
163+
testCases := self testFilter filterTests: testCases.
164+
(testCases anySatisfy: [ :testCase |
165+
self testFilter failuresOrErrorsIn: testCase ]) ifTrue: [
166+
MTTestsWithErrorsException signal ]
166167
]
167168

168169
{ #category : 'initialization' }
@@ -275,21 +276,16 @@ MTAnalysis >> run [
275276
those classes) and execute all mutants in the set of testClases.
276277
We obtain a result for each mutant generated"
277278

278-
^ [
279-
self initialTestRun.
280-
"The budget is started after the initial test run because the default one needs the run time of tests"
281-
self startBudget.
282-
logger logAnalysisStartFor: self.
283-
elapsedTime := [
284-
self generateCoverageAnalysis.
285-
self generateMutations.
286-
self generateResults ] timeToRun.
287-
true ]
288-
on: MTTestsWithErrorsException
289-
do: [ :ex |
290-
self inform:
291-
'Your tests have Errors or Failures. Please correct them.'.
292-
false ]
279+
self initialTestRun.
280+
281+
"The budget is started after the initial test run because the default one needs the run time of tests"
282+
self startBudget.
283+
logger logAnalysisStartFor: self.
284+
285+
elapsedTime := [
286+
self generateCoverageAnalysis.
287+
self generateMutations.
288+
self generateResults ] timeToRun
293289
]
294290

295291
{ #category : 'starting' }

src/MuTalk-Model/MTRedTestFilter.class.st

+2-9
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Class {
1010
MTRedTestFilter >> excludedTestsFrom: aTestCaseCollection [
1111

1212
^ aTestCaseCollection select: [ :testCase |
13-
self failuresOrErrorsIn: testCase lastResult ]
13+
self failuresOrErrorsIn: testCase ]
1414
]
1515

1616
{ #category : 'accessing' }
@@ -23,12 +23,5 @@ MTRedTestFilter >> filteredTestReason [
2323
MTRedTestFilter >> filteredTestsFrom: aTestCaseCollection [
2424

2525
^ aTestCaseCollection reject: [ :testCase |
26-
self failuresOrErrorsIn: testCase lastResult ]
27-
]
28-
29-
{ #category : 'testing' }
30-
MTRedTestFilter >> unwantedFailuresOrErrorsIn: results [
31-
"It is not a problem if there are unwanted failures or errors because they will be filtered out anyway"
32-
33-
^ false
26+
self failuresOrErrorsIn: testCase ]
3427
]

src/MuTalk-Model/MTTestFilter.class.st

+2-16
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ MTTestFilter >> excludedTestsFrom: aTestCaseCollection [
3737
]
3838

3939
{ #category : 'testing' }
40-
MTTestFilter >> failuresOrErrorsIn: result [
40+
MTTestFilter >> failuresOrErrorsIn: testCase [
4141

42-
^ result failures isNotEmpty or: [ result unexpectedErrorCount > 0 ]
42+
^ testCase lastResult failures isNotEmpty or: [ testCase lastResult unexpectedErrorCount > 0 ]
4343
]
4444

4545
{ #category : 'enumerating' }
@@ -73,17 +73,3 @@ MTTestFilter >> filteredTestsFrom: aTestCaseCollection [
7373

7474
^ self subclassResponsibility
7575
]
76-
77-
{ #category : 'testing' }
78-
MTTestFilter >> unwantedFailuresOrErrorsIn: results [
79-
"Checks if the results contain failures or errors while they shouldn't"
80-
81-
^ results anySatisfy: [ :result | self failuresOrErrorsIn: result ]
82-
]
83-
84-
{ #category : 'checking' }
85-
MTTestFilter >> validateFailuresIn: results [
86-
87-
(self unwantedFailuresOrErrorsIn: results) ifTrue: [
88-
MTTestsWithErrorsException signal ]
89-
]

0 commit comments

Comments
 (0)