Class: MediawikiSelenium::Raita::Logger
- Inherits:
-
Cucumber::Formatter::GherkinFormatterAdapter
- Object
- Cucumber::Formatter::GherkinFormatterAdapter
- MediawikiSelenium::Raita::Logger
- Defined in:
- lib/mediawiki_selenium/raita/logger.rb
Instance Method Summary collapse
-
#after_features ⇒ Object
Log everything at once to Raita's Elasticsearch DB.
-
#initialize(_runtime, raita_options, options) ⇒ Logger
constructor
A new instance of Logger.
Constructor Details
#initialize(_runtime, raita_options, options) ⇒ Logger
Returns a new instance of Logger.
7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/mediawiki_selenium/raita/logger.rb', line 7 def initialize(_runtime, , ) # Force expanded output of outlines. Note this will effect other # formatters as well, but it's the only way to get a consistent JSON # representation of feature elements with result status and duration. # # @see https://github.com/cucumber/gherkin/issues/165 [:expand] = true super(Formatter.new, false, ) @db_url = URI.parse([:url]) @build = [:build].merge(result: { status: 'passed', duration: 0 }) end |
Instance Method Details
#after_features ⇒ Object
Log everything at once to Raita's Elasticsearch DB.
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/mediawiki_selenium/raita/logger.rb', line 23 def after_features(*) @build_id = create('build', @build)['_id'] @gf.feature_hashes.each do |feature| amend_feature(feature) elements = feature.delete('elements') feature_id = create('feature', feature, @build_id)['_id'] bulk('feature-element', elements, feature_id) @build[:result][:status] = change_status( @build[:result][:status], feature['result']['status'] ) @build[:result][:duration] += feature['result']['duration'] end update('build', @build_id, @build) end |