Skip to content

Commit 5e7978b

Browse files
authored
Merge pull request #111 from DurieuxPol/enh/operatorCategories
Organised operators in categories
2 parents e09464c + b5e59f6 commit 5e7978b

File tree

89 files changed

+187
-265
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

89 files changed

+187
-265
lines changed

README.md

+11-89
Original file line numberDiff line numberDiff line change
@@ -27,25 +27,28 @@ Metacello new
2727
load.
2828
```
2929

30-
## Analysis
30+
## Quick start
3131

3232
```smalltalk
33-
| analysis alive testClasses classesToMutate |
34-
testClasses := { UUIDPrimitivesTest }.
35-
classesToMutate := { UUID . UUIDGenerator }.
33+
"Put here the classes you want to mutate"
34+
classesToMutate := { }.
35+
"Put here the test classes associated with"
36+
testClasses := { }.
3637
3738
analysis := MTAnalysis new
3839
classesToMutate: classesToMutate;
3940
testClasses: testClasses.
4041
4142
analysis run.
4243
43-
"To retrieve the alive mutations"
44-
alive := analysis generalResult aliveMutants.
45-
4644
"To inspect the results"
4745
analysis generalResult inspect.
4846
```
47+
48+
## Wiki
49+
50+
You can find a wiki [here](https://github.com/pharo-contributions/mutalk/wiki) with a lot of information about MuTalk and how it works. It is higly recommended to read it.
51+
4952
---
5053

5154
Original repository: http://www.squeaksource.com/MutationTesting
@@ -62,85 +65,4 @@ During the 70s, mutation testing emerged as a technique to assess the fault-find
6265

6366
However, so far it is a “brute force” technique that takes too long to provide useful results. This characteristic has forbidden its widespread and practical use regardless the existence of new techniques, such as schema-based mutation and selective mutation. Additionally, there are no mutation testing tools (to our knowledge) that work on meta-circular and dynamic environments, such as Smalltalk, so compile and link time are the current technique's bottleneck.
6467

65-
This Smalltalk-based tool was developed at the University of Buenos Aires (Argentina) in the context of the final thesis work. The tool uses Smalltalk's dynamic and meta-programming facilities to notably reduce the time to get valuable output and help to understand and implement new tests due to its integration with the rest of the environment.
66-
67-
## Wiki
68-
69-
You can find a wiki [here](https://github.com/pharo-contributions/mutalk/wiki).
70-
71-
## FAQ
72-
73-
> How can I run a mutation testing analysis on my packages?
74-
75-
Currently you need to write a script in the playground (shortcut: CTRL + O + W) like the one above.
76-
77-
In the future we plan to improve the UI to allow MuTalk to be used:
78-
* in the Mutation Testing Runner
79-
* within the Class Browser
80-
81-
> What is the difference between each running mode?
82-
83-
We have four modes to run an analysis:
84-
* Mutate All, Run All: it means mutating all your code and then running all tests.
85-
* ```smalltalk
86-
analysis mutantSelectionStrategy: MTAllMutantSelectionStrategy new;
87-
testSelectionStrategy: MTAllTestsMethodsRunningTestSelectionStrategy new.
88-
```
89-
* Mutate All, run Covering: it means mutating all your code but, for each mutated method, running tests that cover it. The result should be, in general, the same than running Mutate All, Run All, but taking less time.
90-
* ```smalltalk
91-
analysis mutantSelectionStrategy: MTAllMutantSelectionStrategy new;
92-
testSelectionStrategy: MTSelectingFromCoverageTestSelectionStrategy new.
93-
```
94-
* Mutate Covered, Run All: it means mutating only code covered by tests and then running all tests.
95-
* ```smalltalk
96-
analysis mutantSelectionStrategy: MTSelectingFromCoverageMutantSelectionStrategy new;
97-
testSelectionStrategy: MTAllTestsMethodsRunningTestSelectionStrategy new.
98-
```
99-
* Mutate Covered, Run Covering: it means mutating covered code and, for each mutated method, running tests that cover it. The result must be, in general, the same than running Mutate Covered, run All, but taking less time.
100-
* ```smalltalk
101-
analysis mutantSelectionStrategy: MTSelectingFromCoverageMutantSelectionStrategy new;
102-
testSelectionStrategy: MTSelectingFromCoverageTestSelectionStrategy new.
103-
```
104-
105-
> What are the options when running an analysis?
106-
107-
There are various options you can play with.
108-
You can change the mutant selection strategy as we presented above, but there are more. You can manually give the methods to be mutated with `MTManualMutatedMethodSelectionStrategy`, or directly give the mutations with `MTManualMutationSelectionStrategy`.
109-
You can also randomize the mutations order with `MTRandomMutantSelectionStrategy`. This strategy relies on another mutant selection strategy (by default it is the all mutant one) to generate the mutations, then it shuffles the collection of mutations. Another option is to use `MTRandomOperatorMutantSelectionStrategy`, which randomly selects a mutant operator then randomly selects a mutation from this operator.
110-
111-
Theses random strategies are especially useful when paired with budgets, in particular the ones on number of mutants. Budgets are meant to impose a limitation on the analysis.
112-
There are 4 types:
113-
* No budget: the analysis will run until finished or until it encounters a bug.
114-
* ```smalltalk
115-
analysis budget: MTFreeBudget new.
116-
```
117-
* Budget on a fixed number of mutants: the analysis will stop when the given number of mutants have been evaluated.
118-
* ```smalltalk
119-
analysis budget: (MTFixedNumberOfMutantsBudget for: 10).
120-
```
121-
* Budget on a percentage of mutants: the analysis will stop when the given percentage of mutants have been evaluated. If the percentage gives a non exact number of mutants (for instance 7.6 mutants), it stops at the rounded up number (here it would be 8 mutants).
122-
* ```smalltalk
123-
analysis budget: (MTPercentageOfMutantsBudget for: 10).
124-
```
125-
* Budget on time: the analysis will run until the given time as passed. If a mutant is being evaluated when the time is up, the analysis continues until this evaluation is finished.
126-
* ```smalltalk
127-
analysis budget: (MTTimeBudget for: 10 seconds).
128-
```
129-
130-
When evaluating a mutant the analysis installs the mutation, runs all tests, and at the first failing test it ends the evaluation, uninstalls the mutation and moves on to the next mutant. However in some cases you need the analysis to run all tests and do not stop at the first failing test.
131-
You can do that in MuTalk with this option:
132-
```smalltalk
133-
analysis doNotStopOnErrorOrFail.
134-
```
135-
136-
> What is the default mode to run mutation testing?
137-
138-
The default parameters are: mutate all, run all, no budget and stop at first fail.
139-
140-
> Does MuTalk replace coverage analysis?
141-
142-
No, it doesn't. It complements coverage. We should first try to write all the tests to achieve a high coverage score on the code we want to mutate. We can then run mutation testing in Mutate Covered, Run Covering mode.
143-
144-
> My image is freezing when running a mutation testing analysis, what can I do?
145-
146-
You can can open the Mutation Testing Runner and then Activate Logging to File. It will generate a file called MutationTestingLog.txt which lets you know which mutant is causing your image to freeze. You can install the mutation by hand, and then debug running your tests. You will probably need to exclude a class or an operator from the analysis.
68+
This Smalltalk-based tool was developed at the University of Buenos Aires (Argentina) in the context of the final thesis work. The tool uses Smalltalk's dynamic and meta-programming facilities to notably reduce the time to get valuable output and help to understand and implement new tests due to its integration with the rest of the environment.

src/MuTalk-Model/MTAbstractMutantOperator.class.st

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
Class {
22
#name : 'MTAbstractMutantOperator',
33
#superclass : 'Object',
4-
#category : 'MuTalk-Model-Operators',
4+
#category : 'MuTalk-Model-Operators - Abstract',
55
#package : 'MuTalk-Model',
6-
#tag : 'Operators'
6+
#tag : 'Operators - Abstract'
77
}
88

99
{ #category : 'accessing' }

src/MuTalk-Model/MTAssignmentNullifierOperator.class.st

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
Class {
22
#name : 'MTAssignmentNullifierOperator',
33
#superclass : 'MTPredicateBasedMutantOperator',
4-
#category : 'MuTalk-Model-Operators',
4+
#category : 'MuTalk-Model-Operators - Other',
55
#package : 'MuTalk-Model',
6-
#tag : 'Operators'
6+
#tag : 'Operators - Other'
77
}
88

99
{ #category : 'applying' }

src/MuTalk-Model/MTEmptyMethodOperator.class.st

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
Class {
22
#name : 'MTEmptyMethodOperator',
33
#superclass : 'MTPredicateBasedMutantOperator',
4-
#category : 'MuTalk-Model-Operators',
4+
#category : 'MuTalk-Model-Operators - Deletion',
55
#package : 'MuTalk-Model',
6-
#tag : 'Operators'
6+
#tag : 'Operators - Deletion'
77
}
88

99
{ #category : 'applying' }

src/MuTalk-Model/MTLiteralBooleanNegateOperator.class.st

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
Class {
22
#name : 'MTLiteralBooleanNegateOperator',
33
#superclass : 'MTPredicateBasedMutantOperator',
4-
#category : 'MuTalk-Model-Operators',
4+
#category : 'MuTalk-Model-Operators - Literal manipulation',
55
#package : 'MuTalk-Model',
6-
#tag : 'Operators'
6+
#tag : 'Operators - Literal manipulation'
77
}
88

99
{ #category : 'applying' }

src/MuTalk-Model/MTLiteralIntegersDecreaseOperator.class.st

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
Class {
22
#name : 'MTLiteralIntegersDecreaseOperator',
33
#superclass : 'MTPredicateBasedMutantOperator',
4-
#category : 'MuTalk-Model-Operators',
4+
#category : 'MuTalk-Model-Operators - Literal manipulation',
55
#package : 'MuTalk-Model',
6-
#tag : 'Operators'
6+
#tag : 'Operators - Literal manipulation'
77
}
88

99
{ #category : 'applying' }

src/MuTalk-Model/MTLiteralIntegersIncreaseOperator.class.st

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
Class {
22
#name : 'MTLiteralIntegersIncreaseOperator',
33
#superclass : 'MTPredicateBasedMutantOperator',
4-
#category : 'MuTalk-Model-Operators',
4+
#category : 'MuTalk-Model-Operators - Literal manipulation',
55
#package : 'MuTalk-Model',
6-
#tag : 'Operators'
6+
#tag : 'Operators - Literal manipulation'
77
}
88

99
{ #category : 'applying' }

src/MuTalk-Model/MTLiteralIntegersToZeroOperator.class.st

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
Class {
22
#name : 'MTLiteralIntegersToZeroOperator',
33
#superclass : 'MTPredicateBasedMutantOperator',
4-
#category : 'MuTalk-Model-Operators',
4+
#category : 'MuTalk-Model-Operators - Literal manipulation',
55
#package : 'MuTalk-Model',
6-
#tag : 'Operators'
6+
#tag : 'Operators - Literal manipulation'
77
}
88

99
{ #category : 'applying' }

src/MuTalk-Model/MTLiteralStringChangeOperator.class.st

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
Class {
22
#name : 'MTLiteralStringChangeOperator',
33
#superclass : 'MTPredicateBasedMutantOperator',
4-
#category : 'MuTalk-Model-Operators',
4+
#category : 'MuTalk-Model-Operators - Literal manipulation',
55
#package : 'MuTalk-Model',
6-
#tag : 'Operators'
6+
#tag : 'Operators - Literal manipulation'
77
}
88

99
{ #category : 'applying' }

src/MuTalk-Model/MTLiteralStringToEmptyOperator.class.st

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
Class {
22
#name : 'MTLiteralStringToEmptyOperator',
33
#superclass : 'MTPredicateBasedMutantOperator',
4-
#category : 'MuTalk-Model-Operators',
4+
#category : 'MuTalk-Model-Operators - Literal manipulation',
55
#package : 'MuTalk-Model',
6-
#tag : 'Operators'
6+
#tag : 'Operators - Literal manipulation'
77
}
88

99
{ #category : 'applying' }

src/MuTalk-Model/MTMessageSendArguments1stNullifierOperator.class.st

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
Class {
22
#name : 'MTMessageSendArguments1stNullifierOperator',
33
#superclass : 'MTMessageSendArgumentsNullifierOperator',
4-
#category : 'MuTalk-Model-Operators',
4+
#category : 'MuTalk-Model-Operators - Message sender',
55
#package : 'MuTalk-Model',
6-
#tag : 'Operators'
6+
#tag : 'Operators - Message sender'
77
}
88

99
{ #category : 'applying' }

src/MuTalk-Model/MTMessageSendArguments2ndNullifierOperator.class.st

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
Class {
22
#name : 'MTMessageSendArguments2ndNullifierOperator',
33
#superclass : 'MTMessageSendArgumentsNullifierOperator',
4-
#category : 'MuTalk-Model-Operators',
4+
#category : 'MuTalk-Model-Operators - Message sender',
55
#package : 'MuTalk-Model',
6-
#tag : 'Operators'
6+
#tag : 'Operators - Message sender'
77
}
88

99
{ #category : 'applying' }

src/MuTalk-Model/MTMessageSendArguments3rdNullifierOperator.class.st

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
Class {
22
#name : 'MTMessageSendArguments3rdNullifierOperator',
33
#superclass : 'MTMessageSendArgumentsNullifierOperator',
4-
#category : 'MuTalk-Model-Operators',
4+
#category : 'MuTalk-Model-Operators - Message sender',
55
#package : 'MuTalk-Model',
6-
#tag : 'Operators'
6+
#tag : 'Operators - Message sender'
77
}
88

99
{ #category : 'applying' }

src/MuTalk-Model/MTMessageSendArgumentsNullifierOperator.class.st

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
Class {
22
#name : 'MTMessageSendArgumentsNullifierOperator',
33
#superclass : 'MTPredicateBasedMutantOperator',
4-
#category : 'MuTalk-Model-Operators',
4+
#category : 'MuTalk-Model-Operators - Message sender',
55
#package : 'MuTalk-Model',
6-
#tag : 'Operators'
6+
#tag : 'Operators - Message sender'
77
}
88

99
{ #category : 'testing' }

src/MuTalk-Model/MTMessageSendToYourselfOperator.class.st

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
Class {
22
#name : 'MTMessageSendToYourselfOperator',
33
#superclass : 'MTPredicateBasedMutantOperator',
4-
#category : 'MuTalk-Model-Operators',
4+
#category : 'MuTalk-Model-Operators - Message sender',
55
#package : 'MuTalk-Model',
6-
#tag : 'Operators'
6+
#tag : 'Operators - Message sender'
77
}
88

99
{ #category : 'applying' }

src/MuTalk-Model/MTParseRewriterMutantOperator.class.st

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
Class {
22
#name : 'MTParseRewriterMutantOperator',
33
#superclass : 'MTAbstractMutantOperator',
4-
#category : 'MuTalk-Model-Operators',
4+
#category : 'MuTalk-Model-Operators - Abstract',
55
#package : 'MuTalk-Model',
6-
#tag : 'Operators'
6+
#tag : 'Operators - Abstract'
77
}
88

99
{ #category : 'testing' }

src/MuTalk-Model/MTPredicateBasedMutantOperator.class.st

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
Class {
22
#name : 'MTPredicateBasedMutantOperator',
33
#superclass : 'MTAbstractMutantOperator',
4-
#category : 'MuTalk-Model-Operators',
4+
#category : 'MuTalk-Model-Operators - Abstract',
55
#package : 'MuTalk-Model',
6-
#tag : 'Operators'
6+
#tag : 'Operators - Abstract'
77
}
88

99
{ #category : 'testing' }

src/MuTalk-Model/MTRemoveAtIfAbsentOperator.class.st

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
Class {
22
#name : 'MTRemoveAtIfAbsentOperator',
33
#superclass : 'MTParseRewriterMutantOperator',
4-
#category : 'MuTalk-Model-Operators',
4+
#category : 'MuTalk-Model-Operators - Collection operation',
55
#package : 'MuTalk-Model',
6-
#tag : 'Operators'
6+
#tag : 'Operators - Collection operation'
77
}
88

99
{ #category : 'printing' }

src/MuTalk-Model/MTRemoveCaretOperator.class.st

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
Class {
22
#name : 'MTRemoveCaretOperator',
33
#superclass : 'MTParseRewriterMutantOperator',
4-
#category : 'MuTalk-Model-Operators',
4+
#category : 'MuTalk-Model-Operators - Deletion',
55
#package : 'MuTalk-Model',
6-
#tag : 'Operators'
6+
#tag : 'Operators - Deletion'
77
}
88

99
{ #category : 'printing' }

src/MuTalk-Model/MTRemoveExceptionHandlerOperator.class.st

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
Class {
22
#name : 'MTRemoveExceptionHandlerOperator',
33
#superclass : 'MTParseRewriterMutantOperator',
4-
#category : 'MuTalk-Model-Operators',
4+
#category : 'MuTalk-Model-Operators - Deletion',
55
#package : 'MuTalk-Model',
6-
#tag : 'Operators'
6+
#tag : 'Operators - Deletion'
77
}
88

99
{ #category : 'printing' }

src/MuTalk-Model/MTRemoveInjectIntoOperator.class.st

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
Class {
22
#name : 'MTRemoveInjectIntoOperator',
33
#superclass : 'MTParseRewriterMutantOperator',
4-
#category : 'MuTalk-Model-Operators',
4+
#category : 'MuTalk-Model-Operators - Deletion',
55
#package : 'MuTalk-Model',
6-
#tag : 'Operators'
6+
#tag : 'Operators - Deletion'
77
}
88

99
{ #category : 'printing' }

src/MuTalk-Model/MTRemoveNotOperator.class.st

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
Class {
22
#name : 'MTRemoveNotOperator',
33
#superclass : 'MTParseRewriterMutantOperator',
4-
#category : 'MuTalk-Model-Operators',
4+
#category : 'MuTalk-Model-Operators - Deletion',
55
#package : 'MuTalk-Model',
6-
#tag : 'Operators'
6+
#tag : 'Operators - Deletion'
77
}
88

99
{ #category : 'printing' }

src/MuTalk-Model/MTReplaceAndArgumentWithTrueOperator.class.st

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
Class {
22
#name : 'MTReplaceAndArgumentWithTrueOperator',
33
#superclass : 'MTParseRewriterMutantOperator',
4-
#category : 'MuTalk-Model-Operators',
4+
#category : 'MuTalk-Model-Operators - Logical boolean operation',
55
#package : 'MuTalk-Model',
6-
#tag : 'Operators'
6+
#tag : 'Operators - Logical boolean operation'
77
}
88

99
{ #category : 'printing' }

src/MuTalk-Model/MTReplaceAndReceiverOperator.class.st

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
Class {
22
#name : 'MTReplaceAndReceiverOperator',
33
#superclass : 'MTReplaceReceiverOperator',
4-
#category : 'MuTalk-Model-Operators',
4+
#category : 'MuTalk-Model-Operators - Logical boolean operation',
55
#package : 'MuTalk-Model',
6-
#tag : 'Operators'
6+
#tag : 'Operators - Logical boolean operation'
77
}
88

99
{ #category : 'testing' }

0 commit comments

Comments
 (0)