This post is intended to explain how to reuse step definitions in calabash
Given I want to test macro
Then I have macro "hello"
Examples:
| filename |
| hello |
Call the second step definition here
Given(/^I want to test macro$/) do
var="test string"
macro 'I have macro "'+var+'"'
end
This step can be used as macro in other step definitions
Then(/^I have macro "(.*?)"$/) do |arg1|
puts arg1
end
Lets see with an example with a feature file
Scenario Outline: I am able to test macroGiven I want to test macro
Then I have macro "hello"
Examples:
| filename |
| hello |
Step definitions file
Call the second step definition here
Given(/^I want to test macro$/) do
var="test string"
macro 'I have macro "'+var+'"'
end
This step can be used as macro in other step definitions
Then(/^I have macro "(.*?)"$/) do |arg1|
puts arg1
end
No comments:
Post a Comment