Skip to content

Loading PKG Features and Lib Files

vicwin edited this page Mar 6, 2012 · 9 revisions

This feature enable us to reuse features files and ruby lib files that’s already written for sharing usage. The pkg Features should be written in a way that’s project agnostics so they can be easily call and reuse by the other projects. The locale.yml file in the pkg location will also be used as the default translation dictionary. It is not completely process or thread safe. we will improve this in the near future.
Follow these steps to enable this feature:

  • Package your shared features and steps in the following format:

    <pkg dir> ./features ./lib ./etc ./<other dir>
  • You can compress the folder using ZIP to generate a .zip file or reference it by the absolute path name
  • Set up the config in the project_init.rb file in your project
    Example:
    ENV["WARDEN_PKG_FEATURES_LIB_PATH"] = "/Users/victor/work/warden_fw/projects/BuyingGuide"
    or
    ENV["WARDEN_PKG_FEATURES_LIB_PATH"] = "/Users/victor/work/warden_fw/lib/bg.zip"
  • You should see additional loading information when you run cucumber ./features in your project dir
    
    Using feature file from pkg: /tmp/gerbil/BuyingGuide_7084/features/BuyNowLinks.feature
    Using feature file from pkg: /tmp/gerbil/BuyingGuide_7084/features/BuyNowLinksDemo.feature
    Using feature file from pkg: /tmp/gerbil/BuyingGuide_7084/features/Compare.feature
    Using feature file from pkg: /tmp/gerbil/BuyingGuide_7084/features/Dealzone.feature
    ...
    Loading /tmp/gerbil/BuyingGuide_7084/features/backbutton_verification.rb: true
    Loading /tmp/gerbil/BuyingGuide_7084/features/BuyNowLinks.rb: true
    Loading /tmp/gerbil/BuyingGuide_7084/features/Compare.rb: true
    Loading /tmp/gerbil/BuyingGuide_7084/features/Email.rb: true
    ...
    
  • You can now run feature file that’s not in your ./features/ path in the way that acts like they are :) cucumber ./feature/<pkg file>.feature
  • Your are good to go! if you have file that has the same path name under your project “features” dir, they will be loaded instead.