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


 


















 

1 comment:

  1. Best place to learn Appium Android IOS Automation Testing Training in Chennai
    Go for Appium training in chennai for real time mobile automation testing training with real time project support.
    UI Automation Tools with real time scenarios You can contact 8122241286 for Best APPIUM and selenium Training in Chennai

    ReplyDelete