mutator_rails 0.1.11 → 0.1.17
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.codeclimate.yml +4 -7
- data/CHANGELOG.md +26 -1
- data/Gemfile.lock +80 -70
- data/README.md +22 -8
- data/lib/mutator_rails/full_mutate.rb +40 -3
- data/lib/mutator_rails/guide.rb +5 -3
- data/lib/mutator_rails/mutation_log.rb +5 -3
- data/lib/mutator_rails/single_mutate.rb +17 -6
- data/lib/mutator_rails/statistics.rb +7 -3
- data/lib/mutator_rails/version.rb +1 -1
- data/lib/tasks/mutator/mutate_files.rake +15 -0
- data/lib/tasks/mutator/mutator.rake +1 -1
- data/log/mutant/analysis.tsv +3 -3
- data/log/mutant/models/test.log +2 -0
- data/log/mutant/models/test2.log +2 -2
- data/log/mutant/statistics.txt +6 -0
- data/mutator_rails.gemspec +6 -3
- data/spec/mutator_rails/full_mutate_spec.rb +19 -1
- data/spec/mutator_rails/statistics_spec.rb +6 -0
- metadata +53 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8e113d0cde42730e0cf1e6f528048a94fe100636
|
4
|
+
data.tar.gz: 3222b00262fe86b23db2f383b9cfcd23cb161945
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c6473c439f0672810f9a84001295b2781d0c5d79e544eedfe88ce7140c50cca625be1e894d9ae4cdb941567620da843ff49789c50d283680642af02e9ceb168b
|
7
|
+
data.tar.gz: 6eae2475fd45345a37704b4320704cb66b2ae05f35a09eecc25633979c814c9eb04dc9963c4dcd4e038a83e8d4030fdf2eaf3dd757580cda999a0caad4974d4e
|
data/.codeclimate.yml
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
---
|
2
|
-
|
2
|
+
version: "2"
|
3
|
+
plugins:
|
3
4
|
bundler-audit:
|
4
5
|
enabled: true
|
5
6
|
duplication:
|
@@ -11,10 +12,6 @@ engines:
|
|
11
12
|
enabled: true
|
12
13
|
rubocop:
|
13
14
|
enabled: true
|
14
|
-
|
15
|
-
|
16
|
-
- Gemfile.lock
|
17
|
-
- "**.rake"
|
18
|
-
- "**.rb"
|
19
|
-
exclude_paths:
|
15
|
+
|
16
|
+
exclude_patterns:
|
20
17
|
- bin/
|
data/CHANGELOG.md
CHANGED
@@ -10,6 +10,31 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
|
|
10
10
|
|
11
11
|
### Changed
|
12
12
|
|
13
|
+
### Removed
|
14
|
+
|
15
|
+
## [0.1.17] - 2020-07-31
|
16
|
+
|
17
|
+
_NB: Some of the changes below were released in versions not reflected in this Changelog. This entry brings us up to date._
|
18
|
+
|
19
|
+
### Added
|
20
|
+
|
21
|
+
- Add -j1 fallback and failure tracking to statistics.
|
22
|
+
[I50](https://github.com/dinj-oss/mutator_rails/issues/50) [PR49](https://github.com/dinj-oss/mutator_rails/pull/49)
|
23
|
+
|
24
|
+
- Add check for pending migrations that fail jobs.
|
25
|
+
[I57](https://github.com/dinj-oss/mutator_rails/issues/57) [PR60](https://github.com/dinj-oss/mutator_rails/pull/60)
|
26
|
+
|
27
|
+
|
28
|
+
### Changed
|
29
|
+
|
30
|
+
- Sort the -j1 and failure lists to keep them in order for GIT.
|
31
|
+
[I56](https://github.com/dinj-oss/mutator_rails/issues/56) [PR61](https://github.com/dinj-oss/mutator_rails/pull/61)
|
32
|
+
|
33
|
+
|
34
|
+
- Upgrade for rails security issues.
|
35
|
+
[I58](https://github.com/dinj-oss/mutator_rails/issues/58) [PR59](https://github.com/dinj-oss/mutator_rails/pull/59)
|
36
|
+
|
37
|
+
|
13
38
|
### Removed
|
14
39
|
|
15
40
|
## [0.1.11] - 2018-05-04
|
@@ -40,7 +65,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
|
|
40
65
|
|
41
66
|
- Added this changelog.
|
42
67
|
[I41](https://github.com/dinj-oss/mutator_rails/issues/41) [PR40](https://github.com/dinj-oss/mutator_rails/pull/40)
|
43
|
-
|
68
|
+
|
44
69
|
- Updated Nokogiri gem to 1.8.1 to address a security vulnerability.
|
45
70
|
[I38](https://github.com/dinj-oss/mutator_rails/issues/38) [PR42](https://github.com/dinj-oss/mutator_rails/pull/42)
|
46
71
|
|
data/Gemfile.lock
CHANGED
@@ -1,47 +1,51 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
mutator_rails (0.1.
|
4
|
+
mutator_rails (0.1.17)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
8
8
|
specs:
|
9
9
|
abstract_type (0.0.7)
|
10
|
-
actioncable (5.1
|
11
|
-
actionpack (= 5.1
|
10
|
+
actioncable (5.2.2.1)
|
11
|
+
actionpack (= 5.2.2.1)
|
12
12
|
nio4r (~> 2.0)
|
13
|
-
websocket-driver (
|
14
|
-
actionmailer (5.1
|
15
|
-
actionpack (= 5.1
|
16
|
-
actionview (= 5.1
|
17
|
-
activejob (= 5.1
|
13
|
+
websocket-driver (>= 0.6.1)
|
14
|
+
actionmailer (5.2.2.1)
|
15
|
+
actionpack (= 5.2.2.1)
|
16
|
+
actionview (= 5.2.2.1)
|
17
|
+
activejob (= 5.2.2.1)
|
18
18
|
mail (~> 2.5, >= 2.5.4)
|
19
19
|
rails-dom-testing (~> 2.0)
|
20
|
-
actionpack (5.1
|
21
|
-
actionview (= 5.1
|
22
|
-
activesupport (= 5.1
|
20
|
+
actionpack (5.2.2.1)
|
21
|
+
actionview (= 5.2.2.1)
|
22
|
+
activesupport (= 5.2.2.1)
|
23
23
|
rack (~> 2.0)
|
24
|
-
rack-test (
|
24
|
+
rack-test (>= 0.6.3)
|
25
25
|
rails-dom-testing (~> 2.0)
|
26
26
|
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
27
|
-
actionview (5.1
|
28
|
-
activesupport (= 5.1
|
27
|
+
actionview (5.2.2.1)
|
28
|
+
activesupport (= 5.2.2.1)
|
29
29
|
builder (~> 3.1)
|
30
30
|
erubi (~> 1.4)
|
31
31
|
rails-dom-testing (~> 2.0)
|
32
32
|
rails-html-sanitizer (~> 1.0, >= 1.0.3)
|
33
|
-
activejob (5.1
|
34
|
-
activesupport (= 5.1
|
33
|
+
activejob (5.2.2.1)
|
34
|
+
activesupport (= 5.2.2.1)
|
35
35
|
globalid (>= 0.3.6)
|
36
|
-
activemodel (5.1
|
37
|
-
activesupport (= 5.1
|
38
|
-
activerecord (5.1
|
39
|
-
activemodel (= 5.1
|
40
|
-
activesupport (= 5.1
|
41
|
-
arel (
|
42
|
-
|
36
|
+
activemodel (5.2.2.1)
|
37
|
+
activesupport (= 5.2.2.1)
|
38
|
+
activerecord (5.2.2.1)
|
39
|
+
activemodel (= 5.2.2.1)
|
40
|
+
activesupport (= 5.2.2.1)
|
41
|
+
arel (>= 9.0)
|
42
|
+
activestorage (5.2.2.1)
|
43
|
+
actionpack (= 5.2.2.1)
|
44
|
+
activerecord (= 5.2.2.1)
|
45
|
+
marcel (~> 0.3.1)
|
46
|
+
activesupport (5.2.2.1)
|
43
47
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
44
|
-
i18n (
|
48
|
+
i18n (>= 0.7, < 2)
|
45
49
|
minitest (~> 5.1)
|
46
50
|
tzinfo (~> 1.1)
|
47
51
|
adamantium (0.2.0)
|
@@ -51,7 +55,7 @@ GEM
|
|
51
55
|
abstract_type (~> 0.0.7)
|
52
56
|
adamantium (~> 0.2)
|
53
57
|
equalizer (~> 0.0.11)
|
54
|
-
arel (
|
58
|
+
arel (9.0.0)
|
55
59
|
ast (2.3.0)
|
56
60
|
axiom-types (0.1.1)
|
57
61
|
descendants_tracker (~> 0.0.4)
|
@@ -67,32 +71,34 @@ GEM
|
|
67
71
|
concord (0.1.5)
|
68
72
|
adamantium (~> 0.2.0)
|
69
73
|
equalizer (~> 0.0.9)
|
70
|
-
concurrent-ruby (1.
|
71
|
-
crass (1.0.
|
74
|
+
concurrent-ruby (1.1.5)
|
75
|
+
crass (1.0.5)
|
72
76
|
descendants_tracker (0.0.4)
|
73
77
|
thread_safe (~> 0.3, >= 0.3.1)
|
74
78
|
diff-lcs (1.3)
|
75
79
|
docile (1.1.5)
|
76
80
|
equalizer (0.0.11)
|
77
|
-
erubi (1.
|
78
|
-
globalid (0.4.
|
81
|
+
erubi (1.8.0)
|
82
|
+
globalid (0.4.2)
|
79
83
|
activesupport (>= 4.2.0)
|
80
|
-
i18n (
|
84
|
+
i18n (1.6.0)
|
85
|
+
concurrent-ruby (~> 1.0)
|
81
86
|
ice_nine (0.11.2)
|
82
|
-
json (2.1
|
83
|
-
loofah (2.
|
87
|
+
json (2.3.1)
|
88
|
+
loofah (2.3.1)
|
84
89
|
crass (~> 1.0.2)
|
85
90
|
nokogiri (>= 1.5.9)
|
86
|
-
mail (2.
|
87
|
-
|
91
|
+
mail (2.7.1)
|
92
|
+
mini_mime (>= 0.1.1)
|
93
|
+
marcel (0.3.3)
|
94
|
+
mimemagic (~> 0.3.2)
|
88
95
|
memoizable (0.4.2)
|
89
96
|
thread_safe (~> 0.3, >= 0.3.1)
|
90
|
-
method_source (0.
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
minitest (5.10.2)
|
97
|
+
method_source (0.9.2)
|
98
|
+
mimemagic (0.3.3)
|
99
|
+
mini_mime (1.0.1)
|
100
|
+
mini_portile2 (2.4.0)
|
101
|
+
minitest (5.11.3)
|
96
102
|
morpher (0.2.6)
|
97
103
|
abstract_type (~> 0.0.7)
|
98
104
|
adamantium (~> 0.2.0)
|
@@ -121,42 +127,43 @@ GEM
|
|
121
127
|
mutant-rspec (0.8.14)
|
122
128
|
mutant (~> 0.8.14)
|
123
129
|
rspec-core (>= 3.4.0, < 3.7.0)
|
124
|
-
nio4r (2.
|
125
|
-
nokogiri (1.8
|
126
|
-
mini_portile2 (~> 2.
|
130
|
+
nio4r (2.3.1)
|
131
|
+
nokogiri (1.10.8)
|
132
|
+
mini_portile2 (~> 2.4.0)
|
127
133
|
parallel (1.11.2)
|
128
134
|
parser (2.4.0.0)
|
129
135
|
ast (~> 2.2)
|
130
136
|
procto (0.0.3)
|
131
|
-
rack (2.
|
132
|
-
rack-test (
|
133
|
-
rack (>= 1.0)
|
134
|
-
rails (5.1
|
135
|
-
actioncable (= 5.1
|
136
|
-
actionmailer (= 5.1
|
137
|
-
actionpack (= 5.1
|
138
|
-
actionview (= 5.1
|
139
|
-
activejob (= 5.1
|
140
|
-
activemodel (= 5.1
|
141
|
-
activerecord (= 5.1
|
142
|
-
|
143
|
-
|
144
|
-
|
137
|
+
rack (2.2.3)
|
138
|
+
rack-test (1.1.0)
|
139
|
+
rack (>= 1.0, < 3)
|
140
|
+
rails (5.2.2.1)
|
141
|
+
actioncable (= 5.2.2.1)
|
142
|
+
actionmailer (= 5.2.2.1)
|
143
|
+
actionpack (= 5.2.2.1)
|
144
|
+
actionview (= 5.2.2.1)
|
145
|
+
activejob (= 5.2.2.1)
|
146
|
+
activemodel (= 5.2.2.1)
|
147
|
+
activerecord (= 5.2.2.1)
|
148
|
+
activestorage (= 5.2.2.1)
|
149
|
+
activesupport (= 5.2.2.1)
|
150
|
+
bundler (>= 1.3.0)
|
151
|
+
railties (= 5.2.2.1)
|
145
152
|
sprockets-rails (>= 2.0.0)
|
146
153
|
rails-dom-testing (2.0.3)
|
147
154
|
activesupport (>= 4.2.0)
|
148
155
|
nokogiri (>= 1.6)
|
149
156
|
rails-html-sanitizer (1.0.4)
|
150
157
|
loofah (~> 2.2, >= 2.2.2)
|
151
|
-
railties (5.1
|
152
|
-
actionpack (= 5.1
|
153
|
-
activesupport (= 5.1
|
158
|
+
railties (5.2.2.1)
|
159
|
+
actionpack (= 5.2.2.1)
|
160
|
+
activesupport (= 5.2.2.1)
|
154
161
|
method_source
|
155
162
|
rake (>= 0.8.7)
|
156
|
-
thor (>= 0.
|
163
|
+
thor (>= 0.19.0, < 2.0)
|
157
164
|
rainbow (2.2.2)
|
158
165
|
rake
|
159
|
-
rake (
|
166
|
+
rake (13.0.1)
|
160
167
|
reek (4.7.2)
|
161
168
|
codeclimate-engine-rb (~> 0.4.0)
|
162
169
|
parser (>= 2.4.0.0, < 2.5)
|
@@ -181,16 +188,16 @@ GEM
|
|
181
188
|
json (>= 1.8, < 3)
|
182
189
|
simplecov-html (~> 0.10.0)
|
183
190
|
simplecov-html (0.10.1)
|
184
|
-
sprockets (3.7.
|
191
|
+
sprockets (3.7.2)
|
185
192
|
concurrent-ruby (~> 1.0)
|
186
193
|
rack (> 1, < 3)
|
187
|
-
sprockets-rails (3.2.
|
194
|
+
sprockets-rails (3.2.1)
|
188
195
|
actionpack (>= 4.0)
|
189
196
|
activesupport (>= 4.0)
|
190
197
|
sprockets (>= 3.0.0)
|
191
|
-
thor (0.
|
198
|
+
thor (0.20.3)
|
192
199
|
thread_safe (0.3.6)
|
193
|
-
tzinfo (1.2.
|
200
|
+
tzinfo (1.2.5)
|
194
201
|
thread_safe (~> 0.1)
|
195
202
|
unparser (0.2.6)
|
196
203
|
abstract_type (~> 0.0.7)
|
@@ -205,24 +212,27 @@ GEM
|
|
205
212
|
coercible (~> 1.0)
|
206
213
|
descendants_tracker (~> 0.0, >= 0.0.3)
|
207
214
|
equalizer (~> 0.0, >= 0.0.9)
|
208
|
-
websocket-driver (0.
|
215
|
+
websocket-driver (0.7.0)
|
209
216
|
websocket-extensions (>= 0.1.0)
|
210
|
-
websocket-extensions (0.1.
|
217
|
+
websocket-extensions (0.1.5)
|
211
218
|
|
212
219
|
PLATFORMS
|
213
220
|
ruby
|
214
221
|
|
215
222
|
DEPENDENCIES
|
223
|
+
actionview (>= 5.1.6.2)
|
216
224
|
adamantium (~> 0.2.0)
|
217
225
|
bundler (~> 1.15)
|
218
226
|
codeclimate-test-reporter
|
219
227
|
concord (~> 0.1.4)
|
228
|
+
loofah (>= 2.3.1)
|
220
229
|
mutant (~> 0.8.14)
|
221
230
|
mutant-rspec (~> 0.8.14)
|
222
231
|
mutator_rails!
|
232
|
+
nokogiri (>= 1.10.4)
|
223
233
|
procto (~> 0.0.3)
|
224
234
|
rails (>= 4.0)
|
225
|
-
rake (~>
|
235
|
+
rake (~> 13.0)
|
226
236
|
reek (~> 4.7.2)
|
227
237
|
rspec-collection_matchers
|
228
238
|
rspec-core (~> 3.6.0)
|
@@ -231,4 +241,4 @@ DEPENDENCIES
|
|
231
241
|
rspec_junit_formatter
|
232
242
|
|
233
243
|
BUNDLED WITH
|
234
|
-
1.
|
244
|
+
1.17.3
|
data/README.md
CHANGED
@@ -2,23 +2,37 @@
|
|
2
2
|
|
3
3
|
Integrate automated mutation testing into your Rails application
|
4
4
|
|
5
|
+
## Overview
|
6
|
+
|
7
|
+
The goal of mutation testing is to improve your test coverage by finding elements of code that are not tested.
|
8
|
+
|
9
|
+
This gem supports the process of continually mutation testing a Rails application by logging results for analysis
|
10
|
+
and hashing source and spec files so that future mutation runs will only run against code that has changed.
|
11
|
+
|
5
12
|
## Installation
|
6
13
|
|
7
|
-
Add these lines to your application's Gemfile
|
14
|
+
Add these lines to your application's Gemfile and then run `bundle`:
|
8
15
|
|
9
16
|
```ruby
|
10
|
-
gem 'mutant'
|
11
|
-
gem 'mutant-rspec'
|
12
|
-
gem 'mutator_rails'
|
17
|
+
gem 'mutant', github: 'mbj/mutant', ref: '90d103dc323eded68a7e80439def069f18b5e990'
|
18
|
+
gem 'mutant-rspec', github: 'mbj/mutant', ref: '90d103dc323eded68a7e80439def069f18b5e990'
|
19
|
+
gem 'mutator_rails'
|
13
20
|
```
|
14
21
|
|
15
|
-
|
22
|
+
You'll notice that both the `mutant` and `mutant-rspec` gems are locked to a specific commit.
|
23
|
+
This is because that project has gone through some licensing changes and is not open source beyond this commit.
|
24
|
+
If you're interested in licensing the proprietary version, please contact [Markus Schirp](https://github.com/mbj) regarding how to obtain a license.
|
16
25
|
|
17
|
-
$ bundle
|
18
26
|
|
19
27
|
## Usage
|
20
28
|
|
21
|
-
|
29
|
+
- `rails mutator:all` - Run all of the following rake tasks (this is likely the one you want to run)
|
30
|
+
- `rails mutator:files` - Runs mutant on any files missing or changed since the guide file was last created. Also creates the
|
31
|
+
guide file if missing. The guide file contains the test subject's file name, MD5 hashes of the source and spec files, and
|
32
|
+
the version of Mutant the file was last tested against.
|
33
|
+
- `rails mutator:cleanup` - Removes entries from guide file for any test subjects that no longer exist in the codebase.
|
34
|
+
- `rails mutator:analyze` - Generates an analysis TSV that summaries the mutation results for each subject mutated.
|
35
|
+
- `rails mutator:statistic` - Generates a summary file containing useful statistics about the mutation run.
|
22
36
|
|
23
37
|
## Development
|
24
38
|
|
@@ -28,4 +42,4 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
28
42
|
|
29
43
|
## Contributing
|
30
44
|
|
31
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
45
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/hintmedia/mutator_rails.
|
@@ -13,21 +13,58 @@ module MutatorRails
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def call
|
16
|
-
|
16
|
+
process(all_files)
|
17
|
+
end
|
18
|
+
|
19
|
+
def unprocessed
|
20
|
+
process(unprocessed_files)
|
21
|
+
end
|
22
|
+
|
23
|
+
def j1
|
24
|
+
process(j1_files)
|
25
|
+
end
|
26
|
+
|
27
|
+
def changed
|
28
|
+
process(all_files - unprocessed_files - j1_files)
|
29
|
+
end
|
30
|
+
|
31
|
+
private
|
32
|
+
|
33
|
+
def unprocessed_files
|
34
|
+
all_files.select do |file|
|
35
|
+
sm = SingleMutate.new(guide, file)
|
36
|
+
!exclude?(file) && !guide.log_exists?(sm.log)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def j1_files
|
41
|
+
all_files.select do |file|
|
42
|
+
sm = SingleMutate.new(guide, file)
|
43
|
+
!exclude?(file) && sm.need_j1?
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
def process(files)
|
48
|
+
files.sort_by { |x| File.size(x) }.each do |file|
|
17
49
|
next if exclude?(file)
|
18
50
|
|
19
51
|
SingleMutate.new(guide, file).call
|
20
52
|
end
|
21
53
|
end
|
22
54
|
|
23
|
-
|
55
|
+
def all_files
|
56
|
+
Dir.glob(APP_BASE + '**/*.rb')
|
57
|
+
end
|
24
58
|
|
25
59
|
def excluded_files
|
26
60
|
@exclusions ||= load_exclusions
|
27
61
|
end
|
28
62
|
|
29
63
|
def load_exclusions
|
30
|
-
MutatorRails::Config.configuration
|
64
|
+
MutatorRails::Config.configuration
|
65
|
+
.exclusions
|
66
|
+
.compact
|
67
|
+
.flat_map { |exclusion| Dir.glob(exclusion) }
|
31
68
|
end
|
32
69
|
|
33
70
|
def exclude?(file)
|
data/lib/mutator_rails/guide.rb
CHANGED
@@ -15,7 +15,7 @@ module MutatorRails
|
|
15
15
|
# p guides[log]
|
16
16
|
File.exist?(log) &&
|
17
17
|
File.size(log).positive? &&
|
18
|
-
|
18
|
+
log_exists?(log) &&
|
19
19
|
guides[log].eql?([code_md5, spec_md5, MUTANT_VERSION])
|
20
20
|
end
|
21
21
|
|
@@ -24,6 +24,10 @@ module MutatorRails
|
|
24
24
|
recreate
|
25
25
|
end
|
26
26
|
|
27
|
+
def log_exists?(log)
|
28
|
+
guides[log].present?
|
29
|
+
end
|
30
|
+
|
27
31
|
def remove(log)
|
28
32
|
guides.delete(log)
|
29
33
|
recreate
|
@@ -63,7 +67,5 @@ module MutatorRails
|
|
63
67
|
FileUtils.mkdir_p(p.dirname)
|
64
68
|
end
|
65
69
|
end
|
66
|
-
|
67
|
-
|
68
70
|
end
|
69
71
|
end
|
@@ -11,7 +11,9 @@ module MutatorRails
|
|
11
11
|
'total',
|
12
12
|
'pct killed',
|
13
13
|
'mutations per sec',
|
14
|
-
'runtime'
|
14
|
+
'runtime',
|
15
|
+
'failure',
|
16
|
+
'j1'].join("\t") + "\n").freeze
|
15
17
|
|
16
18
|
def initialize(*)
|
17
19
|
super
|
@@ -22,7 +24,7 @@ module MutatorRails
|
|
22
24
|
def to_s
|
23
25
|
return '' unless complete?
|
24
26
|
|
25
|
-
[link, kills, alive, total, pct, mutations_per_sec, runtime].join("\t")
|
27
|
+
[link, kills, alive, total, pct, mutations_per_sec, runtime, failure, j1].join("\t")
|
26
28
|
rescue
|
27
29
|
''
|
28
30
|
end
|
@@ -48,7 +50,7 @@ module MutatorRails
|
|
48
50
|
end
|
49
51
|
|
50
52
|
def j1
|
51
|
-
content.match(/Jobs:.+?(\d+)$/)[1].to_i
|
53
|
+
content.match(/Jobs:.+?(\d+)$/)[1].to_i rescue 2
|
52
54
|
end
|
53
55
|
|
54
56
|
def link
|
@@ -13,8 +13,7 @@ module MutatorRails
|
|
13
13
|
parms << '1> ' + log.to_s
|
14
14
|
log_dir
|
15
15
|
|
16
|
-
cmd
|
17
|
-
rerun(cmd)
|
16
|
+
rerun(cmd(parms)) || first_run(parms)
|
18
17
|
end
|
19
18
|
|
20
19
|
def log
|
@@ -23,7 +22,7 @@ module MutatorRails
|
|
23
22
|
guide.update(full_log, code_md5, spec_md5)
|
24
23
|
File.rename(old_log, full_log)
|
25
24
|
end
|
26
|
-
|
25
|
+
|
27
26
|
full_log
|
28
27
|
end
|
29
28
|
|
@@ -74,8 +73,15 @@ module MutatorRails
|
|
74
73
|
`#{cmd2}` unless ENV['RACK_ENV'].eql?('test')
|
75
74
|
end
|
76
75
|
|
76
|
+
def need_j1?
|
77
|
+
return false unless File.exist?(log)
|
78
|
+
|
79
|
+
content = File.read(log)
|
80
|
+
/Failures:/ === content
|
81
|
+
end
|
82
|
+
|
77
83
|
def first_run(parms)
|
78
|
-
cmd =
|
84
|
+
cmd = cmd(parms)
|
79
85
|
|
80
86
|
if changed? || !complete?(log) || failed?(log)
|
81
87
|
puts "[#{Time.current.iso8601}] #{cmd}"
|
@@ -86,6 +92,10 @@ module MutatorRails
|
|
86
92
|
cmd
|
87
93
|
end
|
88
94
|
|
95
|
+
def cmd(parms)
|
96
|
+
spec_opt + COMMAND + parms.join(' ')
|
97
|
+
end
|
98
|
+
|
89
99
|
def spec_opt
|
90
100
|
"SPEC_OPTS=\"--pattern #{spec_file}\" "
|
91
101
|
end
|
@@ -101,7 +111,8 @@ module MutatorRails
|
|
101
111
|
|
102
112
|
def failed?(log)
|
103
113
|
content = File.read(log)
|
104
|
-
/Failures:/ === content
|
114
|
+
/Failures:/ === content ||
|
115
|
+
/ActiveRecord::PendingMigrationError/ === content
|
105
116
|
end
|
106
117
|
|
107
118
|
def log_correct?
|
@@ -122,7 +133,7 @@ module MutatorRails
|
|
122
133
|
end
|
123
134
|
|
124
135
|
private
|
125
|
-
|
136
|
+
|
126
137
|
def changed?
|
127
138
|
!log_correct?
|
128
139
|
end
|
@@ -32,6 +32,7 @@ module MutatorRails
|
|
32
32
|
|
33
33
|
def failures
|
34
34
|
header = false
|
35
|
+
l = []
|
35
36
|
content.each do |detail|
|
36
37
|
failure = detail[7]
|
37
38
|
if failure
|
@@ -39,9 +40,10 @@ module MutatorRails
|
|
39
40
|
failure_header
|
40
41
|
header = true
|
41
42
|
end
|
42
|
-
|
43
|
+
l << " . " + detail[0]
|
43
44
|
end
|
44
45
|
end
|
46
|
+
@stats += l.sort if l.any?
|
45
47
|
end
|
46
48
|
|
47
49
|
def failure_header
|
@@ -51,16 +53,18 @@ module MutatorRails
|
|
51
53
|
|
52
54
|
def fallback_to_j1
|
53
55
|
header = false
|
56
|
+
l = []
|
54
57
|
content.each do |detail|
|
55
58
|
failure = detail[8]
|
56
|
-
if failure
|
59
|
+
if failure.eql?(1)
|
57
60
|
unless header
|
58
61
|
j1_header
|
59
62
|
header = true
|
60
63
|
end
|
61
|
-
|
64
|
+
l << " . " + detail[0]
|
62
65
|
end
|
63
66
|
end
|
67
|
+
@stats += l.sort if l.any?
|
64
68
|
end
|
65
69
|
|
66
70
|
def j1_header
|
@@ -8,5 +8,20 @@ if Rails.env.development? || Rails.env.test?
|
|
8
8
|
task :files do
|
9
9
|
MutatorRails::FullMutate.call
|
10
10
|
end
|
11
|
+
|
12
|
+
desc 'Run mutation tests on the unprocessed file set'
|
13
|
+
task :unprocessed_files do
|
14
|
+
MutatorRails::FullMutate.new.unprocessed
|
15
|
+
end
|
16
|
+
|
17
|
+
desc 'Run mutation tests on the j1 file set'
|
18
|
+
task :j1_files do
|
19
|
+
MutatorRails::FullMutate.new.j1
|
20
|
+
end
|
21
|
+
|
22
|
+
desc 'Run mutation tests on the changed file set'
|
23
|
+
task :changed_files do
|
24
|
+
MutatorRails::FullMutate.new.changed
|
25
|
+
end
|
11
26
|
end
|
12
27
|
end
|
@@ -10,7 +10,7 @@ if Rails.env.development? || Rails.env.test?
|
|
10
10
|
|
11
11
|
namespace :mutator do
|
12
12
|
desc 'Run whole mutation process'
|
13
|
-
task all: %i[files cleanup analyze statistics] do
|
13
|
+
task all: %i[unprocessed_files changed_files j1_files files cleanup analyze statistics] do
|
14
14
|
puts 'all processed!'
|
15
15
|
end
|
16
16
|
end
|
data/log/mutant/analysis.tsv
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
log kills alive total pct killed mutations per sec runtime
|
2
|
-
=HYPERLINK("models/test.log","Export::ActivityExporter") 73 26 99 73.737 1.559 63.52
|
3
|
-
=HYPERLINK("models/test2.log","Export::ActivityExporter2") 73 26 99 73.737 1.559 63.52
|
1
|
+
log kills alive total pct killed mutations per sec runtime failure j1
|
2
|
+
=HYPERLINK("models/test.log","Export::ActivityExporter") 73 26 99 73.737 1.559 63.52 true 6
|
3
|
+
=HYPERLINK("models/test2.log","Export::ActivityExporter2") 73 26 99 73.737 1.559 63.52 false 1
|
data/log/mutant/models/test.log
CHANGED
@@ -73,6 +73,8 @@ Requires: ["./config/environment.rb"]
|
|
73
73
|
(71/99) 73% - killtime: 346.07s runtime: 62.51s overhead: -283.56s
|
74
74
|
(73/99) 73% - killtime: 354.33s runtime: 63.52s overhead: -290.81s
|
75
75
|
|
76
|
+
Failures:
|
77
|
+
|
76
78
|
-----------------------
|
77
79
|
Mutant configuration:
|
78
80
|
Matcher: #<Mutant::Matcher::Config match_expressions: [Export::ActivityExporter]>
|
data/log/mutant/models/test2.log
CHANGED
@@ -5,7 +5,7 @@ Module#name from: XPath returned name(.). Fix your lib to follow normal ruby sem
|
|
5
5
|
Mutant configuration:
|
6
6
|
Matcher: #<Mutant::Matcher::Config match_expressions: [Export::ActivityExporter2]>
|
7
7
|
Integration: Mutant::Integration::Rspec
|
8
|
-
Jobs:
|
8
|
+
Jobs: 1
|
9
9
|
Includes: []
|
10
10
|
Requires: ["./config/environment.rb"]
|
11
11
|
(00/99) 100% - killtime: 0.00s runtime: 0.00s overhead: 0.00s
|
@@ -77,7 +77,7 @@ Requires: ["./config/environment.rb"]
|
|
77
77
|
Mutant configuration:
|
78
78
|
Matcher: #<Mutant::Matcher::Config match_expressions: [Export::ActivityExporter2]>
|
79
79
|
Integration: Mutant::Integration::Rspec
|
80
|
-
Jobs:
|
80
|
+
Jobs: 1
|
81
81
|
Includes: []
|
82
82
|
Requires: ["./config/environment.rb"]
|
83
83
|
Subjects: 3
|
data/log/mutant/statistics.txt
CHANGED
@@ -6,6 +6,12 @@ and 146 killed (73.7%)
|
|
6
6
|
|
7
7
|
0 module(s) were fully mutated (0.0%)
|
8
8
|
|
9
|
+
The following modules remain with failures (check log):
|
10
|
+
. Export::ActivityExporter
|
11
|
+
|
12
|
+
The following modules fell back to non-parallel(-j1):
|
13
|
+
. Export::ActivityExporter2
|
14
|
+
|
9
15
|
The following modules had most alive mutations (top 10):
|
10
16
|
. Export::ActivityExporter (26)
|
11
17
|
. Export::ActivityExporter2 (26)
|
data/mutator_rails.gemspec
CHANGED
@@ -6,10 +6,10 @@ Gem::Specification.new do |gem|
|
|
6
6
|
gem.name = 'mutator_rails'
|
7
7
|
gem.version = MutatorRails::VERSION.dup
|
8
8
|
gem.authors = %w[Tim\ Chambers Jason\ Dinsmore]
|
9
|
-
gem.email = ['tim@
|
9
|
+
gem.email = ['tim@hint.io', 'jason@hint.io']
|
10
10
|
gem.summary = 'Integrate automated mutation testing into Rails.'
|
11
11
|
gem.description = 'Automate mutation testing to find weaknesses in code'
|
12
|
-
gem.homepage = 'https://github.com/
|
12
|
+
gem.homepage = 'https://github.com/hintmedia/mutator_rails'
|
13
13
|
gem.license = 'MIT'
|
14
14
|
|
15
15
|
gem.require_paths = ['lib']
|
@@ -19,8 +19,9 @@ Gem::Specification.new do |gem|
|
|
19
19
|
gem.files = `git ls-files`.split("\n")
|
20
20
|
gem.test_files = `git ls-files -- {spec}/*`.split("\n")
|
21
21
|
|
22
|
+
gem.add_development_dependency 'actionview', '>= 5.1.6.2'
|
22
23
|
gem.add_development_dependency 'bundler', '~> 1.15'
|
23
|
-
gem.add_development_dependency 'rake', '~>
|
24
|
+
gem.add_development_dependency 'rake', '~> 13.0'
|
24
25
|
gem.add_development_dependency 'rails', '>= 4.0'
|
25
26
|
gem.add_development_dependency 'rspec-core', '~> 3.6.0'
|
26
27
|
gem.add_development_dependency 'rspec-expectations', '~> 3.6.0'
|
@@ -34,4 +35,6 @@ Gem::Specification.new do |gem|
|
|
34
35
|
gem.add_development_dependency 'procto', '~> 0.0.3'
|
35
36
|
gem.add_development_dependency 'adamantium', '~> 0.2.0'
|
36
37
|
gem.add_development_dependency 'reek', '~> 4.7.2'
|
38
|
+
gem.add_development_dependency 'nokogiri', '>= 1.10.4'
|
39
|
+
gem.add_development_dependency 'loofah', '>= 2.3.1'
|
37
40
|
end
|
@@ -6,8 +6,26 @@ RSpec.describe MutatorRails::FullMutate do
|
|
6
6
|
let(:object) { described_class.call }
|
7
7
|
|
8
8
|
describe '#call' do
|
9
|
-
it 'processes
|
9
|
+
it 'processes all code' do
|
10
10
|
object
|
11
11
|
end
|
12
12
|
end
|
13
|
+
|
14
|
+
describe '#unprocessed' do
|
15
|
+
it 'processes the unprocessed code' do
|
16
|
+
described_class.new.unprocessed
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
describe '#j1' do
|
21
|
+
it 'processes the j1 code' do
|
22
|
+
described_class.new.j1
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
describe '#changed' do
|
27
|
+
it 'processes the changed code' do
|
28
|
+
described_class.new.changed
|
29
|
+
end
|
30
|
+
end
|
13
31
|
end
|
@@ -19,6 +19,12 @@ and 146 killed (73.7%)
|
|
19
19
|
|
20
20
|
0 module(s) were fully mutated (0.0%)
|
21
21
|
|
22
|
+
The following modules remain with failures (check log):
|
23
|
+
. Export::ActivityExporter
|
24
|
+
|
25
|
+
The following modules fell back to non-parallel(-j1):
|
26
|
+
. Export::ActivityExporter2
|
27
|
+
|
22
28
|
The following modules had most alive mutations (top 10):
|
23
29
|
. Export::ActivityExporter (26)
|
24
30
|
. Export::ActivityExporter2 (26)
|
metadata
CHANGED
@@ -1,16 +1,30 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mutator_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.17
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tim Chambers
|
8
8
|
- Jason Dinsmore
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2020-07-31 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: actionview
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - ">="
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: 5.1.6.2
|
21
|
+
type: :development
|
22
|
+
prerelease: false
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - ">="
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: 5.1.6.2
|
14
28
|
- !ruby/object:Gem::Dependency
|
15
29
|
name: bundler
|
16
30
|
requirement: !ruby/object:Gem::Requirement
|
@@ -31,14 +45,14 @@ dependencies:
|
|
31
45
|
requirements:
|
32
46
|
- - "~>"
|
33
47
|
- !ruby/object:Gem::Version
|
34
|
-
version: '
|
48
|
+
version: '13.0'
|
35
49
|
type: :development
|
36
50
|
prerelease: false
|
37
51
|
version_requirements: !ruby/object:Gem::Requirement
|
38
52
|
requirements:
|
39
53
|
- - "~>"
|
40
54
|
- !ruby/object:Gem::Version
|
41
|
-
version: '
|
55
|
+
version: '13.0'
|
42
56
|
- !ruby/object:Gem::Dependency
|
43
57
|
name: rails
|
44
58
|
requirement: !ruby/object:Gem::Requirement
|
@@ -221,10 +235,38 @@ dependencies:
|
|
221
235
|
- - "~>"
|
222
236
|
- !ruby/object:Gem::Version
|
223
237
|
version: 4.7.2
|
238
|
+
- !ruby/object:Gem::Dependency
|
239
|
+
name: nokogiri
|
240
|
+
requirement: !ruby/object:Gem::Requirement
|
241
|
+
requirements:
|
242
|
+
- - ">="
|
243
|
+
- !ruby/object:Gem::Version
|
244
|
+
version: 1.10.4
|
245
|
+
type: :development
|
246
|
+
prerelease: false
|
247
|
+
version_requirements: !ruby/object:Gem::Requirement
|
248
|
+
requirements:
|
249
|
+
- - ">="
|
250
|
+
- !ruby/object:Gem::Version
|
251
|
+
version: 1.10.4
|
252
|
+
- !ruby/object:Gem::Dependency
|
253
|
+
name: loofah
|
254
|
+
requirement: !ruby/object:Gem::Requirement
|
255
|
+
requirements:
|
256
|
+
- - ">="
|
257
|
+
- !ruby/object:Gem::Version
|
258
|
+
version: 2.3.1
|
259
|
+
type: :development
|
260
|
+
prerelease: false
|
261
|
+
version_requirements: !ruby/object:Gem::Requirement
|
262
|
+
requirements:
|
263
|
+
- - ">="
|
264
|
+
- !ruby/object:Gem::Version
|
265
|
+
version: 2.3.1
|
224
266
|
description: Automate mutation testing to find weaknesses in code
|
225
267
|
email:
|
226
|
-
- tim@
|
227
|
-
- jason@
|
268
|
+
- tim@hint.io
|
269
|
+
- jason@hint.io
|
228
270
|
executables: []
|
229
271
|
extensions: []
|
230
272
|
extra_rdoc_files: []
|
@@ -280,11 +322,11 @@ files:
|
|
280
322
|
- spec/mutator_rails/statistics_spec.rb
|
281
323
|
- spec/mutator_rails_spec.rb
|
282
324
|
- spec/spec_helper.rb
|
283
|
-
homepage: https://github.com/
|
325
|
+
homepage: https://github.com/hintmedia/mutator_rails
|
284
326
|
licenses:
|
285
327
|
- MIT
|
286
328
|
metadata: {}
|
287
|
-
post_install_message:
|
329
|
+
post_install_message:
|
288
330
|
rdoc_options: []
|
289
331
|
require_paths:
|
290
332
|
- lib
|
@@ -299,9 +341,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
299
341
|
- !ruby/object:Gem::Version
|
300
342
|
version: 1.3.6
|
301
343
|
requirements: []
|
302
|
-
rubyforge_project:
|
344
|
+
rubyforge_project:
|
303
345
|
rubygems_version: 2.5.2
|
304
|
-
signing_key:
|
346
|
+
signing_key:
|
305
347
|
specification_version: 4
|
306
348
|
summary: Integrate automated mutation testing into Rails.
|
307
349
|
test_files: []
|