Skip to content

Commit

Permalink
Merge pull request #81 from guillep/termination
Browse files Browse the repository at this point in the history
Improve detection of terminated mutants
  • Loading branch information
guillep authored Feb 19, 2024
2 parents 11f7f26 + 73675ac commit ad184af
Show file tree
Hide file tree
Showing 22 changed files with 195 additions and 89 deletions.
7 changes: 4 additions & 3 deletions src/MuTalk-Model/MTAnalysis.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@ Class {
'mutantSelectionStrategy',
'testFilter'
],
#category : 'MuTalk-Model',
#package : 'MuTalk-Model'
#category : 'MuTalk-Model-Core',
#package : 'MuTalk-Model',
#tag : 'Core'
}

{ #category : 'defaults' }
Expand Down Expand Up @@ -655,7 +656,7 @@ MTAnalysis >> run [
do: [ :ex |
self inform:
'Your tests have Errors or Failures. Please correct them.'.
ex return: false ]
false ]
]

{ #category : 'accessing' }
Expand Down
5 changes: 3 additions & 2 deletions src/MuTalk-Model/MTCoverageAnalysis.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ Class {
'currentTest',
'testRunningElapsedTime'
],
#category : 'MuTalk-Model',
#package : 'MuTalk-Model'
#category : 'MuTalk-Model-Coverage',
#package : 'MuTalk-Model',
#tag : 'Coverage'
}

{ #category : 'instance creation' }
Expand Down
5 changes: 3 additions & 2 deletions src/MuTalk-Model/MTCoverageAnalysisResult.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ Class {
'timeToRunTests',
'methodReferences'
],
#category : 'MuTalk-Model',
#package : 'MuTalk-Model'
#category : 'MuTalk-Model-Coverage',
#package : 'MuTalk-Model',
#tag : 'Coverage'
}

{ #category : 'instance creation' }
Expand Down
5 changes: 3 additions & 2 deletions src/MuTalk-Model/MTCoverageTestSuiteSelector.class.st
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
Class {
#name : 'MTCoverageTestSuiteSelector',
#superclass : 'Object',
#category : 'MuTalk-Model',
#package : 'MuTalk-Model'
#category : 'MuTalk-Model-Coverage',
#package : 'MuTalk-Model',
#tag : 'Coverage'
}

{ #category : 'selecting' }
Expand Down
5 changes: 3 additions & 2 deletions src/MuTalk-Model/MTGeneralResult.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ Class {
'particularResults',
'elapsedTime'
],
#category : 'MuTalk-Model',
#package : 'MuTalk-Model'
#category : 'MuTalk-Model-Core',
#package : 'MuTalk-Model',
#tag : 'Core'
}

{ #category : 'instance creation' }
Expand Down
30 changes: 0 additions & 30 deletions src/MuTalk-Model/MTInfiniteRecursionError.class.st

This file was deleted.

5 changes: 3 additions & 2 deletions src/MuTalk-Model/MTMethodInstaller.class.st
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
Class {
#name : 'MTMethodInstaller',
#superclass : 'Object',
#category : 'MuTalk-Model',
#package : 'MuTalk-Model'
#category : 'MuTalk-Model-Core',
#package : 'MuTalk-Model',
#tag : 'Core'
}

{ #category : 'installing' }
Expand Down
5 changes: 3 additions & 2 deletions src/MuTalk-Model/MTMethodInstallerException.class.st
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
Class {
#name : 'MTMethodInstallerException',
#superclass : 'Error',
#category : 'MuTalk-Model',
#package : 'MuTalk-Model'
#category : 'MuTalk-Model-Core',
#package : 'MuTalk-Model',
#tag : 'Core'
}
35 changes: 27 additions & 8 deletions src/MuTalk-Model/MTMethodMutation.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ Class {
'originalProtocol',
'data'
],
#category : 'MuTalk-Model',
#package : 'MuTalk-Model'
#category : 'MuTalk-Model-Core',
#package : 'MuTalk-Model',
#tag : 'Core'
}

{ #category : 'instance creation' }
Expand Down Expand Up @@ -171,14 +172,32 @@ MTMethodMutation >> printOn: aStream [
]

{ #category : 'running' }
MTMethodMutation >> runMutantStoppingOnError: aBoolean [
MTMethodMutation >> runMutantStoppingOnError: aBoolean in: anEvaluation [

| testResults |
| testResults brokenTests |
[
EpMonitor disableDuring: [
[ self install.
testResults := self runTestsStoppingOnError: aBoolean
] ensure: [ self uninstall ] ].
^ testResults
testResults := [
self install.
self runTestsStoppingOnError: aBoolean ] ensure: [
self uninstall ] ] ]
on: Error
do: [ :error |
^ MTMutantEvaluationResultTerminated
newFor: self
results: error freeze
producedBy: anEvaluation ].

brokenTests := testResults errorsSize + testResults failuresSize.
brokenTests = 0 ifTrue: [
^ MTMutantEvaluationResultSurvived
newFor: self
results: testResults
producedBy: anEvaluation ].
^ MTMutantEvaluationResultKilled
newFor: self
results: testResults
producedBy: anEvaluation
]

{ #category : 'private' }
Expand Down
5 changes: 3 additions & 2 deletions src/MuTalk-Model/MTMethodWrapperForCoverage.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ Class {
'tests',
'coverageAnalysis'
],
#category : 'MuTalk-Model',
#package : 'MuTalk-Model'
#category : 'MuTalk-Model-Coverage',
#package : 'MuTalk-Model',
#tag : 'Coverage'
}

{ #category : 'instance creation' }
Expand Down
12 changes: 4 additions & 8 deletions src/MuTalk-Model/MTMutantEvaluation.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ Class {
'testCases',
'coverageAnalysisResult'
],
#category : 'MuTalk-Model',
#package : 'MuTalk-Model'
#category : 'MuTalk-Model-Core',
#package : 'MuTalk-Model',
#tag : 'Core'
}

{ #category : 'instance creation' }
Expand Down Expand Up @@ -76,14 +77,9 @@ MTMutantEvaluation >> testResults [
{ #category : 'evaluation' }
MTMutantEvaluation >> valueStoppingOnError: aBoolean [

| testResults |
self initializeCoverageResultIfNil.

mutation testCaseReferences:
(strategy testCasesToEvaluate: mutation for: self).
testResults := mutation runMutantStoppingOnError: aBoolean.
^ MTMutantEvaluationResult
for: mutation
results: testResults
producedBy: self
^ mutation runMutantStoppingOnError: aBoolean in: self
]
5 changes: 3 additions & 2 deletions src/MuTalk-Model/MTMutantKillingSuggestionGenerator.class.st
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
Class {
#name : 'MTMutantKillingSuggestionGenerator',
#superclass : 'Object',
#category : 'MuTalk-Model',
#package : 'MuTalk-Model'
#category : 'MuTalk-Model-Reporting',
#package : 'MuTalk-Model',
#tag : 'Reporting'
}

{ #category : 'evaluating' }
Expand Down

This file was deleted.

5 changes: 3 additions & 2 deletions src/MuTalk-Model/MTTestCaseReference.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ Class {
'selector',
'lastTimeToRun'
],
#category : 'MuTalk-Model',
#package : 'MuTalk-Model'
#category : 'MuTalk-Model-Core',
#package : 'MuTalk-Model',
#tag : 'Core'
}

{ #category : 'instance creation' }
Expand Down
5 changes: 3 additions & 2 deletions src/MuTalk-Model/MTTestSuiteWrappedForCoverage.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ Class {
#instVars : [
'coverageAnalysis'
],
#category : 'MuTalk-Model',
#package : 'MuTalk-Model'
#category : 'MuTalk-Model-Coverage',
#package : 'MuTalk-Model',
#tag : 'Coverage'
}

{ #category : 'instance creation' }
Expand Down
5 changes: 3 additions & 2 deletions src/MuTalk-Model/MTTestsWithErrorsException.class.st
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
Class {
#name : 'MTTestsWithErrorsException',
#superclass : 'Error',
#category : 'MuTalk-Model',
#package : 'MuTalk-Model'
#category : 'MuTalk-Model-Core',
#package : 'MuTalk-Model',
#tag : 'Core'
}
5 changes: 3 additions & 2 deletions src/MuTalk-Model/ManifestMuTalkModel.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ I store metadata for this package. These meta data are used by other tools such
Class {
#name : 'ManifestMuTalkModel',
#superclass : 'PackageManifest',
#category : 'MuTalk-Model',
#package : 'MuTalk-Model'
#category : 'MuTalk-Model-Core',
#package : 'MuTalk-Model',
#tag : 'Core'
}

{ #category : 'code-critics' }
Expand Down
12 changes: 12 additions & 0 deletions src/MuTalk-Tests/MTFailedInstallMethodMutation.class.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Class {
#name : 'MTFailedInstallMethodMutation',
#superclass : 'MTMethodMutation',
#category : 'MuTalk-Tests',
#package : 'MuTalk-Tests'
}

{ #category : 'installing' }
MTFailedInstallMethodMutation >> install [

self error
]
12 changes: 12 additions & 0 deletions src/MuTalk-Tests/MTFailedRunMethodMutation.class.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Class {
#name : 'MTFailedRunMethodMutation',
#superclass : 'MTMethodMutation',
#category : 'MuTalk-Tests',
#package : 'MuTalk-Tests'
}

{ #category : 'private' }
MTFailedRunMethodMutation >> runTestsStoppingOnError: aBoolean [

self error
]
12 changes: 12 additions & 0 deletions src/MuTalk-Tests/MTFailedUninstallMethodMutation.class.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Class {
#name : 'MTFailedUninstallMethodMutation',
#superclass : 'MTMethodMutation',
#category : 'MuTalk-Tests',
#package : 'MuTalk-Tests'
}

{ #category : 'installing' }
MTFailedUninstallMethodMutation >> uninstall [

self error
]
Loading

0 comments on commit ad184af

Please sign in to comment.