allure-ruby-commons 2.13.8.1 → 2.13.8.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +17 -0
- data/lib/allure_ruby_commons/step_annotation.rb +39 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e7dae51d906f8c03cbac0b9f14ffabccf8a1ce9fdb0c70b9e27fb3793f34acb7
|
4
|
+
data.tar.gz: 104d5f939e1fdad7417206d2bdb96e7c3b301a74cc7b63073c9d39ddcd7525db
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dc66fddcc805f1a645bd46ec35c518bac76bc6bdbc4ce0612f3edd0acea2173b7d58771bd03ba1bc478cd9af7172c33a1ff3c9c6efe9b99a599297b9031d3f72
|
7
|
+
data.tar.gz: '00830082315dd4ed519da75c1fe12ef565ed1d79080b8e21be17fa8945dce733c26982131cac8463e6e34f898a1918dc27abc47d0b0878321c4c4325e4e615b9'
|
data/README.md
CHANGED
@@ -54,6 +54,23 @@ Allure.add_attachment(name: "attachment", source: "/path/to/test.txt", type: All
|
|
54
54
|
Allure.add_link(name: "Custom Url", url: "http://www.github.com")
|
55
55
|
```
|
56
56
|
|
57
|
+
## Steps
|
58
|
+
|
59
|
+
It is possible to mark method definitions to be automatically added to report as steps. The class just needs to extend `AllureStepAnnotation`
|
60
|
+
and `step` method needs to be used before the method definition.
|
61
|
+
|
62
|
+
```ruby
|
63
|
+
class TestHelper
|
64
|
+
extend AllureStepAnnotation
|
65
|
+
|
66
|
+
step("Singleton step")
|
67
|
+
def self.class_method; end
|
68
|
+
|
69
|
+
step("Standard step")
|
70
|
+
def standard_method; end
|
71
|
+
end
|
72
|
+
```
|
73
|
+
|
57
74
|
## Testing
|
58
75
|
|
59
76
|
Install dependencies:
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Adds support for annotating methods as allure steps
|
4
|
+
#
|
5
|
+
module AllureStepAnnotation
|
6
|
+
# Mark method definition as allure step
|
7
|
+
#
|
8
|
+
# @param [String] step_name
|
9
|
+
# @return [void]
|
10
|
+
def step(step_name = "")
|
11
|
+
@allure_step = step_name
|
12
|
+
end
|
13
|
+
|
14
|
+
private
|
15
|
+
|
16
|
+
def singleton_method_added(method_name)
|
17
|
+
return super unless @allure_step
|
18
|
+
|
19
|
+
original_method = singleton_method(method_name)
|
20
|
+
step_name = @allure_step.empty? ? method_name.to_s : @allure_step
|
21
|
+
@allure_step = nil
|
22
|
+
|
23
|
+
define_singleton_method(method_name) do |*args, &block|
|
24
|
+
Allure.run_step(step_name) { original_method.call(*args, &block) }
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def method_added(method_name)
|
29
|
+
return super unless @allure_step
|
30
|
+
|
31
|
+
original_method = instance_method(method_name)
|
32
|
+
step_name = @allure_step.empty? ? method_name.to_s : @allure_step
|
33
|
+
@allure_step = nil
|
34
|
+
|
35
|
+
define_method(method_name) do |*args, &block|
|
36
|
+
Allure.run_step(step_name) { original_method.bind(self).call(*args, &block) }
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: allure-ruby-commons
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.13.8.
|
4
|
+
version: 2.13.8.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrejs Cunskis
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-02-
|
11
|
+
date: 2021-02-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mime-types
|
@@ -118,6 +118,7 @@ files:
|
|
118
118
|
- lib/allure_ruby_commons/model/test_result.rb
|
119
119
|
- lib/allure_ruby_commons/model/test_result_container.rb
|
120
120
|
- lib/allure_ruby_commons/result_utils.rb
|
121
|
+
- lib/allure_ruby_commons/step_annotation.rb
|
121
122
|
homepage: https://github.com/allure-framework/allure-ruby
|
122
123
|
licenses:
|
123
124
|
- Apache-2.0
|