我有一個問題,找到黃瓜數據表中的數字正確的RE。什麼是黃瓜數據表的正則表達式
我的情況是這樣的:
local_dhcp.feature
Feature:
Scenario Outline:
Given I have a valid username plus MAC address
When the user <user> with <mac> logs on to Sonar
Then the expected result should be <Expected_Result>
Examples:
| user | mac | Expected_Result|
| mattwwww | 200000000001 | OK |
| matt | 200000000001 | OK |
local_dhcp.rb
Given /^I have a valid username plus MAC address$/ do
@rad = RadiusClient.new
end
When /^the user "(.*?)" with "(\d+)" logs on to Sonar$/ do |username, mac|
puts "user: #{username} mac: #{mac}"
@rad.send(username, mac)
end
Then /^the expected result should be "(.*?)"$/ do |result|
# table is a Cucumber::Ast::Table
pending # express the regexp above with the code you wish you had
end
黃瓜功能\ test.feature
我的問題是:
看截圖,上面寫着2過去了,然而,爲什麼我看到這個底部: 您可以實現與這些片段未定義步驟的步驟定義:
When /^the user mattwww with (\d+) logs on to Sonar$/ do |arg1|
對我來說,它看起來像mac地址200000000001沒有通過。或者,我錯了嗎?@ rad.send(username,mac)這句話沒有運行。我試着把這個放在「user:#{username} mac:#{mac}」中,沒有顯示任何值。怎麼來的?
目前還不清楚究竟是你在你的問題問。你可以編輯它,並更具體? – mechanicalfish
嗨,我已經編輯了我的問題,可以請你看一看,看看它是否更有意義?謝謝。 – gugo
它的確如此,謝謝。我寫了一個答案。 – mechanicalfish