Created
December 14, 2010 14:44
-
-
Save msassak/740509 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'csv' | |
class Converter | |
def initialize(feature) | |
@feature = feature | |
end | |
def to_gherkin | |
@feature.gsub!(/\|<<([\w\.]+)>>\|/) do |match| | |
rows = CSV.read($1).to_a | |
rows.inject('') do |output, row| | |
output << "| " << row.join(" |") << " |\n" | |
end | |
end | |
@feature | |
end | |
end | |
puts Converter.new(File.read(ARGV[0])).to_gherkin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
foo | bar | baz | |
---|---|---|---|
apple | banana | strawberry | |
dog | cat | monkey |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Feature: My Feature | |
Scenario Outline: My scenario outline | |
Given <foo> | |
When <bar> | |
Then <baz> | |
Examples: Right here | |
| foo | bar | baz | | |
| aaa | bbb | ccc | | |
| 111 | 222 | 333 | | |
Examples: From elsewhere | |
|<<my_data.csv>>| |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
msassak : How can use this in my step definition , can you please give some guidance , it looks good