Module: OnlyofficeTestrailWrapper::TestrailHelperRspecMetadata
- Included in:
- TestrailHelper
- Defined in:
- lib/onlyoffice_testrail_wrapper/testrail_helper/testrail_helper_rspec_metadata.rb
Overview
Module for working with rspec metadata
Instance Method Summary collapse
-
#example_time_in_seconds(example) ⇒ String
Example execution time in seconds.
-
#init_custom_fields(example) ⇒ Hash
Fill default values for custom fields.
- #parse_pending_comment(pending_message) ⇒ Object
-
#screenshot_link ⇒ String
empty string if not supported.
-
#version ⇒ String
Version of tested app.
Instance Method Details
#example_time_in_seconds(example) ⇒ String
Returns example execution time in seconds.
15 16 17 18 19 |
# File 'lib/onlyoffice_testrail_wrapper/testrail_helper/testrail_helper_rspec_metadata.rb', line 15 def example_time_in_seconds(example) execution_time = (Time.now - example.[:execution_result].started_at).to_i execution_time = 1 if execution_time.zero? # Testrail cannot receive 0 as elapsed time "#{execution_time}s" end |
#init_custom_fields(example) ⇒ Hash
Fill default values for custom fields
24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/onlyoffice_testrail_wrapper/testrail_helper/testrail_helper_rspec_metadata.rb', line 24 def init_custom_fields(example) custom_fields = {} # TODO: Fix dependencies from other project return custom_fields if defined?(AppManager).nil? custom_fields[:elapsed] = example_time_in_seconds(example) custom_fields[:version] = version custom_fields[:custom_host] = SystemHelper.hostname custom_fields[:custom_screenshot_link] = screenshot_link if example.exception custom_fields end |
#parse_pending_comment(pending_message) ⇒ Object
44 45 46 47 48 49 50 51 52 53 |
# File 'lib/onlyoffice_testrail_wrapper/testrail_helper/testrail_helper_rspec_metadata.rb', line 44 def parse_pending_comment() return [:pending, 'There is problem with initialization of @bugzilla_helper', nil] if @bugzilla_helper.nil? bug_id = @bugzilla_helper.bug_id_from_string() return [:pending, ] if bug_id.nil? bug_status = @bugzilla_helper.bug_status(bug_id) status = bug_status.include?('VERIFIED') ? :failed : :pending [status, "#{}\nBug has status: #{bug_status}, test was failed", bug_id] end |
#screenshot_link ⇒ String
empty string if not supported
38 39 40 41 42 |
# File 'lib/onlyoffice_testrail_wrapper/testrail_helper/testrail_helper_rspec_metadata.rb', line 38 def screenshot_link return AppManager.create_screenshots if AppManager.respond_to?(:create_screenshots) '' end |
#version ⇒ String
Returns version of tested app.
7 8 9 10 11 12 |
# File 'lib/onlyoffice_testrail_wrapper/testrail_helper/testrail_helper_rspec_metadata.rb', line 7 def version return @version if @version return @plan.name if @plan&.name 'Unknown' end |