Before/After Suite when using Ruby MiniTest

前端 未结 8 1060
时光说笑
时光说笑 2020-12-09 07:30

Is there an alternative to RSpec\'s before(:suite) and after(:suite) in MiniTest?

I suspect that a custom test runner is in order, however

8条回答
  •  天涯浪人
    2020-12-09 07:58

    You can just place the code outside of the class.

    This is what I do to have a banner.

    require 'selenium-webdriver'
    require 'minitest/test'
    require 'minitest/autorun'
    
    class InstanceTest < Minitest::Test
    
        def setup
        url     = ARGV.first
        @url    = self.validate_instance(url)
            @driver = Selenium::WebDriver.for :firefox
        end
    

提交回复
热议问题