testmetrics_rspec 0.2.0 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +56 -2
- data/lib/testmetrics_rspec/persist.rb +5 -1
- data/lib/testmetrics_rspec/rspec2.rb +1 -1
- data/lib/testmetrics_rspec/rspec3.rb +1 -1
- data/lib/testmetrics_rspec.rb +1 -0
- data/testmetrics_rspec.gemspec +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a03b098d96ca6099897c735c5b4b9eec71089ff6f7d6f261a7aff728b838557d
|
4
|
+
data.tar.gz: 1aa00b791ed33c8106228da7ffc72937a25d3c88825dc3289eb8f75c7accf50c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 352b85462001c1826f476950dfc5be7ccee14b61d83856f766ef660c1e276853d87ab94115702609c013a7072c2cb68719f7d6c05f6e89be486d395745058e27
|
7
|
+
data.tar.gz: 148e2c62497a7d03cfb61a8df67b6a05fc92f6e66d2be31fda0ef843e44463e5f1dc88a8c6e5b38fe7a3deeda67515be04968e290598ca6457576e5be040fcef
|
data/README.md
CHANGED
@@ -1,2 +1,56 @@
|
|
1
|
-
# testmetrics_rspec
|
2
|
-
|
1
|
+
# Testmetrics RSpec [](https://travis-ci.org/Testmetrics/testmetrics_rspec) [](https://rubygems.org/gems/testmetrics_rspec)
|
2
|
+
|
3
|
+
The official [RSpec][rspec] 2 & 3 client for [Testmetrics](https://www.testmetrics.app). This client collects data about your RSpec test suites after being run in CI and sends that data to Testmetrics so you can gain valuable insights about your test suite.
|
4
|
+
|
5
|
+
## Usage
|
6
|
+
|
7
|
+
Install the gem:
|
8
|
+
|
9
|
+
```sh
|
10
|
+
gem install testmetrics_rspec
|
11
|
+
```
|
12
|
+
|
13
|
+
Use it:
|
14
|
+
|
15
|
+
```sh
|
16
|
+
rspec --format TestmetricsRspec
|
17
|
+
```
|
18
|
+
|
19
|
+
You can use it in combination with other [formatters][rspec-formatters], too:
|
20
|
+
|
21
|
+
```sh
|
22
|
+
rspec --format progress --format TestmetricsRspec
|
23
|
+
```
|
24
|
+
|
25
|
+
[rspec-formatters]: https://relishapp.com/rspec/rspec-core/v/3-6/docs/formatters
|
26
|
+
|
27
|
+
In order for the metrics to be send to Testmetrics, you must have your
|
28
|
+
Testmetrics Project Key set in the "TESTMETRICS_PROJECT_KEY" environment
|
29
|
+
variable in your CI environment. If this environment variable isn't set, the
|
30
|
+
collected metrics for your CI run will be discarded. This key should be kept
|
31
|
+
private and not exposed to the public.
|
32
|
+
|
33
|
+
### Using in your project with Bundler
|
34
|
+
|
35
|
+
Add it to your Gemfile if you're using [Bundler][bundler]. Put it in the same groups as rspec.
|
36
|
+
|
37
|
+
```ruby
|
38
|
+
group :test do
|
39
|
+
gem "rspec"
|
40
|
+
gem "testmetrics_rspec"
|
41
|
+
end
|
42
|
+
```
|
43
|
+
|
44
|
+
Put the same arguments as the commands above in [your `.rspec`][rspec-file]:
|
45
|
+
|
46
|
+
```sh
|
47
|
+
--format TestmetricsRspec
|
48
|
+
```
|
49
|
+
|
50
|
+
[bundler]: https://bundler.io
|
51
|
+
[rspec-file]: https://relishapp.com/rspec/rspec-core/v/3-6/docs/configuration/read-command-line-configuration-options-from-files
|
52
|
+
|
53
|
+
## License
|
54
|
+
|
55
|
+
`TestmetricsRspec` is offered under the MIT license. For the full license
|
56
|
+
text see [LICENSE](https://github.com/testmetrics/testmetrics_rspec/blob/master/LICENSE).
|
@@ -3,7 +3,11 @@ class TestmetricsRspec
|
|
3
3
|
module Persist
|
4
4
|
def self.call(results)
|
5
5
|
unless results[:key] == "Unknown"
|
6
|
-
Faraday.post
|
6
|
+
Faraday.post do |req|
|
7
|
+
req.url 'https://www.testmetrics.app/results'
|
8
|
+
req.headers['Content-Type'] = 'application/json'
|
9
|
+
req.body = results.to_json
|
10
|
+
end
|
7
11
|
end
|
8
12
|
puts results
|
9
13
|
end
|
@@ -40,7 +40,7 @@ class TestmetricsRspec < RSpec::Core::Formatters::BaseFormatter
|
|
40
40
|
def tests
|
41
41
|
examples.map do |example|
|
42
42
|
{
|
43
|
-
name: example.full_description,
|
43
|
+
name: example.full_description.delete("\0").delete("\x01").delete("\e"),
|
44
44
|
# Send results in microseconds
|
45
45
|
total_run_time: (example.execution_result[:run_time] * 1_000_000).round(0),
|
46
46
|
state: example.execution_result[:status].to_sym
|
@@ -20,7 +20,7 @@ class TestmetricsRspec < RSpec::Core::Formatters::BaseFormatter
|
|
20
20
|
def stop(notification)
|
21
21
|
tests = notification.notifications.map do |test|
|
22
22
|
{
|
23
|
-
name: test.example.full_description,
|
23
|
+
name: test.example.full_description.delete("\0").delete("\x01").delete("\e"),
|
24
24
|
# Send results in microseconds
|
25
25
|
total_run_time: (test.example.execution_result.run_time * 1_000_000).round(0),
|
26
26
|
state: test.example.execution_result.status
|
data/lib/testmetrics_rspec.rb
CHANGED
data/testmetrics_rspec.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: testmetrics_rspec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Devon Estes
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-01-
|
11
|
+
date: 2019-01-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|