Implementation of Parallel test execution by customizing an existing Ruby-Rspec framework

39 views Asked by At

We are working on an existing Ruby-Rspec framework which designed to execute sequential tests on different batches which is statically designed in framework itself. Now, we are trying to enhance it by applying parallel execution without impacting the existing framework workflow.

As usual, our framework starts it execution from the task mentioned in rakefile.rb by validating whether its local or lambdatest execution

if Execute_in == 'LambdaTest'
    return task_list << 'runTestsLambda'

The below function has been executed under Task

task :runTestsLambda do
  fetchtests $execute_file, @browser, 'LambdaTest', "", ""
end

The above fetches the list of tests that needs to be executed (dynamic decision which test case needs to execute)

Then, the test list is passed into another function which creates a Rake task

RSpec::Core::RakeTask.new(:spec) do |t|
    t.pattern = $scriptList
  end

Then we are executing the rake task

ENV["browser"] = browser
  ENV["node"] = node
  Rake::Task['spec'].execute

Further, We are registering our capybara driver in another file 'execute_helper.rb'

 Capybara.register_driver :lambdatest do |app|
    Capybara::Selenium::Driver.new(app,
                                   :browser => :remote,
                                   :url => "https://"+$LAMBDATEST_USERNAME+":"+$LAMBDATEST_ACCESSKEY+"@hub.lambdatest.com/wd/hub",
                                   :http_client => client,
                                   :options => options

If anyone done parallel execution in Ruby-Rspec-LambdaTest , please suggest any ideas.

We tried hyperexecute in lambdatest, but LT support confirmed that the hyperexecute requires some customization after reviewing our framework. We explored multiple solutions, tried framework level changes and we are unable to implement.

I am expecting any ideas/suggestions if there is any way to perform parallel execution on the existing rspec framework.

0

There are 0 answers