0
Я сделал образец для концепции выполнения тестовой системы автоматизации параллельно с использованием Rake и Rspec. Но не знаю, как получить переданный параметр в файле rake в файл rspec. Кто-нибудь, пожалуйста, помогите.Как получить параметр файла Rake в Rspec
Пример Rake файла: -
require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new(:spec)
namespace :spec do
task :foo, :arg1, :arg2 do |t, args|
do_something
end
desc "Run the unit specs"
RSpec::Core::RakeTask.new(:unit, :arg1, :arg2) do |t, args|
puts "#{args}"
t.pattern = "test_spec.rb"
end
desc "Run the integration specs"
RSpec::Core::RakeTask.new(:integration, :arg1, :arg2) do |t, args|
puts "#{args}"
t.pattern = "test_spec.rb"
end
end
task:int do
Rake::Task["spec:integration"].invoke(123,456)
end
task:uint do
Rake::Task["spec:unit"].invoke(8888,1111)
end
multitask :all => ["int", "uint"]
Rspec Файл: -
require "selenium-webdriver"
require "rspec"
describe "Test Execution" do
before(:each) do
@driver = Selenium::WebDriver.for :firefox
@base_url = "http://xxxxxxxxxxxxx.com"
@accept_next_alert = true
@driver.manage.timeouts.implicit_wait = 30
@driver.manage.window.maximize
end
it "Executing testcase steps" do
@driver.get(@base_url + "/")
@driver.find_element(:id, "employee_email").send_keys "[email protected]"
@driver.find_element(:id, "password").send_keys "1234"
@driver.find_element(:id, "login_submit").click
end
after(:each) do
@driver.quit
end
end
Здесь я хочу, чтобы получить переданный параметр в файле граблей (123456 & 8888,1111). Помощь в продвижении!
Как насчет установки его как рельсы окр вар? – bsvin33t