How to use verbose method of RR Package

Best Rr_ruby code snippet using RR.verbose

sumt_runner.rb

Source:sumt_runner.rb Github

copy

Full Screen

...45 attr_reader :rr_file ; @rr_file = nil46 # passed along to MT47 # @return [Integer,nil]48 attr_reader :seed ; @seed = nil49 # Show skip detail in log summary (without verbose:)50 # @return [Boolean,nil]51 attr_reader :show_skip ; @show_skip = nil52 # Temp directory, resets `Sketchup.temp_dir`53 # @return [String,nil]54 attr_reader :temp_dir ; @temp_dir = nil55 # Base folder for test files56 # @return [String,nil]57 attr_reader :test_dir ; @test_dir = nil58 # @!endgroup59 #}60 # Misc data used in reports61 # @return [String,nil]62 attr_reader :rpt_data ; @rpt_data = nil63 # Rerun test data from `rr_file`64 # @return [String,nil]65 attr_reader :rr_data ; @rr_data = nil66 # Current run, see repeats.67 # @return [Integer]68 attr_reader :run_cntr ; @run_cntr = 069 # Array of all test file paths, relative to {.test_dir}70 # @return [Array<String>,nil]71 attr_reader :test_files; @test_files = nil72 @loaded = nil # true if SUMT requires are loaded73 @load_all = nil # loads all tests74 @rpt_data = {} # Data shared with reports75 # Main method that loads all parameters, sets test environment, runs tests76 def runner(opts)77 @not_rr = true78 ary_remove = []79 ary_tests = []80 return unless set_opts(opts)81 load_deps unless @loaded82 # if rerunning from file, load data83 @rr_file and load_rerun_info84 @rpt_data = {}85 # check & set @test_dir86 @test_dir = if @test_dir87 if Dir.exist? @test_dir88 @test_dir.freeze89 elsif Dir.exist? (t1 = File.absolute_path("../../#{@test_dir}", __dir__))90 t1.freeze91 else92 raise ArgumentError, "Test directory not found"93 end94 else95 File.absolute_path("../../tests_su", __dir__).freeze96 end.freeze97 # load ary_tests98 if @not_rr && @file_query && !@file_query.empty?99 # add /**/TC_*.rb to any elements that don't end with .rb, which should refer100 # to directories101 glob = @file_query.map { |g| g.end_with?('.rb') ? "**/#{g}" : "#{g}/**/TC_*.rb" }102 # puts "glob #{glob}"103 Dir.chdir(@test_dir) { |d| ary_tests = Dir.glob glob }104 if ary_tests.empty?105 UI.messagebox "No matching files in\n\n#{@file_query}"106 return107 end108 end109 load_tests ary_tests, ary_remove110 load_reporters111 str = " Suites: #{Minitest::Runnable.runnables.length}\n".dup112 if @file_query && !@file_query.empty?113 str << " Reloading: #{ary_remove.join(' ')}"114 end115 puts str116 run_mt117 end118 private119 # Loads parameters used in {.run} call120 def set_opts(opts)121 if opts.key? :save_opts122 require 'psych'123 opts.delete :save_opts124 begin125 File.open(CONFIG, 'w') { |f| f.write opts.to_yaml }126 return false127 rescue128 UI.messagebox "Config file (#{CONFIG}) is not writable?"129 end130 end131 @opts = opts132 # ordered by short kw133 @test_dir = parse_opt :d , :test_dir , @test_dir134 @exclude = parse_opt :e , :exclude , @exclude135 @file_query = parse_opt :f , :file_query, @file_query136 @gen_debug = parse_opt :gd, :gen_debug , @gen_debug137 @gen_logs = parse_opt :gl, :gen_logs , @gen_logs138 @gen_rerun = parse_opt :gr, :gen_rerun , @gen_rerun139 @gen_udp = parse_opt :gu, :gen_udp , @gen_udp140 @log_dir = parse_opt :ld, :log_dir , @log_dir141 @name = parse_opt :n , :name , @name142 @repeats = parse_opt :r , :repeats , @repeats143 @rr_file = parse_opt :rr, :rr_file , @rr_file144 @seed = parse_opt :s , :seed , @seed145 @show_skip = parse_opt :ss, :show_skip , @show_skip146 @temp_dir = parse_opt :td, :temp_dir , @temp_dir147 @verbose = parse_opt :v , :verbose , @verbose148 @repeats = 1 if @repeats == nil149 true150 end151 # Set options array to be passed to Minitest.run152 def mt_opts153 opts_ary = []154 opts_ary << "--verbose" if @verbose155 opts_ary << "--seed" << @seed.to_s if @seed156 opts_ary << "--name" << @name if (@name.is_a?(String) || @name.is_a?(Regexp))157 opts_ary << "--exclude" << @exclude if (@exclude.is_a?(String) || @exclude.is_a?(Regexp))158 opts_ary159 end160 # Set variable based in calling parameters161 # @param [Symbol] s short calling option symbol162 # @param [Symbol] l long calling option symbol163 # @param [Object] iv variable to set164 def parse_opt(s, l, iv)165 return @opts[l] if @opts.key? l166 return @opts[s] if @opts.key? s167 iv168 end169 # Sets info in {.rpt_data} hash, used by reports for header info, etc.170 def set_rpt_data171 t = @rpt_data172 tn = Time.now173 t[:start_time] = tn174 t[:timestamp] = tn.strftime('%F_%H-%M-%S')175 t[:log_base] = "SUMT_#{t[:timestamp]}_su#{SU_VERS_INT}"176 end177 # Loads dependencies178 def load_deps179 require 'stringio'180 require 'minitest'181 require_relative 'console'182 require_relative 'assertions'183 require_relative 'testcase'184 require_relative 'minitest_prepend'185 require_relative 'minitest_test_runnable_prepend.rb'186 require_relative 'menu_guard.rb'187 require_relative 'observer_evt_to_hsh.rb'188 require_relative 'observer_evt_to_queue.rb'189 require_relative 'system_files.rb'190 require_relative 'app_files.rb'191 require_relative 'file_reporter.rb'192 extend AppFiles193 @loaded = true194 end195 # Loads log & udp reporter files196 def load_reporters197 mt_exts = Minitest.extensions198 if @gen_logs199 require_relative 'file_reporter'200 mt_exts << 'file' unless mt_exts.include? 'file'201 elsif @gen_logs == false202 mt_exts.delete 'file'203 end204 if @gen_udp205 require 'socket'206 require_relative 'udp_reporter'207 mt_exts << 'udp' unless mt_exts.include? 'udp'208 elsif @gen_udp == false209 mt_exts.delete 'udp'210 end211 end212 # If a rerun file is used, loads data into @rr_data and other variables213 def load_rerun_info214 if File.exist? @rr_file215 rr_file = @rr_file216 elsif !File.exist? (rr_file = "#{@log_dir}/rerun/#{@rr_file}")217 raise ArgumentError, "Can't find rerun file #{@rr_file}"218 end219 require 'psych'220 @rr_data = Psych.load_file(rr_file)221 rr_hdr = @rr_data.shift[1]222 @test_dir = rr_hdr[:test_dir]223 @test_files = rr_hdr[:test_files]224 ary_tests = rr_hdr[:test_files]225 @not_rr = false226 end227 # Loads (and, if required, reloads) test files228 def load_tests(ary_tests, ary_remove)229 if ary_tests.empty?230 puts "\n Test Files: ALL"231 @rpt_data[:test_files] = 'All'232 ary = []233 Minitest::Runnable.runnables.select! { |r|234 if r.respond_to? :fn235 fn = r.fn236 # puts "Suite #{fn}"237 if fn.start_with?('TC_') || fn =~ /\/TC_/238 ary_remove << r.to_s.to_sym if Object.const_defined?(r.name)239 true240 else241 false242 end243 else244 false245 end246 }247 else248 str = ary_tests.join(', ')249 puts "\n Test Files: #{str}"250# @rpt_data[:test_files] = str251 Minitest::Runnable.runnables.select! { |r|252 if r.respond_to?(:fn)253 if ary_tests.include?(r.fn)254 ary_remove << r.to_s.to_sym if Object.const_defined?(r.name)255 true256 else257 false258 end259 else260 false261 end262 }263 end264 ary_remove.each { |t| Object.send(:remove_const, t) }265 # (re)load files266 Minitest::Runnable.runnables.clear267 GC.start268 Dir.chdir(@test_dir) { |d|269 stderr = $stderr270 $stderr = StringIO.new271 if @load_all or ary_tests.empty?272 files = Dir.glob "**/TC_*.rb"273 else274 files = ary_tests275 end276 $LOAD_PATH.unshift @test_dir277 File.exist?('helper.rb') and load('helper.rb')278 files.each { |fn| load "./#{fn}" }279 $LOAD_PATH.shift280 $stderr.flush281 $stderr = stderr282 }283 @test_files = ary_tests284 end285 # After prep is finished, run tests286 def run_mt287 # first things first...288 verbose = $VERBOSE289 $VERBOSE = nil290 o_stdout = $stdout291 o_stderr = $stderr292 $stdout = SUMT::SUMT_CONSOLE293 if @temp_dir && Dir.exist?(@temp_dir)294 env = {}295 env['TMP'] = ENV['TMP']296 env['TEMP'] = ENV['TEMP']297 env['TMPDIR'] = ENV['TMPDIR']298 ENV['TMP'] = @temp_dir299 ENV['TEMP'] = @temp_dir300 ENV['TMPDIR'] = @temp_dir301 else302 env = nil303 end304 opts = mt_opts305 1.upto(@repeats) { |r|306 set_rpt_data307 @run_cntr = r308 @repeats > 1 and $stdout.write(" Running: %2d/%d\n\n" % [r, @repeats])309 ::Minitest.run opts310 puts '—' * 85311 r != @repeats and remove_temp_files # remove temp files for all but last run312 }313 model = Sketchup.active_model314 model.respond_to?(:close) and model.close(true)315 Sketchup.file_new316 ensure317 $VERBOSE = verbose318 srand if @seed319 $stdout = o_stdout320 $stderr = o_stderr321 if env322 ENV['TMP'] = env['TMP']323 ENV['TEMP'] = env['TEMP']324 ENV['TMPDIR'] = env['TMPDIR']325 end326 end327 # Deletes temp files when using repeats328 def remove_temp_files329 files = Dir.glob "#{Sketchup.temp_dir}/SUMT/**/*.*"330 FileUtils.rm_f files331 end...

Full Screen

Full Screen

double.rb

Source:double.rb Github

copy

Full Screen

...69 def formatted_name70 self.class.formatted_name(method_name, expected_arguments)71 end72 def method_call(args)73 if verbose?74 puts Double.formatted_name(method_name, args)75 end76 times_called_expectation.attempt if definition.times_matcher77 space.verify_ordered_double(self) if ordered?78 end79 def implementation_is_original_method?80 definition.implementation_is_original_method?81 end82 protected83 def ordered?84 definition.ordered?85 end86 def verbose?87 definition.verbose?88 end89 def verify_times_matcher_is_set90 unless definition.times_matcher91 raise RR::Errors.build_error(:DoubleDefinitionError, "#definition.times_matcher is not set")92 end93 end94 def verify_argument_expectation_is_set95 unless definition.argument_expectation96 raise RR::Errors.build_error(:DoubleDefinitionError, "#definition.argument_expectation is not set")97 end98 end99 def verify_method_signature100 unless double_injection.subject_has_original_method?101 raise RR::Errors.build_error(:SubjectDoesNotImplementMethodError)...

Full Screen

Full Screen

test_helper.rb

Source:test_helper.rb Github

copy

Full Screen

...45end46# We're going to be redefining a lot of constants in the tests, so supress47# warnings of the same.48def quietly49 old_verbose = $VERBOSE50 $VERBOSE = nil51 yield52 $VERBOSE = old_verbose53end54# Dummy Rails logger, for testing warnings.55module Rails56 FAKE_LOGGER = Object.new57 def self.logger58 FAKE_LOGGER59 end60end...

Full Screen

Full Screen

verbose

Using AI Code Generation

copy

Full Screen

1 stub(1).times { 1 }2 stub(1).times { 1 }3 stub(1).times { 1 }4 stub(1).times { 1 }5 stub(1).times { 1 }6 stub(1).times { 1 }7 stub(1).times { 1 }8 stub(1).times { 1 }

Full Screen

Full Screen

verbose

Using AI Code Generation

copy

Full Screen

1r.set(1,2)2r.get(1)3r.get(2)4 @rr = {}5 def set(key, value)6 def get(key)7 def verbose=(boolean)8r.set(1,2)9r.get(1)10r.get(2)11 @rr = {}12 def set(key, value)13 def get(key)14 def verbose=(boolean)15 def get(key)16r.set(1,2)17r.get(1)18r.get(2)19 @rr = {}20 def set(key, value)21 def get(key)22 def verbose=(boolean)23r.set(1,2)24r.get(1)25r.get(2)26 @rr = {}

Full Screen

Full Screen

verbose

Using AI Code Generation

copy

Full Screen

1rr.set(10, 20)2rr.add(20)3rr.sub(10)4rr.mul(10)5rr.div(2)6rr.set(10, 20)7rr.add(20)8rr.sub(10)9rr.mul(10)10rr.div(2)11rr.set(10, 20)12rr.add(20)13rr.sub(10)14rr.mul(10)15rr.div(2)16 def set(a, b)17 print_verbose('set', a, b)18 def add(a)19 print_verbose('add', a)20 def sub(a)21 print_verbose('sub', a)22 def mul(a)23 print_verbose('mul', a)24 def div(a)25 print_verbose('div', a)26 def print_verbose(method, *args)27 rr.set(10, 20)28 rr.add(20)29 rr.sub(10)30 rr.mul(10)31 rr.div(2

Full Screen

Full Screen

verbose

Using AI Code Generation

copy

Full Screen

1require 'rre=(boolean)2r.set(1,2)3r.get(1)4r.get(2)5 @rr = {}

Full Screen

Full Screen

verbose

Using AI Code Generation

copy

Full Screen

1rr.set(12, 20)2rr.add(20)3rr.sub(10)4rr.mul(10)5rr.div(2)6rr.set(10, 20)7rr.add(20)8rr.sub(10)9rr.mul(10)10rr.div(2)11rr.set(10, 20)12rr.add(20)13rr.sub(10)14rr.mul(10)15rr.div(2)16 def set(a, b)17 print_verbose('set', a, b)18 def add(a)19 print_verbose('add', a)20 def sub(a)21 print_verbose('sub', a)22 def mul(a)23 print_verbose('mul', a)24 def div(a)25 print_verbose('div', a)26 def print_verbose(method, *args)27 rr.set(10, 20)28 rr.add(20)29 rr.sub(10)30 rr.mul(10)31 rr.div(2

Full Screen

Full Screen

verbose

Using AI Code Generation

copy

Full Screen

1rr.set(10, 20)2rr.add(20)3rr.sub(10)4rr.mul(10)5rr.div(2)6rr.set(10, 20)7rr.add(20)8rr.sub(10)9rr.mul(10)10rr.div(2)11rr.set(10, 20)12rr.add(20)13rr.sub(10)14rr.mul(10)15rr.div(2)16 def set(a, b)17 print_verbose('set', a, b)18 def add(a)19 print_verbose('add', a)20 def sub(a)21 print_verbose('sub', a)22 def mul(a)23 print_verbose('mul', a)24 def div(a)25 print_verbose('div', a)26 def print_verbose(method, *args)27 rr.set(10, 20)28 rr.add(20)29 rr.sub(10)30 rr.mul(10)31 rr.div(2

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful