Skip to content

Commit

Permalink
Merge branch 'master' into fix/defaultBudget
Browse files Browse the repository at this point in the history
  • Loading branch information
guillep authored May 3, 2024
2 parents 5f571fd + 67456a5 commit ebc0898
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 44 deletions.
35 changes: 16 additions & 19 deletions src/MuTalk-Model/MTAnalysis.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -156,12 +156,13 @@ MTAnalysis >> generateResults [
MTAnalysis >> initialTestRun [
"Runs all tests once and filters them"

| results |
results := testCases collect: [ :aTestCase | aTestCase run ].

testCases do: [ :aTestCase | aTestCase run ].

"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"
self testFilter validateFailuresIn: results.
testCases := testFilter filterTests: testCases
testCases := self testFilter filterTests: testCases.
(testCases anySatisfy: [ :testCase |
self testFilter failuresOrErrorsIn: testCase ]) ifTrue: [
MTTestsWithErrorsException signal ]
]

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

^ [
self initialTestRun.
budget start.
logger logAnalysisStartFor: self.
elapsedTime := [
self generateCoverageAnalysis.
self generateMutations.
self generateResults ] timeToRun.
true ]
on: MTTestsWithErrorsException
do: [ :ex |
self inform:
'Your tests have Errors or Failures. Please correct them.'.
false ]
self initialTestRun.

"The budget is started after the initial test run because the default one needs the run time of tests"
budget start.
logger logAnalysisStartFor: self.

elapsedTime := [
self generateCoverageAnalysis.
self generateMutations.
self generateResults ] timeToRun
]

{ #category : 'accessing' }
Expand Down
11 changes: 2 additions & 9 deletions src/MuTalk-Model/MTRedTestFilter.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Class {
MTRedTestFilter >> excludedTestsFrom: aTestCaseCollection [

^ aTestCaseCollection select: [ :testCase |
self failuresOrErrorsIn: testCase lastResult ]
self failuresOrErrorsIn: testCase ]
]

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

^ aTestCaseCollection reject: [ :testCase |
self failuresOrErrorsIn: testCase lastResult ]
]

{ #category : 'testing' }
MTRedTestFilter >> unwantedFailuresOrErrorsIn: results [
"It is not a problem if there are unwanted failures or errors because they will be filtered out anyway"

^ false
self failuresOrErrorsIn: testCase ]
]
18 changes: 2 additions & 16 deletions src/MuTalk-Model/MTTestFilter.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ MTTestFilter >> excludedTestsFrom: aTestCaseCollection [
]

{ #category : 'testing' }
MTTestFilter >> failuresOrErrorsIn: result [
MTTestFilter >> failuresOrErrorsIn: testCase [

^ result failures isNotEmpty or: [ result unexpectedErrorCount > 0 ]
^ testCase lastResult failures isNotEmpty or: [ testCase lastResult unexpectedErrorCount > 0 ]
]

{ #category : 'enumerating' }
Expand Down Expand Up @@ -73,17 +73,3 @@ MTTestFilter >> filteredTestsFrom: aTestCaseCollection [

^ self subclassResponsibility
]

{ #category : 'testing' }
MTTestFilter >> unwantedFailuresOrErrorsIn: results [
"Checks if the results contain failures or errors while they shouldn't"

^ results anySatisfy: [ :result | self failuresOrErrorsIn: result ]
]

{ #category : 'checking' }
MTTestFilter >> validateFailuresIn: results [

(self unwantedFailuresOrErrorsIn: results) ifTrue: [
MTTestsWithErrorsException signal ]
]

0 comments on commit ebc0898

Please sign in to comment.