Class: ElasticResults::Result
- Inherits:
-
Object
- Object
- ElasticResults::Result
- Defined in:
- lib/elastic_results/result.rb
Overview
A common data format for test results. The Cucumber and Rspec formatters populate this class.
Instance Attribute Summary collapse
-
#build_number ⇒ Object
Returns the value of attribute build_number.
-
#exception_class ⇒ Object
Returns the value of attribute exception_class.
-
#exception_msg ⇒ Object
Returns the value of attribute exception_msg.
-
#exception_stacktrace ⇒ Object
Returns the value of attribute exception_stacktrace.
-
#feature_name ⇒ Object
Returns the value of attribute feature_name.
-
#id ⇒ Object
Returns the value of attribute id.
-
#outcome ⇒ Object
Returns the value of attribute outcome.
-
#runtime ⇒ Object
Returns the value of attribute runtime.
-
#scenario_name ⇒ Object
Returns the value of attribute scenario_name.
-
#uri ⇒ Object
Returns the value of attribute uri.
Instance Method Summary collapse
Instance Attribute Details
#build_number ⇒ Object
Returns the value of attribute build_number.
8 9 10 |
# File 'lib/elastic_results/result.rb', line 8 def build_number @build_number end |
#exception_class ⇒ Object
Returns the value of attribute exception_class.
7 8 9 |
# File 'lib/elastic_results/result.rb', line 7 def exception_class @exception_class end |
#exception_msg ⇒ Object
Returns the value of attribute exception_msg.
7 8 9 |
# File 'lib/elastic_results/result.rb', line 7 def exception_msg @exception_msg end |
#exception_stacktrace ⇒ Object
Returns the value of attribute exception_stacktrace.
7 8 9 |
# File 'lib/elastic_results/result.rb', line 7 def exception_stacktrace @exception_stacktrace end |
#feature_name ⇒ Object
Returns the value of attribute feature_name.
8 9 10 |
# File 'lib/elastic_results/result.rb', line 8 def feature_name @feature_name end |
#id ⇒ Object
Returns the value of attribute id.
8 9 10 |
# File 'lib/elastic_results/result.rb', line 8 def id @id end |
#outcome ⇒ Object
Returns the value of attribute outcome.
7 8 9 |
# File 'lib/elastic_results/result.rb', line 7 def outcome @outcome end |
#runtime ⇒ Object
Returns the value of attribute runtime.
7 8 9 |
# File 'lib/elastic_results/result.rb', line 7 def runtime @runtime end |
#scenario_name ⇒ Object
Returns the value of attribute scenario_name.
8 9 10 |
# File 'lib/elastic_results/result.rb', line 8 def scenario_name @scenario_name end |
#uri ⇒ Object
Returns the value of attribute uri.
8 9 10 |
# File 'lib/elastic_results/result.rb', line 8 def uri @uri end |
Instance Method Details
#base_info ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/elastic_results/result.rb', line 32 def base_info { '@timestamp' => Time.now.iso8601(3), build_number: ENV['BUILD_NUMBER'] ? ENV['BUILD_NUMBER'] : ElasticResults.build_id, build_url: ENV['BUILD_URL'], node_name: ENV['NODE_NAME'] ? ENV['NODE_NAME'] : Socket.gethostname, job_name: ENV['JOB_NAME'], build_tag: ENV['BUILD_TAG'], environment: ENV['TEST_ENV'] || ENV['RAILS_ENV'], git_commit: ElasticResults.git_commit, git_url: ElasticResults.git_url, git_branch: ElasticResults.git_branch, suite_name: ElasticResults.suite_name, suite_type: ElasticResults.suite_type, team: ElasticResults.team_name } end |
#fail_type ⇒ Object
28 29 30 |
# File 'lib/elastic_results/result.rb', line 28 def fail_type exception_class =~ /ExpectationNotMet/ ? :fail : :broke end |
#tags ⇒ Object
20 21 22 |
# File 'lib/elastic_results/result.rb', line 20 def @tags ||= [] end |
#to_hash ⇒ Object
10 11 12 13 14 15 16 17 18 |
# File 'lib/elastic_results/result.rb', line 10 def to_hash result_hash = base_info [:outcome, :exception_class, :exception_msg, :exception_stacktrace, :runtime, :id, :uri, :feature_name, :scenario_name, :tags].each do |field| result_hash[field] = send field end result_hash end |