From a1e782ac9de55ad1e9dbf9085dc38bfe80a97912 Mon Sep 17 00:00:00 2001 From: hogoww Date: Tue, 27 Jul 2021 17:21:18 +0200 Subject: [PATCH 1/9] [improvement] move mutant execution logic to be able to rerun it --- src/MuTalk-Model/MethodMutation.class.st | 29 ++++++++++++++++++- src/MuTalk-Model/MutantEvaluation.class.st | 17 +++++++++-- src/MuTalk-Tests/MethodInstallerTest.class.st | 4 +-- src/MuTalk-Tests/MethodMutationTest.class.st | 27 ++++++++++++++++- 4 files changed, 70 insertions(+), 7 deletions(-) diff --git a/src/MuTalk-Model/MethodMutation.class.st b/src/MuTalk-Model/MethodMutation.class.st index b00aace8d86..1dad321d3fe 100644 --- a/src/MuTalk-Model/MethodMutation.class.st +++ b/src/MuTalk-Model/MethodMutation.class.st @@ -7,7 +7,8 @@ Class { 'operator', 'originalClass', 'mutatedNode', - 'nodeToMutate' + 'nodeToMutate', + 'testSuite' ], #category : 'MuTalk-Model' } @@ -125,6 +126,32 @@ MethodMutation >> printOn: aStream [ nextPutAll: originalMethod selector printString. ] +{ #category : #private } +MethodMutation >> run [ + ^ [ testSuite runStoppingOnFirstFailOrError ] + on: Error + do: [ :ex | nil ] +] + +{ #category : #running } +MethodMutation >> runMutant [ + + ^ [ + self install. + self run + ] ensure: [ self uninstall ] +] + +{ #category : #printing } +MethodMutation >> testSuite [ + ^ testSuite +] + +{ #category : #printing } +MethodMutation >> testSuite: aTestSuite [ + testSuite := aTestSuite +] + { #category : #installing } MethodMutation >> uninstall [ "UnInstall the mutant recompiling the original method into the class." diff --git a/src/MuTalk-Model/MutantEvaluation.class.st b/src/MuTalk-Model/MutantEvaluation.class.st index 150f094d97d..09c755f00c4 100644 --- a/src/MuTalk-Model/MutantEvaluation.class.st +++ b/src/MuTalk-Model/MutantEvaluation.class.st @@ -27,6 +27,16 @@ MutantEvaluation class >> for: aMutation using:aCollectionOftestCases following: ^self new initializeFor: aMutation using:aCollectionOftestCases following: aMutantEvaluationStrategy andConsidering: aCoverageAnalysisResult ] +{ #category : #private } +MutantEvaluation >> calculateTestSuite [ + "Collect all suite test and execute them." + | suite | + suite := TestSuite named: 'MutationEvaluation'. + suite addTests: ((strategy testCasesToEvaluate: mutation + for: self) collect: [ :each | each testCase ]). + ^ suite +] + { #category : #accessing } MutantEvaluation >> coverageAnalysisResult [ @@ -85,9 +95,10 @@ MutantEvaluation >> value [ Stdio stdout nextPutAll: mutation originalMethod name asString; lf; flush. self initializeCoverageResultIfNil. - testResults := [ mutation install. - self testResults ] - ensure: [ mutation uninstall ]. + + mutation testSuite: self calculateTestSuite. + testResults := mutation runMutant. + ^ MutantEvaluationResult for: mutation results: testResults diff --git a/src/MuTalk-Tests/MethodInstallerTest.class.st b/src/MuTalk-Tests/MethodInstallerTest.class.st index 310fb5df4f0..064062b0932 100644 --- a/src/MuTalk-Tests/MethodInstallerTest.class.st +++ b/src/MuTalk-Tests/MethodInstallerTest.class.st @@ -5,7 +5,7 @@ Class { 'anonymousClass', 'anonymousClassWithMethod' ], - #category : 'MuTalk-Tests' + #category : #'MuTalk-Tests' } { #category : #accessing } @@ -20,7 +20,7 @@ MethodInstallerTest >> methodInstalled [ ] -{ #category : #'test resources' } +{ #category : #'as yet unclassified' } MethodInstallerTest >> methodToUninstall [ ^self ] diff --git a/src/MuTalk-Tests/MethodMutationTest.class.st b/src/MuTalk-Tests/MethodMutationTest.class.st index 7fe07888d8c..45bd3c3a2af 100644 --- a/src/MuTalk-Tests/MethodMutationTest.class.st +++ b/src/MuTalk-Tests/MethodMutationTest.class.st @@ -1,9 +1,14 @@ Class { #name : #MethodMutationTest, #superclass : #TestCase, - #category : 'MuTalk-Tests' + #category : #'MuTalk-Tests' } +{ #category : #tests } +MethodMutationTest >> simpleTestCaseRessource [ + self assert: 1 + 1 equals: 2 +] + { #category : #'testing accessing' } MethodMutationTest >> testAccessing [ | compiledMethod operator modifiedSource methodMutation | @@ -52,3 +57,23 @@ MethodMutationTest >> testMutatedNodeBugFix [ self shouldnt: [ m mutatedNode ] raise: SubscriptOutOfBounds ] + +{ #category : #tests } +MethodMutationTest >> testMutationRun [ + | compiledMethod operator modifiedSource methodMutation res | + compiledMethod := AuxiliarClassForMutationTestingAnalysis + >> #methodWithOnePlusSender. + operator := ReplacePlusWithMinusMutantOperator new. + modifiedSource := operator + modifiedSourceFor: compiledMethod + number: 1. + methodMutation := MethodMutation + for: compiledMethod + using: operator + result: modifiedSource + ofClass: AuxiliarClassForMutationTestingAnalysis. + methodMutation testSuite: ((TestSuite named: 'test') addTests: { self class selector: #simpleTestCaseRessource}). + res := methodMutation runMutant. + + self assert: res runCount equals: 1. +] From 7b22178e4b451a6613db35fb5b8f4507ed880172 Mon Sep 17 00:00:00 2001 From: hogoww Date: Wed, 28 Jul 2021 13:28:56 +0200 Subject: [PATCH 2/9] [cleanup] bit of clearing up the naming --- src/MuTalk-Model/MethodMutation.class.st | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/MuTalk-Model/MethodMutation.class.st b/src/MuTalk-Model/MethodMutation.class.st index 1dad321d3fe..44a4e9d7a22 100644 --- a/src/MuTalk-Model/MethodMutation.class.st +++ b/src/MuTalk-Model/MethodMutation.class.st @@ -126,22 +126,22 @@ MethodMutation >> printOn: aStream [ nextPutAll: originalMethod selector printString. ] -{ #category : #private } -MethodMutation >> run [ - ^ [ testSuite runStoppingOnFirstFailOrError ] - on: Error - do: [ :ex | nil ] -] - { #category : #running } MethodMutation >> runMutant [ ^ [ self install. - self run + self runTests ] ensure: [ self uninstall ] ] +{ #category : #private } +MethodMutation >> runTests [ + ^ [ testSuite runStoppingOnFirstFailOrError ] + on: Error + do: [ :ex | nil ] +] + { #category : #printing } MethodMutation >> testSuite [ ^ testSuite From 994fbeff3cb90137ebf8badfc895ed2fd4dceb5f Mon Sep 17 00:00:00 2001 From: hogoww Date: Wed, 28 Jul 2021 15:55:10 +0200 Subject: [PATCH 3/9] part of cherry pick --- src/MuTalk-Model/MethodMutation.class.st | 27 +++++++++++++++++++ .../MutationTestingAnalysis.class.st | 2 +- src/MuTalk-Model/TestCaseReference.class.st | 15 ++++++++--- .../TestCaseReferenceTest.class.st | 4 +-- 4 files changed, 41 insertions(+), 7 deletions(-) diff --git a/src/MuTalk-Model/MethodMutation.class.st b/src/MuTalk-Model/MethodMutation.class.st index b00aace8d86..68088371542 100644 --- a/src/MuTalk-Model/MethodMutation.class.st +++ b/src/MuTalk-Model/MethodMutation.class.st @@ -125,6 +125,33 @@ MethodMutation >> printOn: aStream [ nextPutAll: originalMethod selector printString. ] +{ #category : #running } +MethodMutation >> runMutant [ + + ^ [ + self install. + self runTests + ] ensure: [ self uninstall ] +] + +{ #category : #private } +MethodMutation >> runTests [ + | results | + results := TestResultCollected new. + testCaseReferences collect: [ :tcr | results addAllResults: tcr runUnchecked ]. + ^ results +] + +{ #category : #private } +MethodMutation >> testCaseReferences [ + ^ testCaseReferences +] + +{ #category : #private } +MethodMutation >> testCaseReferences: aCollectionOfTestCaseReferences [ + testCaseReferences := aCollectionOfTestCaseReferences +] + { #category : #installing } MethodMutation >> uninstall [ "UnInstall the mutant recompiling the original method into the class." diff --git a/src/MuTalk-Model/MutationTestingAnalysis.class.st b/src/MuTalk-Model/MutationTestingAnalysis.class.st index 51926cda3a6..547c4c6e7f6 100644 --- a/src/MuTalk-Model/MutationTestingAnalysis.class.st +++ b/src/MuTalk-Model/MutationTestingAnalysis.class.st @@ -260,7 +260,7 @@ MutationTestingAnalysis >> run [ methods of those classes) and execute all mutants in the set of testClases. We obtain a result for each mutant generated" - ^[testCases do: [ :aTestCase | aTestCase run ]. + ^[testCases do: [ :aTestCase | aTestCase runChecked ]. logger logAnalysisStartFor:self. elapsedTime := Time millisecondsToRun: [ self generateCoverageAnalysis. diff --git a/src/MuTalk-Model/TestCaseReference.class.st b/src/MuTalk-Model/TestCaseReference.class.st index 7548df34d43..aa9ff970a5f 100644 --- a/src/MuTalk-Model/TestCaseReference.class.st +++ b/src/MuTalk-Model/TestCaseReference.class.st @@ -31,16 +31,23 @@ TestCaseReference >> resources [ { #category : #evaluating } TestCaseReference >> run [ + | result | + "kept for retrocompatibility" + ^ self runChecked +] + +{ #category : #evaluating } +TestCaseReference >> runChecked [ | result | result := self testCase run. - (result failuresSize > 0 or: [ result errorsSize > 0]) - ifTrue: [TestsWithErrorsException signal]. + (result failuresSize > 0 or: [ result errorsSize > 0 ]) + ifTrue: [ TestsWithErrorsException signalFor: self ]. ^ result ] { #category : #evaluating } -TestCaseReference >> run: aTestResult [ - ^self testCase run: aTestResult +TestCaseReference >> runUnchecked [ + ^ self testCase run ] { #category : #evaluating } diff --git a/src/MuTalk-Tests/TestCaseReferenceTest.class.st b/src/MuTalk-Tests/TestCaseReferenceTest.class.st index e2119b9f1fa..20efceb9b5c 100644 --- a/src/MuTalk-Tests/TestCaseReferenceTest.class.st +++ b/src/MuTalk-Tests/TestCaseReferenceTest.class.st @@ -1,7 +1,7 @@ Class { #name : #TestCaseReferenceTest, #superclass : #TestCase, - #category : 'MuTalk-Tests' + #category : #'MuTalk-Tests' } { #category : #resources } @@ -13,7 +13,7 @@ TestCaseReferenceTest >> test1 [ TestCaseReferenceTest >> testATestReferenceResult [ | testReference | testReference := self testReferenceForTest1. - self assert: testReference run errors isEmpty. + self assert: testReference runUnchecked errors isEmpty. ] From eb7db9f2c9aceef7fdb8891db7d6c2dbeb143713 Mon Sep 17 00:00:00 2001 From: hogoww Date: Wed, 28 Jul 2021 15:54:31 +0200 Subject: [PATCH 4/9] Cherry pick of [improvement] uses tests cases rather than test suites. Allows for more flexibility for other projects --- src/MuTalk-Model/MethodMutation.class.st | 3 ++- src/MuTalk-Model/MutantEvaluation.class.st | 7 +++---- src/MuTalk-Model/TestResult.extension.st | 9 +++++++++ src/MuTalk-Tests/MethodMutationTest.class.st | 20 ++++++++++++++++++++ 4 files changed, 34 insertions(+), 5 deletions(-) diff --git a/src/MuTalk-Model/MethodMutation.class.st b/src/MuTalk-Model/MethodMutation.class.st index 68088371542..721408cd713 100644 --- a/src/MuTalk-Model/MethodMutation.class.st +++ b/src/MuTalk-Model/MethodMutation.class.st @@ -7,7 +7,8 @@ Class { 'operator', 'originalClass', 'mutatedNode', - 'nodeToMutate' + 'nodeToMutate', + 'testCaseReferences' ], #category : 'MuTalk-Model' } diff --git a/src/MuTalk-Model/MutantEvaluation.class.st b/src/MuTalk-Model/MutantEvaluation.class.st index 150f094d97d..eb260ff9e8b 100644 --- a/src/MuTalk-Model/MutantEvaluation.class.st +++ b/src/MuTalk-Model/MutantEvaluation.class.st @@ -81,13 +81,12 @@ MutantEvaluation >> testResults [ { #category : #evaluation } MutantEvaluation >> value [ | testResults | - Stdio stdout nextPutAll: mutation originalMethod name asString; lf; flush. self initializeCoverageResultIfNil. - testResults := [ mutation install. - self testResults ] - ensure: [ mutation uninstall ]. + mutation testCaseReferences: (strategy testCasesToEvaluate: mutation for: self). + testResults := mutation runMutant. + ^ MutantEvaluationResult for: mutation results: testResults diff --git a/src/MuTalk-Model/TestResult.extension.st b/src/MuTalk-Model/TestResult.extension.st index 5306aca746d..9e6c2581f6c 100644 --- a/src/MuTalk-Model/TestResult.extension.st +++ b/src/MuTalk-Model/TestResult.extension.st @@ -1,5 +1,14 @@ Extension { #name : #TestResult } +{ #category : #'*MuTalk-Model' } +TestResult >> addAllResults: aTestResult [ + + failures addAll: aTestResult failures. + errors addAll: aTestResult errors. + passed addAll: aTestResult passed. + skipped addAll: aTestResult skipped. +] + { #category : #'*MuTalk-Model' } TestResult >> concreteErrors [ ^ errors diff --git a/src/MuTalk-Tests/MethodMutationTest.class.st b/src/MuTalk-Tests/MethodMutationTest.class.st index 7fe07888d8c..3f8031b9166 100644 --- a/src/MuTalk-Tests/MethodMutationTest.class.st +++ b/src/MuTalk-Tests/MethodMutationTest.class.st @@ -52,3 +52,23 @@ MethodMutationTest >> testMutatedNodeBugFix [ self shouldnt: [ m mutatedNode ] raise: SubscriptOutOfBounds ] + +{ #category : #tests } +MethodMutationTest >> testMutationRun [ + | compiledMethod operator modifiedSource methodMutation res | + compiledMethod := AuxiliarClassForMutationTestingAnalysis + >> #methodWithOnePlusSender. + operator := ReplacePlusWithMinusMutantOperator new. + modifiedSource := operator + modifiedSourceFor: compiledMethod + number: 1. + methodMutation := MethodMutation + for: compiledMethod + using: operator + result: modifiedSource + ofClass: AuxiliarClassForMutationTestingAnalysis. + methodMutation testCaseReferences: { TestCaseReference for: #simpleTestCaseRessource in: self class }. + res := methodMutation runMutant. + + self assert: res runCount equals: 1. +] \ No newline at end of file From 5de5cd945da7eb66b95968f421167be77c4d180b Mon Sep 17 00:00:00 2001 From: hogoww Date: Wed, 28 Jul 2021 15:54:31 +0200 Subject: [PATCH 5/9] [improvement] uses tests cases rather than test suites. Allows for more flexibility for other projects --- src/MuTalk-Model/MethodMutation.class.st | 14 +++++++------- src/MuTalk-Model/MutantEvaluation.class.st | 16 ++-------------- src/MuTalk-Model/TestResult.extension.st | 9 +++++++++ src/MuTalk-Tests/MethodMutationTest.class.st | 2 +- 4 files changed, 19 insertions(+), 22 deletions(-) diff --git a/src/MuTalk-Model/MethodMutation.class.st b/src/MuTalk-Model/MethodMutation.class.st index 44a4e9d7a22..1495c1e4ad3 100644 --- a/src/MuTalk-Model/MethodMutation.class.st +++ b/src/MuTalk-Model/MethodMutation.class.st @@ -8,7 +8,7 @@ Class { 'originalClass', 'mutatedNode', 'nodeToMutate', - 'testSuite' + 'testCaseReferences' ], #category : 'MuTalk-Model' } @@ -142,14 +142,14 @@ MethodMutation >> runTests [ do: [ :ex | nil ] ] -{ #category : #printing } -MethodMutation >> testSuite [ - ^ testSuite +{ #category : #private } +MethodMutation >> testCaseReferences [ + ^ testCaseReferences ] -{ #category : #printing } -MethodMutation >> testSuite: aTestSuite [ - testSuite := aTestSuite +{ #category : #private } +MethodMutation >> testCaseReferences: aCollectionOfTestCaseReferences [ + testCaseReferences := aCollectionOfTestCaseReferences ] { #category : #installing } diff --git a/src/MuTalk-Model/MutantEvaluation.class.st b/src/MuTalk-Model/MutantEvaluation.class.st index 09c755f00c4..d5e170d2258 100644 --- a/src/MuTalk-Model/MutantEvaluation.class.st +++ b/src/MuTalk-Model/MutantEvaluation.class.st @@ -27,16 +27,6 @@ MutantEvaluation class >> for: aMutation using:aCollectionOftestCases following: ^self new initializeFor: aMutation using:aCollectionOftestCases following: aMutantEvaluationStrategy andConsidering: aCoverageAnalysisResult ] -{ #category : #private } -MutantEvaluation >> calculateTestSuite [ - "Collect all suite test and execute them." - | suite | - suite := TestSuite named: 'MutationEvaluation'. - suite addTests: ((strategy testCasesToEvaluate: mutation - for: self) collect: [ :each | each testCase ]). - ^ suite -] - { #category : #accessing } MutantEvaluation >> coverageAnalysisResult [ @@ -91,14 +81,12 @@ MutantEvaluation >> testResults [ { #category : #evaluation } MutantEvaluation >> value [ | testResults | - Stdio stdout nextPutAll: mutation originalMethod name asString; lf; flush. self initializeCoverageResultIfNil. - - mutation testSuite: self calculateTestSuite. + mutation testCaseReferences: (strategy testCasesToEvaluate: mutation for: self). testResults := mutation runMutant. - + ^ MutantEvaluationResult for: mutation results: testResults diff --git a/src/MuTalk-Model/TestResult.extension.st b/src/MuTalk-Model/TestResult.extension.st index 5306aca746d..9e6c2581f6c 100644 --- a/src/MuTalk-Model/TestResult.extension.st +++ b/src/MuTalk-Model/TestResult.extension.st @@ -1,5 +1,14 @@ Extension { #name : #TestResult } +{ #category : #'*MuTalk-Model' } +TestResult >> addAllResults: aTestResult [ + + failures addAll: aTestResult failures. + errors addAll: aTestResult errors. + passed addAll: aTestResult passed. + skipped addAll: aTestResult skipped. +] + { #category : #'*MuTalk-Model' } TestResult >> concreteErrors [ ^ errors diff --git a/src/MuTalk-Tests/MethodMutationTest.class.st b/src/MuTalk-Tests/MethodMutationTest.class.st index 45bd3c3a2af..4b60f25da81 100644 --- a/src/MuTalk-Tests/MethodMutationTest.class.st +++ b/src/MuTalk-Tests/MethodMutationTest.class.st @@ -72,7 +72,7 @@ MethodMutationTest >> testMutationRun [ using: operator result: modifiedSource ofClass: AuxiliarClassForMutationTestingAnalysis. - methodMutation testSuite: ((TestSuite named: 'test') addTests: { self class selector: #simpleTestCaseRessource}). + methodMutation testCaseReferences: { TestCaseReference for: #simpleTestCaseRessource in: self class }. res := methodMutation runMutant. self assert: res runCount equals: 1. From 032dfa1c138846099a867bace63d9a8d1b2fcd67 Mon Sep 17 00:00:00 2001 From: hogoww Date: Wed, 28 Jul 2021 15:55:10 +0200 Subject: [PATCH 6/9] [improvement] differentiate between runChecked and runUnchecked. --- src/MuTalk-Model/MethodMutation.class.st | 7 ++++--- src/MuTalk-Model/MutationTestingAnalysis.class.st | 2 +- src/MuTalk-Model/TestCaseReference.class.st | 15 ++++++++++----- src/MuTalk-Tests/TestCaseReferenceTest.class.st | 4 ++-- 4 files changed, 17 insertions(+), 11 deletions(-) diff --git a/src/MuTalk-Model/MethodMutation.class.st b/src/MuTalk-Model/MethodMutation.class.st index 1495c1e4ad3..721408cd713 100644 --- a/src/MuTalk-Model/MethodMutation.class.st +++ b/src/MuTalk-Model/MethodMutation.class.st @@ -137,9 +137,10 @@ MethodMutation >> runMutant [ { #category : #private } MethodMutation >> runTests [ - ^ [ testSuite runStoppingOnFirstFailOrError ] - on: Error - do: [ :ex | nil ] + | results | + results := TestResultCollected new. + testCaseReferences collect: [ :tcr | results addAllResults: tcr runUnchecked ]. + ^ results ] { #category : #private } diff --git a/src/MuTalk-Model/MutationTestingAnalysis.class.st b/src/MuTalk-Model/MutationTestingAnalysis.class.st index 51926cda3a6..547c4c6e7f6 100644 --- a/src/MuTalk-Model/MutationTestingAnalysis.class.st +++ b/src/MuTalk-Model/MutationTestingAnalysis.class.st @@ -260,7 +260,7 @@ MutationTestingAnalysis >> run [ methods of those classes) and execute all mutants in the set of testClases. We obtain a result for each mutant generated" - ^[testCases do: [ :aTestCase | aTestCase run ]. + ^[testCases do: [ :aTestCase | aTestCase runChecked ]. logger logAnalysisStartFor:self. elapsedTime := Time millisecondsToRun: [ self generateCoverageAnalysis. diff --git a/src/MuTalk-Model/TestCaseReference.class.st b/src/MuTalk-Model/TestCaseReference.class.st index 7548df34d43..a2bc184bb80 100644 --- a/src/MuTalk-Model/TestCaseReference.class.st +++ b/src/MuTalk-Model/TestCaseReference.class.st @@ -30,17 +30,22 @@ TestCaseReference >> resources [ ] { #category : #evaluating } -TestCaseReference >> run [ +TestCaseReference >> run: aTestResult [ + ^self testCase run: aTestResult +] + +{ #category : #evaluating } +TestCaseReference >> runChecked [ | result | result := self testCase run. - (result failuresSize > 0 or: [ result errorsSize > 0]) - ifTrue: [TestsWithErrorsException signal]. + (result failuresSize > 0 or: [ result errorsSize > 0 ]) + ifTrue: [ TestsWithErrorsException signalFor: self ]. ^ result ] { #category : #evaluating } -TestCaseReference >> run: aTestResult [ - ^self testCase run: aTestResult +TestCaseReference >> runUnchecked [ + ^ self testCase run ] { #category : #evaluating } diff --git a/src/MuTalk-Tests/TestCaseReferenceTest.class.st b/src/MuTalk-Tests/TestCaseReferenceTest.class.st index e2119b9f1fa..20efceb9b5c 100644 --- a/src/MuTalk-Tests/TestCaseReferenceTest.class.st +++ b/src/MuTalk-Tests/TestCaseReferenceTest.class.st @@ -1,7 +1,7 @@ Class { #name : #TestCaseReferenceTest, #superclass : #TestCase, - #category : 'MuTalk-Tests' + #category : #'MuTalk-Tests' } { #category : #resources } @@ -13,7 +13,7 @@ TestCaseReferenceTest >> test1 [ TestCaseReferenceTest >> testATestReferenceResult [ | testReference | testReference := self testReferenceForTest1. - self assert: testReference run errors isEmpty. + self assert: testReference runUnchecked errors isEmpty. ] From 9688234bb93b6dcc46f1f95bf1668655abdfd3d7 Mon Sep 17 00:00:00 2001 From: hogoww Date: Wed, 28 Jul 2021 17:22:53 +0200 Subject: [PATCH 7/9] [improvement] add back #run and deprecate it for retrocompatibility --- src/MuTalk-Model/TestCaseReference.class.st | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/MuTalk-Model/TestCaseReference.class.st b/src/MuTalk-Model/TestCaseReference.class.st index a2bc184bb80..0254c117192 100644 --- a/src/MuTalk-Model/TestCaseReference.class.st +++ b/src/MuTalk-Model/TestCaseReference.class.st @@ -29,6 +29,14 @@ TestCaseReference >> resources [ ^self testCase resources ] +{ #category : #evaluating } +TestCaseReference >> run [ + "kept for retrocompatibility" + + self deprecated: 'Use #runChecked instead.' transformWith: '`@receiver run' -> '`@receiver runChecked'. + ^ self runChecked +] + { #category : #evaluating } TestCaseReference >> run: aTestResult [ ^self testCase run: aTestResult From 784c4dbcdfee125e6dea20d8db9c4202fbd34574 Mon Sep 17 00:00:00 2001 From: hogoww Date: Thu, 29 Jul 2021 15:01:29 +0200 Subject: [PATCH 8/9] [fix] add back implementation of runChecked, rather than an infinite loop --- src/MuTalk-Model/TestCaseReference.class.st | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/src/MuTalk-Model/TestCaseReference.class.st b/src/MuTalk-Model/TestCaseReference.class.st index 8a1e532eafc..5294119f52b 100644 --- a/src/MuTalk-Model/TestCaseReference.class.st +++ b/src/MuTalk-Model/TestCaseReference.class.st @@ -5,7 +5,7 @@ Class { 'class', 'selector' ], - #category : 'MuTalk-Model' + #category : #'MuTalk-Model' } { #category : #'instance creation' } @@ -44,14 +44,7 @@ TestCaseReference >> run: aTestResult [ { #category : #evaluating } TestCaseReference >> runChecked [ - | result | - "kept for retrocompatibility" - ^ self runChecked -] - -{ #category : #evaluating } -TestCaseReference >> runChecked [ - | result | + | result | result := self testCase run. (result failuresSize > 0 or: [ result errorsSize > 0 ]) ifTrue: [ TestsWithErrorsException signalFor: self ]. From 8d3fa0767a026cdee854247668ad03431a978138 Mon Sep 17 00:00:00 2001 From: hogoww Date: Thu, 29 Jul 2021 15:01:55 +0200 Subject: [PATCH 9/9] [fix] uses classForTestResult rather than direct reference to TestResult --- src/MuTalk-Model/MethodMutation.class.st | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/MuTalk-Model/MethodMutation.class.st b/src/MuTalk-Model/MethodMutation.class.st index 721408cd713..dcf317ba44c 100644 --- a/src/MuTalk-Model/MethodMutation.class.st +++ b/src/MuTalk-Model/MethodMutation.class.st @@ -10,7 +10,7 @@ Class { 'nodeToMutate', 'testCaseReferences' ], - #category : 'MuTalk-Model' + #category : #'MuTalk-Model' } { #category : #'instance creation' } @@ -138,7 +138,7 @@ MethodMutation >> runMutant [ { #category : #private } MethodMutation >> runTests [ | results | - results := TestResultCollected new. + results := TestAsserter classForTestResult new. testCaseReferences collect: [ :tcr | results addAllResults: tcr runUnchecked ]. ^ results ]