mutant 0.8.24 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +3 -3
- data/Changelog.md +14 -654
- data/Gemfile +13 -0
- data/Gemfile.lock +59 -64
- data/LICENSE +271 -20
- data/README.md +73 -140
- data/Rakefile +0 -21
- data/bin/mutant +7 -2
- data/config/reek.yml +2 -1
- data/config/rubocop.yml +5 -9
- data/docs/incremental.md +76 -0
- data/docs/known-problems.md +0 -14
- data/docs/mutant-minitest.md +1 -1
- data/docs/mutant-rspec.md +2 -24
- data/lib/mutant.rb +45 -53
- data/lib/mutant/ast/nodes.rb +0 -2
- data/lib/mutant/ast/types.rb +1 -117
- data/lib/mutant/base.rb +192 -0
- data/lib/mutant/bootstrap.rb +145 -0
- data/lib/mutant/cli.rb +68 -54
- data/lib/mutant/config.rb +119 -6
- data/lib/mutant/env.rb +94 -8
- data/lib/mutant/expression.rb +6 -1
- data/lib/mutant/expression/parser.rb +9 -31
- data/lib/mutant/integration.rb +64 -36
- data/lib/mutant/isolation.rb +16 -1
- data/lib/mutant/isolation/fork.rb +105 -40
- data/lib/mutant/license.rb +34 -0
- data/lib/mutant/license/subscription.rb +47 -0
- data/lib/mutant/license/subscription/commercial.rb +57 -0
- data/lib/mutant/license/subscription/opensource.rb +77 -0
- data/lib/mutant/loader.rb +27 -4
- data/lib/mutant/matcher.rb +48 -1
- data/lib/mutant/matcher/chain.rb +1 -1
- data/lib/mutant/matcher/config.rb +0 -2
- data/lib/mutant/matcher/filter.rb +1 -1
- data/lib/mutant/matcher/method.rb +11 -7
- data/lib/mutant/matcher/methods.rb +1 -1
- data/lib/mutant/matcher/namespace.rb +1 -1
- data/lib/mutant/matcher/null.rb +1 -1
- data/lib/mutant/matcher/scope.rb +1 -1
- data/lib/mutant/meta/example/dsl.rb +0 -8
- data/lib/mutant/mutation.rb +1 -2
- data/lib/mutant/mutator/node.rb +2 -9
- data/lib/mutant/mutator/node/arguments.rb +1 -1
- data/lib/mutant/mutator/node/class.rb +0 -8
- data/lib/mutant/mutator/node/define.rb +0 -12
- data/lib/mutant/mutator/node/generic.rb +30 -44
- data/lib/mutant/mutator/node/index.rb +4 -4
- data/lib/mutant/mutator/node/literal/regex.rb +0 -39
- data/lib/mutant/mutator/node/send.rb +13 -12
- data/lib/mutant/parallel.rb +61 -40
- data/lib/mutant/parallel/driver.rb +59 -0
- data/lib/mutant/parallel/source.rb +6 -2
- data/lib/mutant/parallel/worker.rb +63 -45
- data/lib/mutant/range.rb +15 -0
- data/lib/mutant/reporter/cli.rb +5 -11
- data/lib/mutant/reporter/cli/format.rb +3 -46
- data/lib/mutant/reporter/cli/printer/config.rb +5 -6
- data/lib/mutant/reporter/cli/printer/env.rb +40 -0
- data/lib/mutant/reporter/cli/printer/env_progress.rb +13 -17
- data/lib/mutant/reporter/cli/printer/isolation_result.rb +17 -3
- data/lib/mutant/reporter/cli/printer/mutation_result.rb +2 -3
- data/lib/mutant/reporter/cli/printer/status_progressive.rb +19 -10
- data/lib/mutant/repository.rb +0 -65
- data/lib/mutant/repository/diff.rb +104 -0
- data/lib/mutant/repository/diff/ranges.rb +52 -0
- data/lib/mutant/result.rb +16 -7
- data/lib/mutant/runner.rb +38 -47
- data/lib/mutant/runner/sink.rb +1 -1
- data/lib/mutant/selector/null.rb +19 -0
- data/lib/mutant/subject.rb +3 -1
- data/lib/mutant/subject/method/instance.rb +3 -1
- data/lib/mutant/transform.rb +511 -0
- data/lib/mutant/variable.rb +282 -0
- data/lib/mutant/version.rb +1 -1
- data/lib/mutant/warnings.rb +113 -0
- data/meta/case.rb +1 -0
- data/meta/class.rb +0 -9
- data/meta/def.rb +1 -26
- data/meta/regexp.rb +10 -20
- data/meta/send.rb +14 -46
- data/mutant-minitest.gemspec +1 -1
- data/mutant-rspec.gemspec +2 -2
- data/mutant.gemspec +15 -16
- data/mutant.yml +6 -0
- data/spec/integration/mutant/isolation/fork_spec.rb +22 -5
- data/spec/integration/mutant/minitest_spec.rb +3 -2
- data/spec/integration/mutant/rspec_spec.rb +4 -3
- data/spec/integrations.yml +16 -13
- data/spec/shared/base_behavior.rb +45 -0
- data/spec/shared/framework_integration_behavior.rb +43 -14
- data/spec/spec_helper.rb +21 -17
- data/spec/support/corpus.rb +56 -95
- data/spec/support/shared_context.rb +37 -14
- data/spec/support/xspec.rb +7 -3
- data/spec/unit/mutant/bootstrap_spec.rb +216 -0
- data/spec/unit/mutant/cli_spec.rb +173 -117
- data/spec/unit/mutant/config_spec.rb +126 -0
- data/spec/unit/mutant/either_spec.rb +247 -0
- data/spec/unit/mutant/env_spec.rb +162 -40
- data/spec/unit/mutant/expression/method_spec.rb +16 -0
- data/spec/unit/mutant/expression/parser_spec.rb +29 -33
- data/spec/unit/mutant/expression_spec.rb +5 -7
- data/spec/unit/mutant/integration_spec.rb +100 -9
- data/spec/unit/mutant/isolation/fork_spec.rb +125 -67
- data/spec/unit/mutant/isolation/result_spec.rb +33 -1
- data/spec/unit/mutant/license_spec.rb +257 -0
- data/spec/unit/mutant/loader_spec.rb +50 -11
- data/spec/unit/mutant/matcher/compiler_spec.rb +0 -78
- data/spec/unit/mutant/matcher/method/instance_spec.rb +55 -11
- data/spec/unit/mutant/matcher/method/singleton_spec.rb +12 -2
- data/spec/unit/mutant/matcher_spec.rb +102 -0
- data/spec/unit/mutant/maybe_spec.rb +60 -0
- data/spec/unit/mutant/meta/example/dsl_spec.rb +1 -17
- data/spec/unit/mutant/mutation_spec.rb +13 -6
- data/spec/unit/mutant/parallel/driver_spec.rb +112 -14
- data/spec/unit/mutant/parallel/source/array_spec.rb +25 -17
- data/spec/unit/mutant/parallel/worker_spec.rb +182 -44
- data/spec/unit/mutant/parallel_spec.rb +105 -8
- data/spec/unit/mutant/range_spec.rb +141 -0
- data/spec/unit/mutant/reporter/cli/printer/config_spec.rb +7 -21
- data/spec/unit/mutant/reporter/cli/printer/env_progress_spec.rb +15 -6
- data/spec/unit/mutant/reporter/cli/printer/env_result_spec.rb +10 -2
- data/spec/unit/mutant/reporter/cli/printer/isolation_result_spec.rb +12 -4
- data/spec/unit/mutant/reporter/cli/printer/mutation_result_spec.rb +31 -2
- data/spec/unit/mutant/reporter/cli/printer/status_progressive_spec.rb +4 -4
- data/spec/unit/mutant/reporter/cli/printer/subject_result_spec.rb +5 -0
- data/spec/unit/mutant/reporter/cli_spec.rb +46 -123
- data/spec/unit/mutant/repository/diff/ranges_spec.rb +180 -0
- data/spec/unit/mutant/repository/diff_spec.rb +84 -71
- data/spec/unit/mutant/require_highjack_spec.rb +1 -1
- data/spec/unit/mutant/result/env_spec.rb +39 -9
- data/spec/unit/mutant/result/test_spec.rb +14 -0
- data/spec/unit/mutant/runner_spec.rb +88 -41
- data/spec/unit/mutant/selector/expression_spec.rb +11 -10
- data/spec/unit/mutant/selector/null_spec.rb +17 -0
- data/spec/unit/mutant/subject/method/instance_spec.rb +44 -5
- data/spec/unit/mutant/subject/method/singleton_spec.rb +9 -2
- data/spec/unit/mutant/subject_spec.rb +9 -1
- data/spec/unit/mutant/transform/array_spec.rb +92 -0
- data/spec/unit/mutant/transform/bool_spec.rb +63 -0
- data/spec/unit/mutant/transform/error_spec.rb +132 -0
- data/spec/unit/mutant/transform/exception_spec.rb +44 -0
- data/spec/unit/mutant/transform/hash_spec.rb +236 -0
- data/spec/unit/mutant/transform/index_spec.rb +92 -0
- data/spec/unit/mutant/transform/named_spec.rb +49 -0
- data/spec/unit/mutant/transform/primitive_spec.rb +56 -0
- data/spec/unit/mutant/transform/sequence_spec.rb +98 -0
- data/spec/unit/mutant/variable_spec.rb +618 -0
- data/spec/unit/mutant/warnings_spec.rb +89 -0
- data/spec/unit/mutant/world_spec.rb +63 -0
- data/test_app/Gemfile.minitest +0 -2
- metadata +79 -113
- data/.gitattributes +0 -1
- data/.ruby-gemset +0 -1
- data/config/triage.yml +0 -2
- data/lib/mutant/actor.rb +0 -57
- data/lib/mutant/actor/env.rb +0 -31
- data/lib/mutant/actor/mailbox.rb +0 -34
- data/lib/mutant/actor/receiver.rb +0 -42
- data/lib/mutant/actor/sender.rb +0 -26
- data/lib/mutant/ast/meta/restarg.rb +0 -19
- data/lib/mutant/ast/regexp.rb +0 -42
- data/lib/mutant/ast/regexp/transformer.rb +0 -187
- data/lib/mutant/ast/regexp/transformer/direct.rb +0 -123
- data/lib/mutant/ast/regexp/transformer/named_group.rb +0 -59
- data/lib/mutant/ast/regexp/transformer/options_group.rb +0 -83
- data/lib/mutant/ast/regexp/transformer/quantifier.rb +0 -114
- data/lib/mutant/ast/regexp/transformer/recursive.rb +0 -58
- data/lib/mutant/ast/regexp/transformer/root.rb +0 -31
- data/lib/mutant/ast/regexp/transformer/text.rb +0 -60
- data/lib/mutant/env/bootstrap.rb +0 -160
- data/lib/mutant/matcher/compiler.rb +0 -60
- data/lib/mutant/mutator/node/regexp.rb +0 -35
- data/lib/mutant/mutator/node/regexp/alternation_meta.rb +0 -23
- data/lib/mutant/mutator/node/regexp/capture_group.rb +0 -28
- data/lib/mutant/mutator/node/regexp/character_type.rb +0 -32
- data/lib/mutant/mutator/node/regexp/end_of_line_anchor.rb +0 -23
- data/lib/mutant/mutator/node/regexp/end_of_string_or_before_end_of_line_anchor.rb +0 -23
- data/lib/mutant/mutator/node/regexp/greedy_zero_or_more.rb +0 -27
- data/lib/mutant/parallel/master.rb +0 -181
- data/lib/mutant/reporter/cli/printer/status.rb +0 -53
- data/lib/mutant/reporter/cli/tput.rb +0 -46
- data/lib/mutant/warning_filter.rb +0 -61
- data/meta/regexp/character_types.rb +0 -23
- data/meta/regexp/regexp_alternation_meta.rb +0 -13
- data/meta/regexp/regexp_bol_anchor.rb +0 -10
- data/meta/regexp/regexp_bos_anchor.rb +0 -18
- data/meta/regexp/regexp_capture_group.rb +0 -19
- data/meta/regexp/regexp_eol_anchor.rb +0 -10
- data/meta/regexp/regexp_eos_anchor.rb +0 -8
- data/meta/regexp/regexp_eos_ob_eol_anchor.rb +0 -10
- data/meta/regexp/regexp_greedy_zero_or_more.rb +0 -12
- data/meta/regexp/regexp_root_expression.rb +0 -10
- data/meta/restarg.rb +0 -10
- data/spec/support/fake_actor.rb +0 -111
- data/spec/support/warning.rb +0 -66
- data/spec/unit/mutant/actor/binding_spec.rb +0 -34
- data/spec/unit/mutant/actor/env_spec.rb +0 -31
- data/spec/unit/mutant/actor/mailbox_spec.rb +0 -28
- data/spec/unit/mutant/actor/message_spec.rb +0 -25
- data/spec/unit/mutant/actor/receiver_spec.rb +0 -58
- data/spec/unit/mutant/actor/sender_spec.rb +0 -24
- data/spec/unit/mutant/ast/regexp/parse_spec.rb +0 -19
- data/spec/unit/mutant/ast/regexp/transformer/lookup_table/table_spec.rb +0 -21
- data/spec/unit/mutant/ast/regexp/transformer/lookup_table_spec.rb +0 -35
- data/spec/unit/mutant/ast/regexp/transformer_spec.rb +0 -21
- data/spec/unit/mutant/ast/regexp_spec.rb +0 -704
- data/spec/unit/mutant/env/bootstrap_spec.rb +0 -188
- data/spec/unit/mutant/matcher/compiler/subject_prefix_spec.rb +0 -26
- data/spec/unit/mutant/parallel/master_spec.rb +0 -338
- data/spec/unit/mutant/reporter/cli/printer/status_spec.rb +0 -121
- data/spec/unit/mutant/reporter/cli/tput_spec.rb +0 -50
- data/spec/unit/mutant/warning_filter_spec.rb +0 -106
- data/spec/unit/mutant_spec.rb +0 -17
- data/test_app/Gemfile.rspec3.7 +0 -7
data/README.md
CHANGED
@@ -2,8 +2,6 @@ mutant
|
|
2
2
|
======
|
3
3
|
|
4
4
|
[![Build Status](https://circleci.com/gh/mbj/mutant.svg?style=shield&circle-token=1afd77e8f0f9d0a11fd8f15f5d7b10270f4665e2)](https://circleci.com/gh/mbj/mutant/tree/master)
|
5
|
-
[![Code Climate](https://codeclimate.com/github/mbj/mutant.svg)](https://codeclimate.com/github/mbj/mutant)
|
6
|
-
[![Inline docs](http://inch-ci.org/github/mbj/mutant.svg)](http://inch-ci.org/github/mbj/mutant)
|
7
5
|
[![Gem Version](https://img.shields.io/gem/v/mutant.svg)](https://rubygems.org/gems/mutant)
|
8
6
|
[![Slack Status](https://mutation-testing-slack.herokuapp.com/badge.svg)](https://mutation-testing.slack.com/messages/mutant)
|
9
7
|
|
@@ -14,7 +12,7 @@ Mutant is a mutation testing tool for Ruby. Mutation testing is a technique to v
|
|
14
12
|
## Why do I want it?
|
15
13
|
|
16
14
|
Mutant adds to your toolbox: Detection of uncovered semantics in your code.
|
17
|
-
Coverage becomes a
|
15
|
+
Coverage becomes a meaningful metric!
|
18
16
|
|
19
17
|
On each detection of uncovered semantics you have the opportunity to:
|
20
18
|
|
@@ -25,172 +23,107 @@ On each detection of uncovered semantics you have the opportunity to:
|
|
25
23
|
## How Do I use it?
|
26
24
|
|
27
25
|
* Start with reading the [nomenclature](/docs/nomenclature.md) documentation.
|
28
|
-
*
|
26
|
+
* Then select and setup your [integration](/docs/nomenclature.md#integration), also make sure
|
29
27
|
you can reproduce the examples in the integration specific documentation.
|
30
|
-
* Identify your preferred mutation testing strategy.
|
28
|
+
* Identify your preferred mutation testing strategy. It is recommended to start at the commit level,
|
31
29
|
to test only the code you had been touching. See the [incremental](#only-mutating-changed-code)
|
32
30
|
mutation testing documentation.
|
33
31
|
|
34
|
-
|
35
|
-
to do its magic.
|
32
|
+
## Licensing
|
36
33
|
|
37
|
-
|
38
|
-
------
|
34
|
+
Mutant was recently transitioned commercial software, with a free usage plan for opensource projects.
|
39
35
|
|
40
|
-
|
41
|
-
|
42
|
-
* [Known Problems](/docs/known-problems.md)
|
43
|
-
* [Limitations](/docs/limitations.md)
|
44
|
-
* [Concurrency](/docs/concurrency.md)
|
45
|
-
* [Rspec Integration](/docs/mutant-rspec.md)
|
46
|
-
* [Minitest Integration](/docs/mutant-minitest.md)
|
36
|
+
Commercial projects have to acquire a license per developer, with unlimited repositories
|
37
|
+
per developer.
|
47
38
|
|
48
|
-
|
49
|
-
----------
|
39
|
+
Opensource projects have to acquire their free license per repository.
|
50
40
|
|
51
|
-
|
52
|
-
|
53
|
-
|
41
|
+
The license distribution happens through the `mutant-license` gem in mutants dependencies.
|
42
|
+
This gem is dynamically generated per licensee and comes with a unique license gem source
|
43
|
+
URL.
|
54
44
|
|
55
|
-
|
45
|
+
After signup for a license the following has to be added to your `Gemfile` replacing `${key}`
|
46
|
+
with the license key and `${plan}` with `com` for commercial or `oss` for opensource usage.
|
56
47
|
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
If your organization is interested in sponsoring a feature, general maintainership or bugfixes, contact
|
62
|
-
[Markus Schirp](mailto:mbj@schirp-dso.com).
|
63
|
-
|
64
|
-
Mutation-Operators
|
65
|
-
------------------
|
66
|
-
|
67
|
-
Mutant supports a wide range of mutation operators. An exhaustive list can be found in the [mutant-meta](https://github.com/mbj/mutant/tree/master/meta).
|
68
|
-
The `mutant-meta` is arranged to the AST-Node-Types of parser. Refer to parsers [AST documentation](https://github.com/whitequark/parser/blob/master/doc/AST_FORMAT.md) in doubt.
|
69
|
-
|
70
|
-
There is no easy and universal way to count the number of mutation operators a tool supports.
|
71
|
-
|
72
|
-
Neutral (noop) Tests
|
73
|
-
--------------------
|
74
|
-
|
75
|
-
Mutant will also test the original, unmutated, version your code. This ensures that mutant is able to properly setup and run your tests.
|
76
|
-
If an error occurs while mutant/rspec is running testing the original code, you will receive an error like the following:
|
77
|
-
```
|
78
|
-
--- Neutral failure ---
|
79
|
-
Original code was inserted unmutated. And the test did NOT PASS.
|
80
|
-
Your tests do not pass initially or you found a bug in mutant / unparser.
|
81
|
-
...
|
82
|
-
Test Output:
|
83
|
-
marshal data too short
|
48
|
+
```ruby
|
49
|
+
source 'https://${plan}:${key}@gem.mutant.dev' do
|
50
|
+
gem 'mutant-license'
|
51
|
+
end
|
84
52
|
```
|
85
|
-
Currently, troubleshooting these errors requires using a debugger and/or modyifying mutant to print out the error. You will want to rescue and inspect exceptions raised in this method: lib/mutant/integration/rspec.rb:call
|
86
|
-
|
87
|
-
Only Mutating Changed Code
|
88
|
-
--------------------------
|
89
53
|
|
90
|
-
|
91
|
-
|
92
|
-
```
|
93
|
-
bundle exec mutant --include lib --require virtus --since master --use rspec Virtus::Attribute#type
|
94
|
-
```
|
54
|
+
The mutant license gem contains metadata that allows mutant to verify licensed use.
|
95
55
|
|
96
|
-
|
56
|
+
For commercial licenses mutant checks the git commit author or the configured git email
|
57
|
+
to be in the set of licensed developers.
|
97
58
|
|
98
|
-
|
99
|
-
|
59
|
+
For opensource licenses mutant checks the git remotes against the license whitelist.
|
60
|
+
This allows the project maintainer to sign up and not bother collaborators with the details.
|
100
61
|
|
101
|
-
There are
|
62
|
+
There are, apart from initial license gem installation, no remote interactions for
|
63
|
+
license validation.
|
102
64
|
|
103
|
-
|
104
|
-
* [Wrocloverb 2014](http://wrocloverb.com/) / https://www.youtube.com/watch?v=rz-lFKEioLk
|
105
|
-
* [eurucamp 2013](http://2013.eurucamp.org/) / FrOSCon-2013 http://slid.es/markusschirp/mutation-testing
|
106
|
-
* [Cologne.rb](http://www.colognerb.de/topics/mutation-testing-mit-mutant) / https://github.com/DonSchado/colognerb-on-mutant/blob/master/mutation_testing_slides.pdf
|
65
|
+
To inquire for license please contact [Markus Schirp](mailto:mbj@schirp-dso.com?subject=Mutant%20License).
|
107
66
|
|
108
|
-
|
109
|
-
------------------------
|
67
|
+
### Pricing
|
110
68
|
|
111
|
-
|
112
|
-
people do talks about it at conferences, user groups or other chances. Thanks for that!
|
69
|
+
Only relevant for commercial use.
|
113
70
|
|
114
|
-
|
115
|
-
|
71
|
+
Mutant offers a subscription model under a monthly plan.
|
72
|
+
Yearly prepayments with discounts are available.
|
116
73
|
|
117
|
-
|
118
|
-
My intention is NOT to change your bias pro / against this tool. Just to help to fix
|
119
|
-
invalid statements about the tool.
|
74
|
+
For higher volumes different arrangements can be negotiated.
|
120
75
|
|
121
|
-
|
122
|
-
significantly. One of mutants biggest weaknesses is the bad documentation, but instead of
|
123
|
-
assumptions based on the absence of docs, use the tool authors brain to fill the gaps.
|
76
|
+
## Topics
|
124
77
|
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
* [A deep dive into mutation testing and how the Mutant gem works][troessner]
|
133
|
-
* [Keep calm and kill mutants (December, 2015)][itransition]
|
134
|
-
* [How to write better code using mutation testing (November 2015)][blockscore]
|
135
|
-
* [How good are your Ruby tests? Testing your tests with mutant (June 2015)][arkency1]
|
136
|
-
* [Mutation testing and continuous integration (May 2015)][arkency2]
|
137
|
-
* [Why I want to introduce mutation testing to the `rails_event_store` gem (April 2015)][arkency3]
|
138
|
-
* [Mutation testing with mutant (April 2014)][sitepoint]
|
139
|
-
* [Mutation testing with mutant (January 2013)][solnic]
|
140
|
-
|
141
|
-
[troessner]: https://troessner.svbtle.com/kill-all-the-mutants-a-deep-dive-into-mutation-testing-and-how-the-mutant-gem-works
|
142
|
-
[itransition]: https://github.com/maksar/mentat
|
143
|
-
[blockscore]: https://blog.blockscore.com/how-to-write-better-code-using-mutation-testing/
|
144
|
-
[sitepoint]: http://www.sitepoint.com/mutation-testing-mutant/
|
145
|
-
[arkency1]: http://blog.arkency.com/2015/06/how-good-are-your-ruby-tests-testing-your-tests-with-mutant/
|
146
|
-
[arkency2]: http://blog.arkency.com/2015/05/mutation-testing-and-continuous-integration/
|
147
|
-
[arkency3]: http://blog.arkency.com/2015/04/why-i-want-to-introduce-mutation-testing-to-the-rails-event-store-gem/
|
148
|
-
[solnic]: http://solnic.eu/2013/01/23/mutation-testing-with-mutant.html
|
149
|
-
|
150
|
-
Support
|
151
|
-
-------
|
152
|
-
|
153
|
-
I'm very happy to receive/answer feedback/questions and criticism.
|
154
|
-
|
155
|
-
Your options:
|
156
|
-
|
157
|
-
* [GitHub Issues](https://github.com/mbj/mutant/issues)
|
158
|
-
* Ping me on [twitter](https://twitter.com/_m_b_j_)
|
78
|
+
* [Nomenclature](/docs/nomenclature.md)
|
79
|
+
* [Reading Reports](/docs/reading-reports.md)
|
80
|
+
* [Known Problems](/docs/known-problems.md)
|
81
|
+
* [Limitations](/docs/limitations.md)
|
82
|
+
* [Concurrency](/docs/concurrency.md)
|
83
|
+
* [Rspec Integration](/docs/mutant-rspec.md)
|
84
|
+
* [Minitest Integration](/docs/mutant-minitest.md)
|
159
85
|
|
160
|
-
|
161
|
-
For discussing this project, join [#mutant](https://mutation-testing.slack.com/messages/#mutant).
|
86
|
+
## Communication
|
162
87
|
|
163
|
-
|
88
|
+
Try the following:
|
164
89
|
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
- [#mutagen](https://mutation-testing.slack.com/messages/mutagen): for discussing `mutagen`, the javascript mutation testing tool.
|
169
|
-
- [#random](https://mutation-testing.slack.com/messages/random): for misc. off topic discussion.
|
170
|
-
- [#stryker](https://mutation-testing.slack.com/messages/stryker): for discussing `stryker`, the javascript mutation testing tool.
|
171
|
-
- [#wtf-dev](https://mutation-testing.slack.com/messages/wtf-dev): for sharing software development wtfs.
|
90
|
+
* [Github Issues](https://github.com/mbj/mutant/issues)
|
91
|
+
* [Release Announcement Mailing List](https://announce.mutant.dev/signup)
|
92
|
+
* [Slack channel](mutation-testing.slack.com) request invite from [Markus Schirp](mailto:mbj@schirp-dso.com?subject=Mutation%20Testing%20Slack%20Channel%20Invite).
|
172
93
|
|
94
|
+
## Sponsoring
|
173
95
|
|
174
|
-
|
175
|
-
|
96
|
+
Mutant, as published in the opensource version, would not exist without the help
|
97
|
+
of [contributors](https://github.com/mbj/mutant/graphs/contributors) spending lots
|
98
|
+
of their private time.
|
176
99
|
|
177
|
-
|
178
|
-
* A gist, now removed, from [dkubb](https://github.com/dkubb) showing ideas.
|
179
|
-
* Older abandoned [mutant](https://github.com/txus/mutant). For motivating me doing this one.
|
180
|
-
* [heckle](https://github.com/seattlerb/heckle). For getting me into mutation testing.
|
100
|
+
Additionally, the following features where sponsored by organizations:
|
181
101
|
|
182
|
-
|
183
|
-
|
102
|
+
* The `mutant-minitest` integration was sponsored by [Arkency](https://arkency.com/)
|
103
|
+
* Mutant's initial concurrency support was sponsored by an undisclosed company that does
|
104
|
+
currently not wish to be listed here.
|
184
105
|
|
185
|
-
|
186
|
-
* Make your feature addition or bug fix.
|
187
|
-
* Add tests for it. This is important so I don't break it in a
|
188
|
-
future version unintentionally.
|
189
|
-
* Commit, do not mess with Rakefile or version
|
190
|
-
(if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
|
191
|
-
* Send me a pull request. Bonus points for topic branches.
|
106
|
+
### Legal
|
192
107
|
|
193
|
-
|
194
|
-
-------
|
108
|
+
Contents of this repository are maintained by:
|
195
109
|
|
196
|
-
|
110
|
+
```
|
111
|
+
Schirp DSO LTD
|
112
|
+
Director: Markus Schirp
|
113
|
+
Email: info@schirp-dso.com
|
114
|
+
Vat-ID: MT24186727
|
115
|
+
Registration: C80467
|
116
|
+
|
117
|
+
Office address:
|
118
|
+
2, Carob Lane,
|
119
|
+
Sir Harry Luke Street
|
120
|
+
Naxxar NXR 2209,
|
121
|
+
Malta
|
122
|
+
|
123
|
+
Registred Address
|
124
|
+
Phoenix Business Centre,
|
125
|
+
The Penthouse,
|
126
|
+
Old Railway Track,
|
127
|
+
Santa Venera SVR9022,
|
128
|
+
Malta
|
129
|
+
```
|
data/Rakefile
CHANGED
@@ -3,24 +3,3 @@
|
|
3
3
|
require 'devtools'
|
4
4
|
|
5
5
|
Devtools.init_rake_tasks
|
6
|
-
|
7
|
-
Rake.application.load_imports
|
8
|
-
|
9
|
-
task('metrics:mutant').clear
|
10
|
-
namespace :metrics do
|
11
|
-
task mutant: :coverage do
|
12
|
-
arguments = %w[
|
13
|
-
bundle exec mutant
|
14
|
-
--include lib
|
15
|
-
--since HEAD~1
|
16
|
-
--require mutant
|
17
|
-
--use rspec
|
18
|
-
--zombie
|
19
|
-
]
|
20
|
-
arguments.concat(%w[--jobs 4]) if ENV.key?('CIRCLECI')
|
21
|
-
|
22
|
-
arguments.concat(%w[-- Mutant*])
|
23
|
-
|
24
|
-
Kernel.system(*arguments) or fail 'Mutant task is not successful'
|
25
|
-
end
|
26
|
-
end
|
data/bin/mutant
CHANGED
@@ -25,7 +25,6 @@ namespace =
|
|
25
25
|
includes: %w[
|
26
26
|
mutant
|
27
27
|
unparser
|
28
|
-
morpher
|
29
28
|
adamantium
|
30
29
|
equalizer
|
31
30
|
anima
|
@@ -37,4 +36,10 @@ namespace =
|
|
37
36
|
Mutant
|
38
37
|
end
|
39
38
|
|
40
|
-
Kernel.exit(
|
39
|
+
Kernel.exit(
|
40
|
+
namespace::CLI.run(
|
41
|
+
namespace::WORLD,
|
42
|
+
namespace::Config::DEFAULT,
|
43
|
+
ARGV
|
44
|
+
)
|
45
|
+
)
|
data/config/reek.yml
CHANGED
@@ -61,6 +61,8 @@ detectors:
|
|
61
61
|
- Mutant::Mutator
|
62
62
|
- Mutant::Meta::Example::DSL
|
63
63
|
max_ifs: 1
|
64
|
+
TooManyConstants:
|
65
|
+
enabled: false
|
64
66
|
TooManyInstanceVariables:
|
65
67
|
enabled: true
|
66
68
|
exclude:
|
@@ -125,7 +127,6 @@ detectors:
|
|
125
127
|
enabled: true
|
126
128
|
exclude:
|
127
129
|
- Mutant::AST::Sexp#s
|
128
|
-
- Mutant::Actor::Env#new_mailbox
|
129
130
|
- Mutant::CLI#reporter
|
130
131
|
- Mutant::Integration::Null#call
|
131
132
|
- Mutant::Integration::Rspec#parse_example
|
data/config/rubocop.yml
CHANGED
@@ -94,10 +94,6 @@ PercentLiteralDelimiters:
|
|
94
94
|
SymbolArray:
|
95
95
|
Enabled: true
|
96
96
|
|
97
|
-
# Align if/else blocks with the variable assignment
|
98
|
-
EndAlignment:
|
99
|
-
EnforcedStyleAlignWith: variable
|
100
|
-
|
101
97
|
# Prefer #kind_of? over #is_a?
|
102
98
|
ClassCheck:
|
103
99
|
EnforcedStyle: kind_of?
|
@@ -111,11 +107,9 @@ Metrics/AbcSize:
|
|
111
107
|
Max: 21.02
|
112
108
|
|
113
109
|
Metrics/BlockLength:
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
LambdaCall:
|
118
|
-
Enabled: false
|
110
|
+
Exclude:
|
111
|
+
- 'spec/**/*.rb'
|
112
|
+
- 'mutant.gemspec'
|
119
113
|
|
120
114
|
# Buggy cop, returns false positive for our code base
|
121
115
|
NonLocalExitFromIterator:
|
@@ -196,6 +190,8 @@ Style/CommentedKeyword:
|
|
196
190
|
Enabled: false
|
197
191
|
Style/MixinGrouping:
|
198
192
|
Enabled: false
|
193
|
+
Style/RaiseArgs:
|
194
|
+
Enabled: false
|
199
195
|
Style/RescueStandardError:
|
200
196
|
Enabled: false
|
201
197
|
Style/StderrPuts:
|
data/docs/incremental.md
ADDED
@@ -0,0 +1,76 @@
|
|
1
|
+
# Incremental mutation testing
|
2
|
+
|
3
|
+
Incremental mutation testing allows you to significantly speed up mutation
|
4
|
+
analysis, via skipping over subjects that are not changed.
|
5
|
+
|
6
|
+
This is an explicit trade off, often worth the downsides.
|
7
|
+
|
8
|
+
## Motivation
|
9
|
+
|
10
|
+
Despite all efforts in setting up a project for maximum mutation testing
|
11
|
+
efficiency, running a full pass over all available subjects is not always
|
12
|
+
desired. On building your branches on CI, and during local commit stage, its
|
13
|
+
instead more efficient to scope the Mutant run to everything that was
|
14
|
+
touched in the current branch / commit. The working set of subjects.
|
15
|
+
|
16
|
+
For not having to manually keep track of the working set, the `--since` option
|
17
|
+
allows you to specify a git reference point. Mutant will automatically subset all
|
18
|
+
available subjects to the ones that where touched since the reference point.
|
19
|
+
|
20
|
+
## Usage
|
21
|
+
|
22
|
+
Use the `--since git-reference` flag to enable automatic filtering of the
|
23
|
+
matched subjects to the ones that have a line changed since the reference
|
24
|
+
point.
|
25
|
+
|
26
|
+
Internally mutant will use the semantics of `git diff git-reference` to
|
27
|
+
determine which subjects have changes. A subject is selected by this mechanism
|
28
|
+
when `git diff` reports a hunk that overlaps with the current subjects line
|
29
|
+
range.
|
30
|
+
|
31
|
+
## Example
|
32
|
+
|
33
|
+
On a branch, executing:
|
34
|
+
|
35
|
+
```
|
36
|
+
mutant --since master 'ProjectNamespace*'
|
37
|
+
```
|
38
|
+
|
39
|
+
Will run mutation testing against all subjects that have a direct source code
|
40
|
+
since the `master` branch. Assuming your project has 100 subjects, and you
|
41
|
+
touched 2 of them in your branch: Mutant will only select these 2 subjects for
|
42
|
+
mutation testing.
|
43
|
+
|
44
|
+
## Recommended use
|
45
|
+
|
46
|
+
Use incremental for any project where a full pass does not fit within acceptable
|
47
|
+
round trip times for the human mind.
|
48
|
+
|
49
|
+
A small 200 loc gem, should probably never use it. Typically its the local per
|
50
|
+
developer environment that should use incremental first. On CI its recommended
|
51
|
+
to stay with the full pass as long as possible and switch to incremental mode
|
52
|
+
when the CI cycle time gets too annoying.
|
53
|
+
|
54
|
+
In addition, once using incremental its recommended to run a full pass as a
|
55
|
+
nightly job.
|
56
|
+
|
57
|
+
Incremental is also a good mode to retrofit mutation testing into a legacy
|
58
|
+
project.
|
59
|
+
|
60
|
+
Good selectors for reference points are `HEAD~1` (the previous commit) or
|
61
|
+
`master` (the integration branch).
|
62
|
+
|
63
|
+
## Limitations
|
64
|
+
|
65
|
+
Mutant only triggers incremental subject selection for *direct* code changes.
|
66
|
+
It'll currently not select subjects that where indirectly changed.
|
67
|
+
|
68
|
+
Counter examples:
|
69
|
+
|
70
|
+
* A change to a constant that results in a behavior change of a subject will
|
71
|
+
not trigger that subject to be selected.
|
72
|
+
* A change to a subject A that causes another subject B to change in behavior,
|
73
|
+
will not select subject B.
|
74
|
+
|
75
|
+
These limitations may be removed in future versions of mutant, work on more
|
76
|
+
fine grained tracing is underway.
|
data/docs/known-problems.md
CHANGED
@@ -1,20 +1,6 @@
|
|
1
1
|
Known Problems
|
2
2
|
==============
|
3
3
|
|
4
|
-
Mutations with Infinite Runtimes
|
5
|
-
---------------------------------
|
6
|
-
|
7
|
-
Occasionally mutant will produce a mutation with an infinite runtime. When this happens
|
8
|
-
mutant will look like it is running indefinitely without killing a remaining mutation. To
|
9
|
-
avoid mutations like this, consider adding a timeout around your tests. For example, in
|
10
|
-
RSpec you can add the following to your `spec_helper`:
|
11
|
-
```ruby
|
12
|
-
config.around(:each) do |example|
|
13
|
-
Timeout.timeout(5, &example)
|
14
|
-
end
|
15
|
-
```
|
16
|
-
which will fail specs which run for longer than 5 seconds.
|
17
|
-
|
18
4
|
The Crash / Stuck Problem (MRI)
|
19
5
|
-------------------------------
|
20
6
|
|