rspec-flaky 0.0.2 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +39 -17
- data/lib/rspec/flaky/cli.rb +1 -1
- data/lib/rspec/flaky/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 826e6c22729b3b955a7ca25dc24ea7ba8ff757065e1f3bd9e1ee0d6d16863b84
|
4
|
+
data.tar.gz: 8a762da31ba315fa31e2c23aadcc41af610a924d13340d64fb404695ad59c4b3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 977b1809217a067d53ae5bb5bc61159f7fbaf7470166066c40f33fdc4662271afc7ed511987e076661988bb1a27c960b18584f6ae5199d055f56bae64cd10781
|
7
|
+
data.tar.gz: dc8b0ef75a807202c522f1cc9e0b8373542ef13144f5ee7c50a887a74ed6cc86f062bdaffd630dd32ec4eb42902c7c2cc8fba4a321bf69f554b46b57ed8d07dc
|
data/README.md
CHANGED
@@ -1,38 +1,60 @@
|
|
1
1
|
# RSpecFlaky
|
2
2
|
|
3
|
-
|
3
|
+
The most common reason for test flakiness is randomized factories which fill a database before test execution. This small gem is designed to help you find out what exactly attribute values were assigned to an investigated model during a failed and passed execution.
|
4
|
+
|
5
|
+
![image](https://user-images.githubusercontent.com/43433100/106516737-8e72a380-64e8-11eb-9758-34e5cb9f278b.png)
|
6
|
+
|
4
7
|
|
5
8
|
## Installation
|
6
9
|
|
7
10
|
Add this line to test group of your application's Gemfile:
|
8
11
|
|
9
|
-
|
12
|
+
```bash
|
13
|
+
gem 'rspec-flaky'
|
14
|
+
```
|
10
15
|
|
11
16
|
Install the gem:
|
12
17
|
|
13
|
-
|
18
|
+
```bash
|
19
|
+
bundle
|
20
|
+
```
|
21
|
+
|
22
|
+
That's all. Select the model whose attributes will be dumped:
|
14
23
|
|
15
|
-
|
24
|
+
```ruby
|
25
|
+
it 'is flaky test', tables: [User, Post] do
|
26
|
+
expect([true, false]).to be true
|
27
|
+
end
|
28
|
+
```
|
29
|
+
## Usage
|
16
30
|
|
17
|
-
|
31
|
+
Run the command to iteratively run flaky example (option `-i` specifies the number of iterations):
|
18
32
|
|
19
|
-
|
33
|
+
```bash
|
34
|
+
rspec-flaky path/to/flaky_spec.rb:12 -i 5
|
35
|
+
```
|
20
36
|
|
21
|
-
|
22
|
-
expect([true, false]).to be true
|
23
|
-
end
|
37
|
+
If at least one example is failed gem will generate tables where you are able to investigate source of flakiness by comparing failed and success attribute values. After running your tests, open `tmp/flaky_tests/result.html` in the browser of your choice. For example, in a Mac Terminal, run the following command from your application's root directory:
|
24
38
|
|
25
|
-
## Usage
|
26
39
|
|
27
|
-
|
40
|
+
```bash
|
41
|
+
open tmp/flaky_tests/result.html
|
42
|
+
```
|
43
|
+
in a debian/ubuntu Terminal,
|
44
|
+
|
45
|
+
```bash
|
46
|
+
xdg-open tmp/flaky_tests/result.html
|
47
|
+
```
|
28
48
|
|
29
|
-
|
49
|
+
**Note:** [This guide](https://dwheeler.com/essays/open-files-urls.html) can help if you're unsure which command your particular
|
50
|
+
operating system requires.
|
30
51
|
|
31
|
-
-i - iterations number
|
32
|
-
-j - save pointed model attributes to tmp/flaky_tests/.:flaky_spec:12 as json
|
33
|
-
-d - save database dump after each example to tmp/flaky_tests/database_dumps/.:flaky_spec:12 as sql file
|
34
52
|
|
35
|
-
|
53
|
+
It's also possible to dump the whole database per each test example if there was a failed result as well as a passed result. For that just add `-d` option (currently only PostresQL is available):
|
54
|
+
|
55
|
+
```
|
56
|
+
rspec-flaky path/to/flaky_speЗc.rb:12 -i 10 -d
|
57
|
+
```
|
36
58
|
|
37
59
|
## Contributing
|
38
60
|
|
@@ -40,4 +62,4 @@ If at least one example is failed you can compare pointed model's attributes dum
|
|
40
62
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
41
63
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
42
64
|
4. Push to the branch (`git push origin my-new-feature`)
|
43
|
-
5. Create new Pull Request
|
65
|
+
5. Create new Pull Request
|
data/lib/rspec/flaky/cli.rb
CHANGED
data/lib/rspec/flaky/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspec-flaky
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- maratz
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-02-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: hashdiff
|
@@ -45,7 +45,7 @@ files:
|
|
45
45
|
- lib/rspec/flaky/pathes.rb
|
46
46
|
- lib/rspec/flaky/tables.rb
|
47
47
|
- lib/rspec/flaky/version.rb
|
48
|
-
homepage: https://github.com/
|
48
|
+
homepage: https://github.com/RND-SOFT/rspec-flaky
|
49
49
|
licenses:
|
50
50
|
- MIT
|
51
51
|
metadata: {}
|
@@ -64,7 +64,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
64
64
|
- !ruby/object:Gem::Version
|
65
65
|
version: '0'
|
66
66
|
requirements: []
|
67
|
-
rubygems_version: 3.0.
|
67
|
+
rubygems_version: 3.0.8
|
68
68
|
signing_key:
|
69
69
|
specification_version: 4
|
70
70
|
summary: Gem for catching flaky specs
|