Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
#!/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
foo bar baz
apple banana strawberry
dog cat monkey
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>>|
@Radhakrishna-N

msassak : How can use this in my step definition , can you please give some guidance , it looks good

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.