diff --git a/src/MuTalk-CI-Tests/MTCoveragePropagationPreparationTest.class.st b/src/MuTalk-CI-Tests/MTCoveragePropagationPreparationTest.class.st index d808a574..b5f22b69 100644 --- a/src/MuTalk-CI-Tests/MTCoveragePropagationPreparationTest.class.st +++ b/src/MuTalk-CI-Tests/MTCoveragePropagationPreparationTest.class.st @@ -14,7 +14,8 @@ MTCoveragePropagationPreparationTest >> testWorking [ | analysis moreInfo mutant | analysis := MTAnalysis new testClasses: { MTCIHelperTest }; - classesToMutate: { MTCIHelper }. + classesToMutate: { MTCIHelper }; + budget: MTFreeBudget new. analysis run. moreInfo := MTCoveragePropagationPreparation new diff --git a/src/MuTalk-Model/MTAbstractMutantOperator.class.st b/src/MuTalk-Model/MTAbstractMutantOperator.class.st index 929259fe..48df435b 100644 --- a/src/MuTalk-Model/MTAbstractMutantOperator.class.st +++ b/src/MuTalk-Model/MTAbstractMutantOperator.class.st @@ -9,8 +9,7 @@ Class { { #category : 'accessing' } MTAbstractMutantOperator class >> allConcreteSubclasses [ - ^ self allSubclasses reject: [ :ea | - ea isAbstract | ea isOriginalOperator not ] + ^ self allSubclasses reject: #isAbstract ] { #category : 'accessing' } @@ -22,28 +21,12 @@ MTAbstractMutantOperator class >> contents [ elem1 description <= elem2 description ] ] -{ #category : 'accessing' } -MTAbstractMutantOperator class >> contentsAll [ - "This returns all operators (block based and traditional) " - - ^ ((self allSubclasses reject: [ :ea | - ea isAbstract or: [ ea isDeprecated ] ]) collect: [ :class | - class new ]) asSortedCollection: [ :elem1 :elem2 | - elem1 description <= elem2 description ] -] - { #category : 'testing' } MTAbstractMutantOperator class >> isAbstract [ ^ self == MTAbstractMutantOperator ] -{ #category : 'testing' } -MTAbstractMutantOperator class >> isOriginalOperator [ - - ^ true -] - { #category : 'as yet unclassified' } MTAbstractMutantOperator class >> recursionsDetectionStatement [ diff --git a/src/MuTalk-Model/MTAnalysis.class.st b/src/MuTalk-Model/MTAnalysis.class.st index c1191886..03786808 100644 --- a/src/MuTalk-Model/MTAnalysis.class.st +++ b/src/MuTalk-Model/MTAnalysis.class.st @@ -53,20 +53,21 @@ MTAnalysis >> coverageAnalysisResult: anObject [ { #category : 'accessing - defaults' } MTAnalysis >> defaultBudget [ + "Since tests often take little time to run, we multiply it by 30" - ^ MTFreeBudget new + ^ MTTimeBudget for: self totalTestsTime * 30 ] { #category : 'accessing - defaults' } MTAnalysis >> defaultLogger [ - ^ MTNullLogger new + ^ MTTranscriptLogger new ] { #category : 'accessing - defaults' } MTAnalysis >> defaultMutantGenerationStrategy [ - ^ MTAllMutantGenerationStrategy new + ^ MTAllMutantGenerationStrategy withRandomOperatorMutantSelection ] { #category : 'accessing - defaults' } @@ -78,13 +79,20 @@ MTAnalysis >> defaultOperators [ { #category : 'accessing - defaults' } MTAnalysis >> defaultTestFilter [ - ^ MTFreeTestFilter new + | times | + times := testCases collect: #lastTimeToRun. + (times anySatisfy: #isNil) ifTrue: [ + ^ Error signal: + 'Either there is no test cases, or the initial test run has not been executed yet' ]. + ^ MTCompositeTestFilter for: { + MTRedTestFilter new. + (MTTimeTestFilter for: (self percentile: 90 for: times sorted)) } ] { #category : 'accessing - defaults' } MTAnalysis >> defaultTestSelectionStrategy [ - ^ MTAllTestsMethodsRunningTestSelectionStrategy new + ^ MTSelectingFromCoverageTestSelectionStrategy new ] { #category : 'accessing' } @@ -151,7 +159,9 @@ MTAnalysis >> initialTestRun [ | results | results := testCases collect: [ :aTestCase | aTestCase run ]. - testFilter validateFailuresIn: results. + + "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 ] @@ -165,8 +175,6 @@ MTAnalysis >> initialize [ mutantResults := OrderedCollection new. elapsedTime := 0. logger := self defaultLogger. - budget := self defaultBudget. - testFilter := self defaultTestFilter. stopOnErrorOrFail := true ] @@ -223,6 +231,13 @@ MTAnalysis >> mutations: anObject [ mutations := anObject ] +{ #category : 'initialization' } +MTAnalysis >> noLimitations [ + + budget := MTFreeBudget new. + testFilter := MTFreeTestFilter new +] + { #category : 'accessing' } MTAnalysis >> operators [ @@ -242,6 +257,17 @@ MTAnalysis >> packagesToMutate: aCollectionOfPackages [ packageName asPackage definedClasses ] ] +{ #category : 'computing' } +MTAnalysis >> percentile: aPercentage for: aCollection [ + + | size index | + aCollection isEmpty ifTrue: [ + ^ CollectionIsEmpty signalWith: aCollection ]. + size := aCollection size. + index := (aPercentage percent * size) rounded. + ^ aCollection at: index +] + { #category : 'running' } MTAnalysis >> run [ "Obtain mutants applying the operators in the classes (or @@ -250,8 +276,9 @@ MTAnalysis >> run [ We obtain a result for each mutant generated" ^ [ - budget start. self initialTestRun. + "The budget is started after the initial test run because the default one needs the run time of tests" + self startBudget. logger logAnalysisStartFor: self. elapsedTime := [ self generateCoverageAnalysis. @@ -265,6 +292,14 @@ MTAnalysis >> run [ false ] ] +{ #category : 'starting' } +MTAnalysis >> startBudget [ + "The budget is initialized here because the default one needs the run time of tests, so the initial test run must be executed first" + + budget ifNil: [ budget := self defaultBudget ]. + budget start +] + { #category : 'accessing' } MTAnalysis >> stopOnErrorOrFail: aBoolean [ @@ -292,12 +327,17 @@ MTAnalysis >> testCases: anObject [ { #category : 'accessing' } MTAnalysis >> testCasesFrom: aClassCollection [ - ^ aClassCollection - inject: OrderedCollection new - into: [ :testCase :testClass | - testClass isAbstract ifFalse: [ - testCase addAll: (self testCasesReferencesFrom: testClass) ]. - testCase ] + | tests | + tests := aClassCollection + inject: OrderedCollection new + into: [ :testCase :testClass | + testClass isAbstract ifFalse: [ + testCase addAll: + (self testCasesReferencesFrom: testClass) ]. + testCase ]. + tests isEmpty ifTrue: [ + Warning signal: 'There is currently no tests' ]. + ^ tests ] { #category : 'tests' } @@ -316,7 +356,7 @@ MTAnalysis >> testClasses: aClassCollection [ { #category : 'accessing' } MTAnalysis >> testFilter [ - ^ testFilter + ^ testFilter ifNil: [ testFilter := self defaultTestFilter ] ] { #category : 'accessing' } @@ -346,3 +386,13 @@ MTAnalysis >> testSelectionStrategy: anObject [ testSelectionStrategy := anObject ] + +{ #category : 'accessing' } +MTAnalysis >> totalTestsTime [ + + | times | + times := testCases collect: #lastTimeToRun. + (times anySatisfy: #isNil) ifTrue: [ + ^ Error signal: 'The initial test run has not been executed yet' ]. + ^ times reduce: [ :t1 :t2 | t1 + t2 ] +] diff --git a/src/MuTalk-Model/MTPredicateBasedMutantOperator.class.st b/src/MuTalk-Model/MTPredicateBasedMutantOperator.class.st index 26a413c8..4eafb905 100644 --- a/src/MuTalk-Model/MTPredicateBasedMutantOperator.class.st +++ b/src/MuTalk-Model/MTPredicateBasedMutantOperator.class.st @@ -12,11 +12,6 @@ MTPredicateBasedMutantOperator class >> isAbstract [ ^ self == MTPredicateBasedMutantOperator ] -{ #category : 'testing' } -MTPredicateBasedMutantOperator class >> isOriginalOperator [ - ^ false -] - { #category : 'private' } MTPredicateBasedMutantOperator >> affectedNodeFor: aParseTree at: nodeIndex [ diff --git a/src/MuTalk-Tests/MTAnalysisLoggerTest.class.st b/src/MuTalk-Tests/MTAnalysisLoggerTest.class.st index ea6e7752..45219a3c 100644 --- a/src/MuTalk-Tests/MTAnalysisLoggerTest.class.st +++ b/src/MuTalk-Tests/MTAnalysisLoggerTest.class.st @@ -17,7 +17,8 @@ MTAnalysisLoggerTest >> testExecutingSimpleMutation [ classesToMutate: (Array with: MTAuxiliarClassForMTAnalysis); operators: (Array with: operator); - logger: logger. + logger: logger; + budget: MTFreeBudget new. analysis run. self assert: logger loggedStartAnalysis. self assert: (logger diff --git a/src/MuTalk-Tests/MTAnalysisTest.class.st b/src/MuTalk-Tests/MTAnalysisTest.class.st index 74b71c77..486a923d 100644 --- a/src/MuTalk-Tests/MTAnalysisTest.class.st +++ b/src/MuTalk-Tests/MTAnalysisTest.class.st @@ -74,17 +74,53 @@ MTAnalysisTest >> testCorrectNumberOfTestCasesWithParametrizedTestCase [ MTAnalysisTest >> testDefaultParameters [ | analysis | - analysis := MTAnalysis new. + analysis := MTAnalysis new testClasses: + { MTAuxiliarClassForMTAnalysisTest }. + analysis initialTestRun. self assert: (analysis operators collect: [ :op | op species ]) - equals: (MTAbstractMutantOperator contents collect: [ :op | op species ]). + equals: + (MTAbstractMutantOperator contents collect: [ :op | op species ]). self assert: analysis mutantGenerationStrategy species equals: MTAllMutantGenerationStrategy. self assert: analysis testSelectionStrategy species - equals: MTAllTestsMethodsRunningTestSelectionStrategy. - self assert: analysis budget species equals: MTFreeBudget + equals: MTSelectingFromCoverageTestSelectionStrategy. + self assert: analysis defaultBudget species equals: MTTimeBudget +] + +{ #category : 'tests' } +MTAnalysisTest >> testErrorWhenInitializingDefaultTestFilterBeforeInitialTestRun [ + + | analysis | + analysis := MTAnalysis new + classesToMutate: { MTAuxiliarClassForMTAnalysis }; + testClasses: { MTAuxiliarClassForMTAnalysisTest }. + + self should: [ analysis initializeTestFilter ] raise: Error +] + +{ #category : 'tests' } +MTAnalysisTest >> testErrorWhenStartingDefaultBudgetBeforeInitialTestRun [ + + | analysis | + analysis := MTAnalysis new + classesToMutate: { MTAuxiliarClassForMTAnalysis }; + testClasses: { MTAuxiliarClassForMTAnalysisTest }. + + self should: [ analysis startBudget ] raise: Error +] + +{ #category : 'tests' } +MTAnalysisTest >> testErrorWhenTryingToGetPercentileOfEmptyCollection [ + + | analysis | + analysis := MTAnalysis new. + + self + should: [ analysis percentile: 1 for: { } ] + raise: Error ] { #category : 'testing' } @@ -98,7 +134,8 @@ MTAnalysisTest >> testExecutingInfiniteLoopAnalysis [ analysis := MTAnalysis new testClasses: { MTFakeInfiniteLoopsTest }; classesToMutate: { MTFakeInfiniteLoopForTest }; - operators: { MTReplaceLessOrEqualWithTrueOperator new }. + operators: { MTReplaceLessOrEqualWithTrueOperator new }; + noLimitations. analysis run. @@ -120,7 +157,8 @@ MTAnalysisTest >> testExecutingInfiniteRecursionAnalysis [ testClasses: { MTFakeInfiniteLoopsTest }; classesToMutate: { MTFakeInfiniteLoopForTest }; operators: - { MTReplaceIfTrueReceiverWithFalseOperator new }. + { MTReplaceIfTrueReceiverWithFalseOperator new }; + noLimitations. analysis run. @@ -136,11 +174,11 @@ MTAnalysisTest >> testExecutingSimpleMutation [ | analysis results generalResult mutationResult | analysis := MTAnalysis new testClasses: - (Array with: - MTAuxiliarClassForMTAnalysisTest); + (Array with: MTAuxiliarClassForMTAnalysisTest); classesToMutate: (Array with: MTAuxiliarClassForMTAnalysis); - operators: self plusForMinusReplacementMutation. + operators: self plusForMinusReplacementMutation; + noLimitations. analysis run. generalResult := analysis generalResult. results := analysis mutantResults. @@ -156,11 +194,11 @@ MTAnalysisTest >> testExecutingSimpleMutationForClassMethods [ | analysis results generalResult mutationResult | analysis := MTAnalysis new testClasses: - (Array with: - MTAuxiliarClassForMTAnalysisTest); + (Array with: MTAuxiliarClassForMTAnalysisTest); classesToMutate: (Array with: MTAuxiliarClassForMTAnalysis); - operators: self selectForRejectReplacementMutation. + operators: self selectForRejectReplacementMutation; + noLimitations. analysis run. generalResult := analysis generalResult. results := analysis mutantResults. @@ -176,11 +214,11 @@ MTAnalysisTest >> testExecutingSimpleMutationWhenNotRunnedAnalysis [ | analysis results generalResult | analysis := MTAnalysis new testClasses: - (Array with: - MTAuxiliarClassForMTAnalysisTest); + (Array with: MTAuxiliarClassForMTAnalysisTest); classesToMutate: (Array with: MTAuxiliarClassForMTAnalysis); - operators: self plusForMinusReplacementMutation. + operators: self plusForMinusReplacementMutation; + noLimitations. "analysis run." generalResult := analysis generalResult. results := analysis mutantResults. @@ -196,10 +234,11 @@ MTAnalysisTest >> testExecutingTwoMutantsFromDiferentMethods [ operatorSelection := OrderedCollection new. operatorSelection addAll: self ifFalseForIfTrueReplacementMutation. analysis := MTAnalysis new - testClasses: Array new; + testClasses: { MTAuxiliarTestClassForTestingStrategies }; classesToMutate: (Array with: MTAuxiliarClassForMTAnalysis); - operators: operatorSelection. + operators: operatorSelection; + noLimitations. analysis run. results := analysis mutantResults. self assert: results size equals: 2. @@ -214,10 +253,11 @@ MTAnalysisTest >> testExecutingTwoMutantsFromSameMethod [ operatorSelection := OrderedCollection new. operatorSelection addAll: self minusForPlusReplacementMutation. analysis := MTAnalysis new - testClasses: Array new; + testClasses: { MTAuxiliarTestClassForTestingStrategies }; classesToMutate: (Array with: MTAuxiliarClassForMTAnalysis); - operators: operatorSelection. + operators: operatorSelection; + noLimitations. analysis run. results := analysis mutantResults. self assert: results size equals: 2. @@ -235,11 +275,11 @@ MTAnalysisTest >> testExecutingTwoMutations [ operatorSelection addAll: self ifTrueForIfFalseReplacementMutation. analysis := MTAnalysis new testClasses: - (Array with: - MTAuxiliarClassForMTAnalysisTest); + (Array with: MTAuxiliarClassForMTAnalysisTest); classesToMutate: (Array with: MTAuxiliarClassForMTAnalysis); - operators: operatorSelection. + operators: operatorSelection; + noLimitations. analysis run. generalResult := analysis generalResult. results := analysis mutantResults. @@ -257,7 +297,10 @@ MTAnalysisTest >> testRunningAllTests [ testClasses: { MTAuxiliarTestClassForContinuingTestsExecutionAfterFirstFail }; classesToMutate: { MTAuxiliarClassForMTAnalysis }; - doNotStopOnErrorOrFail. + testSelectionStrategy: + MTAllTestsMethodsRunningTestSelectionStrategy new; + doNotStopOnErrorOrFail; + noLimitations. "In this class, tests fail after a certain of executions" MTAuxiliarTestClassForContinuingTestsExecutionAfterFirstFail reset. diff --git a/src/MuTalk-Tests/MTBudgetTest.class.st b/src/MuTalk-Tests/MTBudgetTest.class.st index 044c0435..10212b4d 100644 --- a/src/MuTalk-Tests/MTBudgetTest.class.st +++ b/src/MuTalk-Tests/MTBudgetTest.class.st @@ -29,7 +29,10 @@ MTBudgetTest >> runAnalysisWithBudget: aBudget on: classesToMutate withTests: te analysis := MTAnalysis new testClasses: testCases; classesToMutate: classesToMutate; - budget: aBudget. + budget: aBudget; + operators: + (MTParseRewriterMutantOperator allConcreteSubclasses + collect: [ :operator | operator new ]). analysis run. ^ analysis generalResult diff --git a/src/MuTalk-Tests/MTFileLoggerTest.class.st b/src/MuTalk-Tests/MTFileLoggerTest.class.st index c6bb1a1e..b16f241d 100644 --- a/src/MuTalk-Tests/MTFileLoggerTest.class.st +++ b/src/MuTalk-Tests/MTFileLoggerTest.class.st @@ -14,7 +14,8 @@ MTFileLoggerTest >> testLogFileExists [ analysis := MTAnalysis new classesToMutate: { MTAuxiliarClassForMTAnalysis }; testClasses: { MTAuxiliarClassForMTAnalysisTest }; - logger: (MTFileLogger toFileNamed: logFileName). + logger: (MTFileLogger toFileNamed: logFileName); + budget: MTFreeBudget new. analysis run. diff --git a/src/MuTalk-Tests/MTRandomClassMutantSelectionStrategyTest.class.st b/src/MuTalk-Tests/MTRandomClassMutantSelectionStrategyTest.class.st index 9c9a3328..1397a953 100644 --- a/src/MuTalk-Tests/MTRandomClassMutantSelectionStrategyTest.class.st +++ b/src/MuTalk-Tests/MTRandomClassMutantSelectionStrategyTest.class.st @@ -25,8 +25,7 @@ MTRandomClassMutantSelectionStrategyTest >> testAround33PercentOfMutantsForEachC MTAuxiliarClassForRandomClassMutantSelectionStrategy1. MTAuxiliarClassForRandomClassMutantSelectionStrategy2. MTAuxiliarClassForRandomClassMutantSelectionStrategy3 }; - testClasses: { }; - operators: MTAbstractMutantOperator contentsAll. + testClasses: { MTAuxiliarClassForMTAnalysisTest }. analysis mutantGenerationStrategy mutantSelectionStrategy: (MTRandomClassMutantSelectionStrategy withSeed: seed). diff --git a/src/MuTalk-Tests/MTRandomMethodMutantSelectionStrategyTest.class.st b/src/MuTalk-Tests/MTRandomMethodMutantSelectionStrategyTest.class.st index 6c775b26..c15ab856 100644 --- a/src/MuTalk-Tests/MTRandomMethodMutantSelectionStrategyTest.class.st +++ b/src/MuTalk-Tests/MTRandomMethodMutantSelectionStrategyTest.class.st @@ -24,8 +24,7 @@ MTRandomMethodMutantSelectionStrategyTest >> testAround25PercentOfMutantsForEach analysis := MTAnalysis new classesToMutate: { MTAuxiliarClassForRandomMethodMutantSelectionStrategy }; - testClasses: { }; - operators: MTAbstractMutantOperator contentsAll. + testClasses: { MTAuxiliarClassForMTAnalysisTest }. analysis mutantGenerationStrategy mutantSelectionStrategy: (MTRandomMethodMutantSelectionStrategy withSeed: seed). diff --git a/src/MuTalk-Tests/MTRandomOperatorMutantSelectionStrategyTest.class.st b/src/MuTalk-Tests/MTRandomOperatorMutantSelectionStrategyTest.class.st index fce5b08e..6e438d79 100644 --- a/src/MuTalk-Tests/MTRandomOperatorMutantSelectionStrategyTest.class.st +++ b/src/MuTalk-Tests/MTRandomOperatorMutantSelectionStrategyTest.class.st @@ -22,8 +22,7 @@ MTRandomOperatorMutantSelectionStrategyTest >> testAroundOneSeventhPercentOfMuta analysis := MTAnalysis new classesToMutate: { MTAuxiliarClassForRandomOperatorMutantSelectionStrategy }; - testClasses: { }; - operators: MTAbstractMutantOperator contentsAll. + testClasses: { MTAuxiliarClassForMTAnalysisTest }. analysis mutantGenerationStrategy mutantSelectionStrategy: (MTRandomOperatorMutantSelectionStrategy withSeed: seed). diff --git a/src/MuTalk-Tests/MTTestFilterTest.class.st b/src/MuTalk-Tests/MTTestFilterTest.class.st index b7e133d4..8efe45de 100644 --- a/src/MuTalk-Tests/MTTestFilterTest.class.st +++ b/src/MuTalk-Tests/MTTestFilterTest.class.st @@ -20,7 +20,8 @@ MTTestFilterTest >> runAnalysisWithFilter: aTestFilter on: classesToMutate withT analysis := MTAnalysis new testClasses: testCases; classesToMutate: classesToMutate; - testFilter: aTestFilter. + testFilter: aTestFilter; + budget: MTFreeBudget new. analysis run ] diff --git a/src/MuTalk-Tests/MTTimeBudgetTest.class.st b/src/MuTalk-Tests/MTTimeBudgetTest.class.st index 0ba85801..f463bf43 100644 --- a/src/MuTalk-Tests/MTTimeBudgetTest.class.st +++ b/src/MuTalk-Tests/MTTimeBudgetTest.class.st @@ -23,6 +23,9 @@ MTTimeBudgetTest >> runAnalysisWithBudget: aBudget on: classesToMutate withTests analysis := MTAnalysis new testClasses: testCases; classesToMutate: classesToMutate; + logger: MTNullLogger new; + testSelectionStrategy: + MTAllTestsMethodsRunningTestSelectionStrategy new; mutantGenerationStrategy: (MTManualMutationGenerationStrategy with: (Generator on: [ :gen | diff --git a/src/MuTalk-Utilities-Tests/MTMatrixTest.class.st b/src/MuTalk-Utilities-Tests/MTMatrixTest.class.st index 462d0126..dfb23120 100644 --- a/src/MuTalk-Utilities-Tests/MTMatrixTest.class.st +++ b/src/MuTalk-Utilities-Tests/MTMatrixTest.class.st @@ -16,6 +16,12 @@ MTMatrixTest >> setUp [ super setUp. matrix := MTMatrix forClasses: { MTAuxiliarClassForMatrix }. + matrix setUpAnalysis. + matrix analysis + operators: + (MTParseRewriterMutantOperator allConcreteSubclasses collect: [ + :operator | operator new ]); + budget: MTFreeBudget new. matrix build. self setUpVariablesForTest ] diff --git a/src/MuTalk-Utilities-Tests/MTMutantOperatorAnalysisTest.class.st b/src/MuTalk-Utilities-Tests/MTMutantOperatorAnalysisTest.class.st index 1113d537..0f64d5bf 100644 --- a/src/MuTalk-Utilities-Tests/MTMutantOperatorAnalysisTest.class.st +++ b/src/MuTalk-Utilities-Tests/MTMutantOperatorAnalysisTest.class.st @@ -22,7 +22,7 @@ MTMutantOperatorAnalysisTest >> testGetAllOperators [ | actual expected | actual := operatorAnalysis operatorsProducingAtLeast: 0. - expected := (MTAbstractMutantOperator contentsAll collect: #species) asSet. + expected := (MTAbstractMutantOperator contents collect: #species) asSet. self assert: actual equals: expected ] @@ -45,7 +45,7 @@ MTMutantOperatorAnalysisTest >> testOperatorsProducingUnder [ | actual expected | actual := operatorAnalysis operatorsProducingAtMost: 2. - expected := (MTAbstractMutantOperator contentsAll collect: #species) asSet + expected := (MTAbstractMutantOperator contents collect: #species) asSet reject: [ :operator | { MTLiteralIntegersIncreaseOperator. diff --git a/src/MuTalk-Utilities/MTMatrix.class.st b/src/MuTalk-Utilities/MTMatrix.class.st index 1aad6270..7df053ab 100644 --- a/src/MuTalk-Utilities/MTMatrix.class.st +++ b/src/MuTalk-Utilities/MTMatrix.class.st @@ -290,15 +290,21 @@ MTMatrix >> mutations: anObject [ { #category : 'running' } MTMatrix >> runAnalysis [ - analysis := MTAnalysis new - classesToMutate: classesToMutate; - testClasses: testClasses; - doNotStopOnErrorOrFail. + analysis ifNil: [ self setUpAnalysis ]. analysis run. testCases := analysis testCases. mutations := analysis mutations ] +{ #category : 'initialization' } +MTMatrix >> setUpAnalysis [ + + analysis := MTAnalysis new + classesToMutate: classesToMutate; + testClasses: testClasses; + doNotStopOnErrorOrFail +] + { #category : 'accessing' } MTMatrix >> testCases [ diff --git a/src/MuTalk-Utilities/MTMutantOperatorAnalysis.class.st b/src/MuTalk-Utilities/MTMutantOperatorAnalysis.class.st index d558bb07..98760233 100644 --- a/src/MuTalk-Utilities/MTMutantOperatorAnalysis.class.st +++ b/src/MuTalk-Utilities/MTMutantOperatorAnalysis.class.st @@ -44,8 +44,7 @@ MTMutantOperatorAnalysis >> operatorDictionaryFromAnalysis [ | analysis dic | analysis := MTAnalysis new classesToMutate: classes; - testClasses: { }; - operators: MTAbstractMutantOperator contentsAll. + testClasses: { }. analysis generateMutations. @@ -75,7 +74,7 @@ MTMutantOperatorAnalysis >> operatorsSelectedWith: aBlock [ MTMutantOperatorAnalysis >> operatorsWithoutMutantsFor: aDictionary [ | operatorsWithoutMutants | - operatorsWithoutMutants := (MTAbstractMutantOperator contentsAll collect: + operatorsWithoutMutants := (MTAbstractMutantOperator contents collect: #species) reject: [ :ope | aDictionary keys includes: ope ]. diff --git a/src/MuTalk-Utilities/MTNonMutatedMethodsAnalysis.class.st b/src/MuTalk-Utilities/MTNonMutatedMethodsAnalysis.class.st index 5a003599..886ac4ba 100644 --- a/src/MuTalk-Utilities/MTNonMutatedMethodsAnalysis.class.st +++ b/src/MuTalk-Utilities/MTNonMutatedMethodsAnalysis.class.st @@ -29,8 +29,7 @@ MTNonMutatedMethodsAnalysis >> mutatedMethods [ | analysis mutatedMethods | analysis := MTAnalysis new classesToMutate: classes; - testClasses: { }; - operators: MTAbstractMutantOperator contentsAll. + testClasses: { }. mutatedMethods := Set withAll: (analysis generateMutations collect: