How to use capture_subprocess_io method of Assertions Package

Best Minitest_ruby code snippet using Assertions.capture_subprocess_io

minitest_redis_test.rb

Source:minitest_redis_test.rb Github

copy

Full Screen

...18 @redis.flushdb19 @exe = File.expand_path('../../../exe/minitest-queue', __FILE__)20 end21 def test_buildkite_output22 out, err = capture_subprocess_io do23 system(24 { 'BUILDKITE' => '1' },25 @exe, 'run',26 '--queue', @redis_url,27 '--seed', 'foobar',28 '--build', '1',29 '--worker', '1',30 '--timeout', '1',31 '--max-requeues', '1',32 '--requeue-tolerance', '1',33 '-Itest',34 'test/dummy_test.rb',35 chdir: 'test/fixtures/',36 )37 end38 assert_empty err39 output = normalize(out.lines.last.strip)40 assert_equal '--- Ran 11 tests, 8 assertions, 2 failures, 1 errors, 1 skips, 4 requeues in X.XXs', output41 end42 def test_custom_requeue43 out, err = capture_subprocess_io do44 system(45 { 'BUILDKITE' => '1' },46 @exe, 'run',47 '--queue', @redis_url,48 '--seed', 'foobar',49 '--build', '1',50 '--worker', '1',51 '--timeout', '1',52 '--max-requeues', '1',53 '--requeue-tolerance', '1',54 '-Itest',55 'test/custom_requeue_test.rb',56 chdir: 'test/fixtures/',57 )58 end59 assert_empty err60 output = normalize(out.lines.last.strip)61 assert_equal '--- Ran 3 tests, 0 assertions, 0 failures, 2 errors, 0 skips, 1 requeues in X.XXs', output62 end63 def test_max_test_failed64 out, err = capture_subprocess_io do65 system(66 @exe, 'run',67 '--queue', @redis_url,68 '--seed', 'foobar',69 '--build', '1',70 '--worker', '1',71 '--timeout', '1',72 '--max-requeues', '1',73 '--requeue-tolerance', '1',74 '--max-test-failed', '3',75 '-Itest',76 'test/failing_test.rb',77 chdir: 'test/fixtures/',78 )79 end80 assert_equal 'This worker is exiting early because too many failed tests were encountered.', err.chomp81 output = normalize(out.lines.last.strip)82 assert_equal 'Ran 47 tests, 47 assertions, 3 failures, 0 errors, 0 skips, 44 requeues in X.XXs', output83 # Run the reporter84 out, err = capture_subprocess_io do85 system(86 @exe, 'report',87 '--queue', @redis_url,88 '--seed', 'foobar',89 '--build', '1',90 '--timeout', '1',91 '--max-test-failed', '3',92 chdir: 'test/fixtures/',93 )94 end95 assert_empty err96 expected = <<~EXPECTED97 Waiting for workers to complete98 Encountered too many failed tests. Test run was ended early.99 97 tests weren't run.100 Ran 3 tests, 47 assertions, 3 failures, 0 errors, 0 skips, 44 requeues in X.XXs (aggregated)101 EXPECTED102 assert_equal expected.strip, normalize(out.lines[0..4].join.strip)103 end104 def test_circuit_breaker105 out, err = capture_subprocess_io do106 system(107 @exe, 'run',108 '--queue', @redis_url,109 '--seed', 'foobar',110 '--build', '1',111 '--worker', '1',112 '--timeout', '1',113 '--max-requeues', '1',114 '--requeue-tolerance', '1',115 '--max-consecutive-failures', '3',116 '-Itest',117 'test/failing_test.rb',118 chdir: 'test/fixtures/',119 )120 end121 assert_equal "This worker is exiting early because it encountered too many consecutive test failures, probably because of some corrupted state.\n", err122 output = normalize(out.lines.last.strip)123 assert_equal 'Ran 3 tests, 3 assertions, 0 failures, 0 errors, 0 skips, 3 requeues in X.XXs', output124 end125 def test_redis_runner126 out, err = capture_subprocess_io do127 system(128 @exe, 'run',129 '--queue', @redis_url,130 '--seed', 'foobar',131 '--build', '1',132 '--worker', '1',133 '--timeout', '1',134 '--max-requeues', '1',135 '--requeue-tolerance', '1',136 '-Itest',137 'test/dummy_test.rb',138 chdir: 'test/fixtures/',139 )140 end141 assert_empty err142 output = normalize(out.lines.last.strip)143 assert_equal 'Ran 11 tests, 8 assertions, 2 failures, 1 errors, 1 skips, 4 requeues in X.XXs', output144 out, err = capture_subprocess_io do145 system(146 @exe, 'run',147 '--queue', @redis_url,148 '--seed', 'foobar',149 '--build', '1',150 '--worker', '1',151 '--timeout', '1',152 '--max-requeues', '1',153 '--requeue-tolerance', '1',154 '-Itest',155 'test/dummy_test.rb',156 chdir: 'test/fixtures/',157 )158 end159 assert_empty err160 output = normalize(out.lines.last.strip)161 assert_equal 'Ran 6 tests, 4 assertions, 2 failures, 1 errors, 0 skips, 3 requeues in X.XXs', output162 end163 def test_retry_success164 out, err = capture_subprocess_io do165 system(166 @exe, 'run',167 '--queue', @redis_url,168 '--seed', 'foobar',169 '--build', '1',170 '--worker', '1',171 '--timeout', '1',172 '--max-requeues', '1',173 '--requeue-tolerance', '1',174 '-Itest',175 'test/passing_test.rb',176 chdir: 'test/fixtures/',177 )178 end179 assert_empty err180 output = normalize(out.lines.last.strip)181 assert_equal 'Ran 100 tests, 100 assertions, 0 failures, 0 errors, 0 skips, 0 requeues in X.XXs', output182 out, err = capture_subprocess_io do183 system(184 @exe, 'run',185 '--queue', @redis_url,186 '--seed', 'foobar',187 '--build', '1',188 '--worker', '1',189 '--timeout', '1',190 '--max-requeues', '1',191 '--requeue-tolerance', '1',192 '-Itest',193 'test/passing_test.rb',194 chdir: 'test/fixtures/',195 )196 end197 assert_empty err198 output = normalize(out.lines.last.strip)199 assert_equal 'All tests were ran already', output200 end201 def test_retry_report202 # Run first worker, failing all tests203 out, err = capture_subprocess_io do204 system(205 @exe, 'run',206 '--queue', @redis_url,207 '--seed', 'foobar',208 '--build', '1',209 '--worker', '1',210 '--timeout', '1',211 '-Itest',212 'test/failing_test.rb',213 chdir: 'test/fixtures/',214 )215 end216 assert_empty err217 output = normalize(out.lines.last.strip)218 assert_equal 'Ran 100 tests, 100 assertions, 100 failures, 0 errors, 0 skips, 0 requeues in X.XXs', output219 # Run the reporter220 out, err = capture_subprocess_io do221 system(222 @exe, 'report',223 '--queue', @redis_url,224 '--seed', 'foobar',225 '--build', '1',226 '--timeout', '1',227 chdir: 'test/fixtures/',228 )229 end230 assert_empty err231 expect = 'Ran 100 tests, 100 assertions, 100 failures, 0 errors, 0 skips, 0 requeues in X.XXs (aggregated)'232 assert_equal expect, normalize(out.strip.lines[1].strip)233 # Simulate another worker successfuly retrying all errors (very hard to reproduce properly)234 queue_config = CI::Queue::Configuration.new(235 timeout: 1,236 build_id: '1',237 worker_id: '2',238 )239 queue = CI::Queue.from_uri(@redis_url, queue_config)240 error_reports = queue.build.error_reports241 assert_equal 100, error_reports.size242 error_reports.keys.each_with_index do |test_id, index|243 queue.build.record_success(test_id.dup, stats: {244 'assertions' => index + 1,245 'errors' => 0,246 'failures' => 0,247 'skips' => 0,248 'requeues' => 0,249 'total_time' => index + 1,250 })251 end252 # Retry first worker, bailing out253 out, err = capture_subprocess_io do254 system(255 @exe, 'run',256 '--queue', @redis_url,257 '--seed', 'foobar',258 '--build', '1',259 '--worker', '1',260 '--timeout', '1',261 '-Itest',262 'test/failing_test.rb',263 chdir: 'test/fixtures/',264 )265 end266 assert_empty err267 output = normalize(out.lines.last.strip)268 assert_equal 'All tests were ran already', output269 # Re-run the reporter270 out, err = capture_subprocess_io do271 system(272 @exe, 'report',273 '--queue', @redis_url,274 '--seed', 'foobar',275 '--build', '1',276 '--timeout', '1',277 chdir: 'test/fixtures/',278 )279 end280 assert_empty err281 expect = 'Ran 100 tests, 100 assertions, 0 failures, 0 errors, 0 skips, 0 requeues in X.XXs (aggregated)'282 assert_equal expect, normalize(out.strip.lines[1].strip)283 end284 def test_down_redis285 out, err = capture_subprocess_io do286 system(287 @exe, 'run',288 '--queue', 'redis://localhost:1337',289 '--seed', 'foobar',290 '--build', '1',291 '--worker', '1',292 '--timeout', '1',293 '--max-requeues', '1',294 '--requeue-tolerance', '1',295 '-Itest',296 'test/dummy_test.rb',297 chdir: 'test/fixtures/',298 )299 end300 assert_empty err301 output = normalize(out.lines.last.strip)302 assert_equal 'Ran 0 tests, 0 assertions, 0 failures, 0 errors, 0 skips, 0 requeues in X.XXs', output303 end304 def test_test_data_reporter305 out, err = capture_subprocess_io do306 system(307 {'CI_QUEUE_FLAKY_TESTS' => 'test/ci_queue_flaky_tests_list.txt'},308 @exe, 'run',309 '--queue', @redis_url,310 '--seed', 'foobar',311 '--namespace', 'foo',312 '--build', '1',313 '--worker', '1',314 '--timeout', '1',315 '--max-requeues', '1',316 '--requeue-tolerance', '1',317 '-Itest',318 'test/dummy_test.rb',319 chdir: 'test/fixtures/',320 )321 end322 assert_empty err323 output = normalize(out.lines.last.strip)324 assert_equal 'Ran 9 tests, 6 assertions, 1 failures, 1 errors, 1 skips, 2 requeues in X.XXs', output325 content = File.read(@test_data_path)326 failures = JSON.parse(content, symbolize_names: true)327 .sort_by { |h| "#{h[:test_id]}##{h[:test_index]}" }328 assert_equal 'foo', failures[0][:namespace]329 assert_equal 'ATest#test_bar', failures[0][:test_id]330 assert_equal 'test_bar', failures[0][:test_name]331 assert_equal 'ATest', failures[0][:test_suite]332 assert_equal 'failure', failures[0][:test_result]333 assert_equal true, failures[0][:test_retried]334 assert_equal false, failures[0][:test_result_ignored]335 assert_equal 1, failures[0][:test_assertions]336 assert_equal 'test/dummy_test.rb', failures[0][:test_file_path]337 assert_equal 9, failures[0][:test_file_line_number]338 assert_equal 'Minitest::Assertion', failures[0][:error_class]339 assert_equal 'Expected false to be truthy.', failures[0][:error_message]340 assert_equal 'test/dummy_test.rb', failures[0][:error_file_path]341 assert_equal 10, failures[0][:error_file_number]342 assert_equal 'foo', failures[1][:namespace]343 assert_equal 'ATest#test_bar', failures[1][:test_id]344 assert_equal 'test_bar', failures[1][:test_name]345 assert_equal 'ATest', failures[1][:test_suite]346 assert_equal 'failure', failures[1][:test_result]347 assert_equal false, failures[1][:test_result_ignored]348 assert_equal false, failures[1][:test_retried]349 assert_equal 1, failures[1][:test_assertions]350 assert_equal 'test/dummy_test.rb', failures[1][:test_file_path]351 assert_equal 9, failures[1][:test_file_line_number]352 assert_equal 'Minitest::Assertion', failures[1][:error_class]353 assert_equal 'Expected false to be truthy.', failures[1][:error_message]354 assert_equal 'test/dummy_test.rb', failures[1][:error_file_path]355 assert_equal 10, failures[1][:error_file_number]356 assert failures[0][:test_index] < failures[1][:test_index]357 assert_equal 'ATest#test_flaky', failures[2][:test_id]358 assert_equal 'skipped', failures[2][:test_result]359 assert_equal false, failures[2][:test_retried]360 assert_equal true, failures[2][:test_result_ignored]361 assert_equal 1, failures[2][:test_assertions]362 assert_equal 'test/dummy_test.rb', failures[2][:test_file_path]363 assert_equal 13, failures[2][:test_file_line_number]364 assert_equal 'Minitest::Assertion', failures[2][:error_class]365 assert_equal 18, failures[2][:error_file_number]366 assert_equal 'ATest#test_flaky_passes', failures[4][:test_id]367 assert_equal 'success', failures[4][:test_result]368 end369 def test_test_data_time_reporter370 start_time = Time.now371 travel_to(start_time) do372 capture_subprocess_io do373 system(374 @exe, 'run',375 '--queue', @redis_url,376 '--seed', 'foobar',377 '--namespace', 'foo',378 '--build', '1',379 '--worker', '1',380 '--timeout', '10',381 '-Itest',382 'test/time_test.rb',383 chdir: 'test/fixtures/',384 )385 end386 end387 end_time = Time.now388 content = File.read(@test_data_path)389 failure = JSON.parse(content, symbolize_names: true)390 .sort_by { |h| "#{h[:test_id]}##{h[:test_index]}" }391 .first392 assert_in_delta start_time.to_i, failure[:test_start_timestamp], 5393 assert_in_delta end_time.to_i, failure[:test_finish_timestamp], 5394 assert failure[:test_finish_timestamp] > failure[:test_start_timestamp]395 end396 def test_junit_reporter397 out, err = capture_subprocess_io do398 system(399 {'CI_QUEUE_FLAKY_TESTS' => 'test/ci_queue_flaky_tests_list.txt'},400 @exe, 'run',401 '--queue', @redis_url,402 '--seed', 'foobar',403 '--build', '1',404 '--worker', '1',405 '--timeout', '1',406 '--max-requeues', '1',407 '--requeue-tolerance', '1',408 '-Itest',409 'test/dummy_test.rb',410 chdir: 'test/fixtures/',411 )412 end413 assert_empty err414 output = normalize(out.lines.last.strip)415 assert_equal 'Ran 9 tests, 6 assertions, 1 failures, 1 errors, 1 skips, 2 requeues in X.XXs', output416 assert_equal <<~XML, normalize_xml(File.read(@junit_path))417 <?xml version="1.1" encoding="UTF-8"?>418 <testsuites>419 <testsuite name="ATest" filepath="test/dummy_test.rb" skipped="5" failures="1" errors="0" tests="6" assertions="5" time="X.XX">420 <testcase name="test_foo" classname="ATest" assertions="0" time="X.XX" flaky_test="false" run-command=\"bundle exec ruby -Ilib:test test/dummy_test.rb -n ATest\\#test_foo\" lineno="5">421 <skipped type="Minitest::Skip"/>422 </testcase>423 <testcase name="test_bar" classname="ATest" assertions="1" time="X.XX" flaky_test="false" run-command=\"bundle exec ruby -Ilib:test test/dummy_test.rb -n ATest\\#test_bar\" lineno="5">424 <skipped type="Minitest::Assertion"/>425 </testcase>426 <testcase name="test_flaky" classname="ATest" assertions="1" time="X.XX" flaky_test="true" run-command=\"bundle exec ruby -Ilib:test test/dummy_test.rb -n ATest\\#test_flaky\" lineno="5">427 <failure type="Minitest::Assertion" message="Expected false to be truthy.">428 <![CDATA[429 Skipped:430 test_flaky(ATest) [test/dummy_test.rb]:431 Expected false to be truthy.432 ]]>433 </failure>434 </testcase>435 <testcase name="test_flaky_passes" classname="ATest" assertions="1" time="X.XX" flaky_test="true" run-command="bundle exec ruby -Ilib:test test/dummy_test.rb -n ATest\\#test_flaky_passes" lineno="5"/>436 <testcase name="test_flaky_fails_retry" classname="ATest" assertions="1" time="X.XX" flaky_test="true" run-command="bundle exec ruby -Ilib:test test/dummy_test.rb -n ATest\\#test_flaky_fails_retry" lineno="5">437 <failure type="Minitest::Assertion" message="Expected false to be truthy.">438 <![CDATA[439 Skipped:440 test_flaky_fails_retry(ATest) [test/dummy_test.rb]:441 Expected false to be truthy.442 ]]>443 </failure>444 </testcase>445 <testcase name="test_bar" classname="ATest" assertions="1" time="X.XX" flaky_test="false" run-command="bundle exec ruby -Ilib:test test/dummy_test.rb -n ATest\\#test_bar" lineno="5">446 <failure type="Minitest::Assertion" message="Expected false to be truthy.">447 <![CDATA[448 Failure:449 test_bar(ATest) [test/dummy_test.rb]:450 Expected false to be truthy.451 ]]>452 </failure>453 </testcase>454 </testsuite>455 <testsuite name="BTest" filepath="test/dummy_test.rb" skipped="1" failures="0" errors="1" tests="3" assertions="1" time="X.XX">456 <testcase name="test_bar" classname="BTest" assertions="0" time="X.XX" flaky_test="false" run-command="bundle exec ruby -Ilib:test test/dummy_test.rb -n BTest\\#test_bar" lineno="36">457 <skipped type="TypeError"/>458 </testcase>459 <testcase name="test_foo" classname="BTest" assertions="1" time="X.XX" flaky_test="false" run-command="bundle exec ruby -Ilib:test test/dummy_test.rb -n BTest\\#test_foo" lineno="36"/>460 <testcase name="test_bar" classname="BTest" assertions="0" time="X.XX" flaky_test="false" run-command="bundle exec ruby -Ilib:test test/dummy_test.rb -n BTest\\#test_bar" lineno="36">461 <error type="TypeError" message="TypeError: String can&apos;t be coerced into Integer">462 <![CDATA[463 Failure:464 test_bar(BTest) [test/dummy_test.rb]:465 TypeError: String can't be coerced into Integer466 test/dummy_test.rb:37:in `+'467 test/dummy_test.rb:37:in `test_bar'468 ]]>469 </error>470 </testcase>471 </testsuite>472 </testsuites>473 XML474 end475 def test_redis_reporter_failure_file476 Dir.mktmpdir do |dir|477 failure_file = File.join(dir, 'failure_file.json')478 capture_subprocess_io do479 system(480 { 'BUILDKITE' => '1' },481 @exe, 'run',482 '--queue', @redis_url,483 '--seed', 'foobar',484 '--build', '1',485 '--worker', '1',486 '--timeout', '1',487 '--max-requeues', '1',488 '--requeue-tolerance', '1',489 '-Itest',490 'test/dummy_test.rb',491 chdir: 'test/fixtures/',492 )493 end494 capture_subprocess_io do495 system(496 @exe, 'report',497 '--queue', @redis_url,498 '--build', '1',499 '--timeout', '1',500 '--failure-file', failure_file,501 chdir: 'test/fixtures/',502 )503 end504 content = File.read(failure_file)505 failure = JSON.parse(content, symbolize_names: true)506 .sort_by { |failure_report| failure_report[:test_line] }507 .first508 ## output and test_file509 expected = {510 test_file: "ci-queue/ruby/test/fixtures/test/dummy_test.rb",511 test_line: 9,512 test_and_module_name: "ATest#test_bar",513 error_class: "Minitest::Assertion",514 test_name: "test_bar",515 test_suite: "ATest",516 }517 assert_includes failure[:test_file], expected[:test_file]518 assert_equal failure[:test_line], expected[:test_line]519 assert_equal failure[:test_suite], expected[:test_suite]520 assert_equal failure[:test_and_module_name], expected[:test_and_module_name]521 assert_equal failure[:test_name], expected[:test_name]522 assert_equal failure[:error_class], expected[:error_class]523 end524 end525 def test_redis_reporter526 # HACK: Simulate a timeout527 config = CI::Queue::Configuration.new(build_id: '1', worker_id: '1', timeout: '1')528 build_record = CI::Queue::Redis::BuildRecord.new(self, ::Redis.new(url: @redis_url), config)529 build_record.record_warning(CI::Queue::Warnings::RESERVED_LOST_TEST, test: 'Atest#test_bar', timeout: 2)530 out, err = capture_subprocess_io do531 system(532 @exe, 'run',533 '--queue', @redis_url,534 '--seed', 'foobar',535 '--build', '1',536 '--worker', '1',537 '--timeout', '1',538 '--max-requeues', '1',539 '--requeue-tolerance', '1',540 '-Itest',541 'test/dummy_test.rb',542 chdir: 'test/fixtures/',543 )544 end545 assert_empty err546 output = normalize(out.lines.last.strip)547 assert_equal 'Ran 11 tests, 8 assertions, 2 failures, 1 errors, 1 skips, 4 requeues in X.XXs', output548 out, err = capture_subprocess_io do549 system(550 @exe, 'report',551 '--queue', @redis_url,552 '--build', '1',553 '--timeout', '1',554 chdir: 'test/fixtures/',555 )556 end557 assert_empty err558 output = normalize(out)559 expected_output = <<~END560 Waiting for workers to complete561 [WARNING] Atest#test_bar was picked up by another worker because it didn't complete in the allocated 2 seconds.562 You may want to either optimize this test or bump ci-queue timeout.563 It's also possible that the worker that was processing it was terminated without being able to report back.564 Ran 7 tests, 8 assertions, 2 failures, 1 errors, 1 skips, 4 requeues in X.XXs (aggregated)565 FAIL ATest#test_bar566 Expected false to be truthy.567 test/dummy_test.rb:10:in `test_bar'568 FAIL ATest#test_flaky_fails_retry569 Expected false to be truthy.570 test/dummy_test.rb:23:in `test_flaky_fails_retry'571 ERROR BTest#test_bar572 END573 assert_includes output, expected_output574 end575 def test_utf8_tests_and_marshal576 out, err = capture_subprocess_io do577 system(578 { 'MARSHAL' => '1' },579 @exe, 'run',580 '--queue', @redis_url,581 '--seed', 'foobar',582 '--build', '1',583 '--worker', '1',584 '--timeout', '1',585 '-Itest',586 'test/utf8_test.rb',587 chdir: 'test/fixtures/',588 )589 end590 assert_empty err...

Full Screen

Full Screen

integration_test.rb

Source:integration_test.rb Github

copy

Full Screen

...11 raise "Unable to initialize test environment for #{label}"12end13def run_tests(command_array = %w(bundle exec rake))14 result = false15 out, err = capture_subprocess_io do16 result = in_clean_bundler_environment(*command_array)17 end18 # If the command failed, make it print any error messages19 err.must_equal '' unless result20 out21end22def stop_spring23 capture_subprocess_io do24 in_clean_bundler_environment('bin/spring', 'stop')25 end26end27BASE_CONFIG = {28 'development' => {29 'adapter' => 'sqlite3',30 'pool' => 5,31 'timeout' => 5000,32 'database' => 'db/development.sqlite3'33 },34 'test' => {35 'adapter' => 'sqlite3',36 'database' => ':memory:'37 }...

Full Screen

Full Screen

test_test.rb

Source:test_test.rb Github

copy

Full Screen

...4 toys_include_builtins(false)5 let(:tools_dir) { File.join(__dir__, "tool-testing") }6 it "runs for the given tool path" do7 tool = ["system", "test", "-d", tools_dir, "-t", "basic/foo"]8 out, _err = capture_subprocess_io do9 assert_equal(0, toys_run_tool(tool))10 end11 assert_match(/1 runs, 1 assertions, 0 failures, 0 errors, 0 skips/, out)12 end13 it "runs recursively" do14 tool = ["system", "test", "-d", tools_dir, "-t", "basic"]15 out, _err = capture_subprocess_io do16 assert_equal(0, toys_run_tool(tool))17 end18 assert_match(/2 runs, 2 assertions, 0 failures, 0 errors, 0 skips/, out)19 end20 it "honors --no-recursive" do21 tool = ["system", "test", "-d", tools_dir, "-t", "basic", "--no-recursive"]22 out, _err = capture_subprocess_io do23 assert_equal(0, toys_run_tool(tool))24 end25 assert_match(/1 runs, 1 assertions, 0 failures, 0 errors, 0 skips/, out)26 end27 it "reports no test files found" do28 tool = ["system", "test", "-d", tools_dir, "-t", "basic/bar"]29 _out, err = capture_subprocess_io do30 assert_equal(0, toys_run_tool(tool))31 end32 assert_match(/No test files found/, err)33 end34 it "reports that the given tool directory couldn't be found" do35 tool = ["system", "test", "-d", tools_dir, "-t", "baz"]36 _out, err = capture_subprocess_io do37 assert_equal(0, toys_run_tool(tool))38 end39 assert_match(/No such directory/, err)40 end41 it "reports failures" do42 tool = ["system", "test", "-d", tools_dir, "-t", "failing"]43 out, _err = capture_subprocess_io do44 assert_equal(1, toys_run_tool(tool))45 end46 assert_match(/1 runs, 1 assertions, 1 failures, 0 errors, 0 skips/, out)47 end48 it "honors focus" do49 tool = ["system", "test", "--minitest-focus", "-d", tools_dir, "-t", "focus"]50 out, _err = capture_subprocess_io do51 assert_equal(0, toys_run_tool(tool))52 end53 assert_match(/1 runs, 1 assertions, 0 failures, 0 errors, 0 skips/, out)54 end55end...

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.

Run Minitest_ruby automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful