forked from mbj/mutant
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
65 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,6 +25,7 @@ Topics | |
* [Known Problems](/docs/known-problems.md) | ||
* [Limitations](/docs/limitations.md) | ||
* [Concurrency](/docs/concurrency.md) | ||
* [Rspec Integration](/docs/mutant-rspec.md) | ||
|
||
Sponsoring | ||
---------- | ||
|
@@ -42,41 +43,6 @@ Additionally, the following features where sponsored by organizations: | |
If your organization is interested in sponsoring a feature, general maintainership or bugfixes, contact | ||
[Markus Schirp](mailto:[email protected]). | ||
|
||
Examples | ||
-------- | ||
|
||
``` | ||
cd virtus | ||
# Run mutant on virtus namespace | ||
bundle exec mutant --include lib --require virtus --use rspec Virtus* | ||
# Run mutant on specific virtus class | ||
bundle exec mutant --include lib --require virtus --use rspec Virtus::Attribute | ||
# Run mutant on specific virtus class method | ||
bundle exec mutant --include lib --require virtus --use rspec Virtus::Attribute.build | ||
# Run mutant on specific virtus instance method | ||
bundle exec mutant --include lib --require virtus --use rspec Virtus::Attribute#type | ||
``` | ||
|
||
Rails | ||
------- | ||
|
||
To mutation test Rails models with rspec, comment out ```require 'rspec/autorun'``` from your spec_helper.rb file. Having done so you should be able to use commands like the following: | ||
|
||
```sh | ||
RAILS_ENV=test bundle exec mutant -r ./config/environment --use rspec User | ||
``` | ||
|
||
Passing in RSpec Options | ||
------------------------ | ||
|
||
**NOTE: Experimental** | ||
|
||
You can control some aspects of RSpec using the `SPEC_OPTS` environment variable as usual. If you want mutant to only pay attention to specs in a certain directory, you can run | ||
|
||
```sh | ||
SPEC_OPTS="--pattern spec/subdir_only/**/*_spec.rb" bundle exec mutant --use rspec SomeClass | ||
``` | ||
|
||
Mutation-Operators | ||
------------------ | ||
|
||
|
@@ -85,19 +51,6 @@ The `mutant-meta` is arranged to the AST-Node-Types of parser. Refer to parsers | |
|
||
There is no easy and universal way to count the number of mutation operators a tool supports. | ||
|
||
Test-Selection | ||
-------------- | ||
|
||
Mutation testing is slow. The key to making it fast is selecting the correct set of tests to run. | ||
Mutant currently supports the following built-in strategy for selecting tests/specs: | ||
|
||
Mutant uses the "longest rspec example group descriptions prefix match" to select the tests to run. | ||
|
||
Example for a subject like `Foo::Bar#baz` it will run all example groups with description prefixes in | ||
`Foo::Bar#baz`, `Foo::Bar` and `Foo`. The order is important, so if mutant finds example groups in the | ||
current prefix level, these example groups *must* kill the mutation. | ||
|
||
|
||
Neutral (noop) Tests | ||
-------------------- | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
mutant-rspec | ||
============ | ||
|
||
The integration into rspec. | ||
|
||
Install `mutant-rspec` and use the `--use rspec` switch in your mutant command line. | ||
|
||
```sh | ||
bundle exec mutant --include lib --require 'your_code' --use rspec -- 'YourCode*' | ||
``` | ||
|
||
Examples | ||
-------- | ||
|
||
``` | ||
cd virtus | ||
# Run mutant on virtus namespace | ||
bundle exec mutant --include lib --require virtus --use rspec Virtus* | ||
# Run mutant on specific virtus class | ||
bundle exec mutant --include lib --require virtus --use rspec Virtus::Attribute | ||
# Run mutant on specific virtus class method | ||
bundle exec mutant --include lib --require virtus --use rspec Virtus::Attribute.build | ||
# Run mutant on specific virtus instance method | ||
bundle exec mutant --include lib --require virtus --use rspec Virtus::Attribute#type | ||
``` | ||
|
||
Test-Selection | ||
-------------- | ||
|
||
Mutation testing is slow. The key to making it fast is selecting the correct | ||
set of tests to run. Mutant currently supports the following built-in | ||
strategy for selecting tests/specs: | ||
|
||
Mutant uses the "longest rspec example group descriptions prefix match" to | ||
select the tests to run. | ||
|
||
Example for a subject like `Foo::Bar#baz` it will run all example groups with | ||
description prefixes in `Foo::Bar#baz`, `Foo::Bar` and `Foo`. The order is | ||
important, so if mutant finds example groups in the current prefix level, | ||
these example groups *must* kill the mutation. | ||
|
||
Rails | ||
------- | ||
|
||
To mutation test Rails models with rspec, comment out `require 'rspec/autorun'` | ||
from your `spec_helper.rb` file. Having done so you should be able to use | ||
commands like the following: | ||
|
||
```sh | ||
RAILS_ENV=test bundle exec mutant -r ./config/environment --use rspec User | ||
``` | ||
|
||
Passing in RSpec Options | ||
------------------------ | ||
|
||
**NOTE: Experimental** | ||
|
||
You can control some aspects of RSpec using the `SPEC_OPTS` environment variable as usual. If you want mutant to only pay attention to specs in a certain directory, you can run | ||
|
||
```sh | ||
SPEC_OPTS="--pattern spec/subdir_only/**/*_spec.rb" bundle exec mutant --use rspec SomeClass | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters