How do I run multiple ruby files simultaneously without them stepping on each other?

I need to run several rb files simultaneously. Each file is setup
identically (simplified sample below)

File #1 (there are 6 of these total with about 10 tests each)

require_relative ‘./spec_helper’
require_relative ‘./tests’

config.before(:each) do
    @driver = Selenium::WebDriver.for :firefox
    @base_url = get_url
end

config.after(:each) do
    @driver.close
end

RSpec.describe ‘File 1’ do

it ‘test 1’ do
login
verify element present
logout
end

it ‘test 2’ do
login
verify element present
logout
end

it ‘test 3’ do
login
verify element present
logout
end

end

All the files run great separately - however when run simultaneously
they end up stepping on each other during the after hook specifically
@driver.close and I get the following error:

An error occurred in an after hook NoMethodError: undefined method quit’
for nil:NilClass occurred at
C:/Automated_Testing/Indie/w_molap_1.rb:31:inblock (2 levels) in ’

My question is: is there something different I could do - perhaps in the
driver before hook setup that will allow me to run these files at the
same time without them stepping on each other?

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs