Thursday 9 May 2013

calabash-ios: reusing step definitions using macros

This post is intended to explain how to reuse step definitions in calabash

Lets see with an example with a feature file

  Scenario Outline: I am able to test macro
    Given 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