我想在我的黄瓜测试中使用 config.yml 文件。我这样写:
test_config.yml:
group_name: animals
learn_group_name: dogs
card_box_name: cats
cucumber_test.rb:
require `watir-webdriver`
require `yaml`
def read_config
config = YAML.load(File.read(`/home/profile/Desktop/cucumber/test_config.yml`))
@group = config[`group_name`]
@learn_group = config[`learn_group_name`]
@card_box = config[`card_box_name`]
end
puts `Group = #{@group}`
puts `Learn group = #{@learn_group}`
puts `Card box = #{@card_box}`
...
在控制台(终端)中:
Group =
Learn group =
Card box =
...
但是有什么问题呢?