Korny Sietsma
2009-Apr-08 01:01 UTC
[rspec-users] [Cucumber] any examples of navigating cucumber parse tree from external script
Hi folks, I''m writing some scripts to integrate our cucumber features with stories stored in a wiki, and I''m hoping to use cucumber''s parser to parse the features rather than doing it manually. (I don''t really care about the feature contents much, just scenario titles and tags) I''ve worked out how to parse the features: Cucumber.load_language(''en'') features = Cucumber::Ast::Features.new parser = Cucumber::Parser::FeatureParser.new feature_files = Dir["#{FEATURE_DIR}/**/*.feature"] feature_files.each do |f| puts "parsing feature file #{f}" features.add_feature(parser.parse_file(f)) end But now I''m digging in to the whole ast visitor thing, and it''s getting quite complex to *do* stuff with the features once I''ve parsed them. I''m sure I can work this out myself, given time, but I was wondering if there are any code examples out there to save me some of the time/effort? Anyone else tried parsing features like this from outside Cucumber itself? Thanks! - Korny -- Kornelis Sietsma korny at my surname dot com "Every jumbled pile of person has a thinking part that wonders what the part that isn''t thinking isn''t thinking of" -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20090408/5a119e83/attachment.html>
Korny Sietsma
2009-Apr-08 06:24 UTC
[rspec-users] [Cucumber] any examples of navigating cucumber parse tree from external script
Hmm - on digging further, I might be better off writing a custom formatter as described at http://wiki.github.com/aslakhellesoy/cucumber/custom-formatters, and just invoking cucumber with --dry-run and my formatter... Though as I want to use the html formatter to format steps for insertion into the wiki, I''ve still got some work to do :) - korny On Wed, Apr 8, 2009 at 11:01 AM, Korny Sietsma <korny at sietsma.com> wrote:> Hi folks, > I''m writing some scripts to integrate our cucumber features with stories > stored in a wiki, and I''m hoping to use cucumber''s parser to parse the > features rather than doing it manually. (I don''t really care about the > feature contents much, just scenario titles and tags) > > I''ve worked out how to parse the features: > Cucumber.load_language(''en'') > features = Cucumber::Ast::Features.new > parser = Cucumber::Parser::FeatureParser.new > > feature_files = Dir["#{FEATURE_DIR}/**/*.feature"] > > feature_files.each do |f| > puts "parsing feature file #{f}" > features.add_feature(parser.parse_file(f)) > end > > But now I''m digging in to the whole ast visitor thing, and it''s getting > quite complex to *do* stuff with the features once I''ve parsed them. > > I''m sure I can work this out myself, given time, but I was wondering if > there are any code examples out there to save me some of the time/effort? > Anyone else tried parsing features like this from outside Cucumber itself? > > Thanks! > > - Korny > > -- > Kornelis Sietsma korny at my surname dot com > "Every jumbled pile of person has a thinking part > that wonders what the part that isn''t thinking > isn''t thinking of" >-- Kornelis Sietsma korny at my surname dot com "Every jumbled pile of person has a thinking part that wonders what the part that isn''t thinking isn''t thinking of" -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20090408/d8ff7ae0/attachment-0001.html>