selenium Cumber,如何从custom_steps.rb调用

selenium Cumber,如何从custom_steps.rb调用,selenium,cucumber,Selenium,Cucumber,我有这段代码,我把它放在文件中,自定义步骤如下: Then(/^can assign multitimes$/) do assignee = $driver.find_element(:xpath, '//* [@id="left"]/div/div[1]/div[3]/div[5]/div[2]') if assignee.text().include? ',' puts "Failed (request cannot be assigned to otherusers)" e

我有这段代码,我把它放在文件中,自定义步骤如下:

Then(/^can assign multitimes$/) do
 assignee = $driver.find_element(:xpath, '//*
 [@id="left"]/div/div[1]/div[3]/div[5]/div[2]')
  if assignee.text().include? ','
  puts "Failed (request cannot be assigned to otherusers)"
  else
  puts "Passed (request cannot be assigned to otherusers)"
end
end
如何在.feature文件中调用上述代码


谢谢,非常感谢您的帮助。

将您的功能文件和步骤定义安排在以下文件夹结构中

/features/YourSpecific.feature
/features/step_definitions/custom_steps.rb
确保您已经安装了cucumber gem for Ruby运行时环境。只需导航到/feautures/并运行即可

$user>cucumber YourSpecific.feature

在以下文件夹结构中排列要素文件和步骤定义

/features/YourSpecific.feature
/features/step_definitions/custom_steps.rb
确保您已经安装了cucumber gem for Ruby运行时环境。只需导航到/feautures/并运行即可

$user>cucumber YourSpecific.feature