Module: Minitest
- Defined in:
- lib/minitap/minitest5_rent.rb,
lib/minitest/autobot_settings_plugin.rb
Defined Under Namespace
Classes: Minitap
Class Method Summary collapse
-
.plugin_autobot_settings_init(options) ⇒ Object
Minitest plugin: autobot_settings.
-
.plugin_autobot_settings_options(parser, options) ⇒ Object
Minitest plugin: autobot_settings.
Class Method Details
.plugin_autobot_settings_init(options) ⇒ Object
Minitest plugin: autobot_settings
This is where the options are propagated to MiniAutobot.settings
.
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/minitest/autobot_settings_plugin.rb', line 6 def self.plugin_autobot_settings_init() MiniAutobot.settings = MiniAutobot.logger = MiniAutobot::Logger.new('mini_autobot.log', 'daily').tap do |logger| logger.formatter = proc do |sev, ts, prog, msg| msg = msg.inspect unless String === msg "#{ts.strftime('%Y-%m-%dT%H:%M:%S.%6N')} #{sev}: #{String === msg ? msg : msg.inspect}\n" end logger.level = case MiniAutobot.settings.verbosity_level when 0 Logger::WARN when 1 Logger::INFO else Logger::DEBUG end logger.info("Booting up with arguments: #{[:args].inspect}") at_exit { logger.info("Shutting down") } end MiniAutobot::Console.bootstrap! if [:console] self end |
.plugin_autobot_settings_options(parser, options) ⇒ Object
Minitest plugin: autobot_settings
This plugin for minitest injects mini_autobot-specific command-line arguments, and passes it along to mini_autobot.
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 |
# File 'lib/minitest/autobot_settings_plugin.rb', line 35 def self.(parser, ) [:auto_finalize] = true parser.on('-Q', '--no-auto-quit-driver', "Don't automatically quit the driver after a test case") do |value| [:auto_finalize] = value end [:connector] = ENV['AUTOBOT_CONNECTOR'] if ENV.has_key?('AUTOBOT_CONNECTOR') parser.on('-c', '--connector TYPE', 'Run using a specific connector profile') do |value| [:connector] = value end [:env] = ENV['AUTOBOT_ENV'] if ENV.has_key?('AUTOBOT_ENV') parser.on('-e', '--env ENV', 'Run against a specific environment, host_env') do |value| [:env] = value end [:console] = false parser.on('-i', '--console', 'Run an interactive session within the context of an empty test') do |value| [:console] = true end [:reuse_driver] = false parser.on('-r', '--reuse-driver', "Reuse driver between tests") do |value| [:reuse_driver] = value end parser.on('-t', '--tag TAGLIST', 'Run only tests matching a specific tag, tags, or tagsets') do |value| [:tags] ||= [ ] [:tags] << value.to_s.split(',').map { |t| t.to_sym } end [:verbosity_level] = 0 parser.on('-v', '--verbose', 'Output verbose logs to the log file') do |value| [:verbosity_level] += 1 end [:parallel] = 0 parser.on('-P', '--parallel PARALLEL', 'Run any number of tests in parallel') do |value| [:parallel] = value end [:rerun_failure] = false parser.on('-R', '--rerun-failure [RERUN]', 'Rerun failing test; If enabled, can set number of times to rerun') do |value| integer_value = value.nil? ? 1 : value.to_i [:rerun_failure] = integer_value end [:google_sheets] = false parser.on('-g', '--google-sheets SHEET', 'Report results to specified Google Sheets spreadsheet') do |value| [:google_sheets] = value end [:feature_flips] = '' parser.on('-f', '--feature-flips FEATURE', 'Flip tests to run against a different feature set') do |value| [:feature_flips] = value end end |