0

I am utilizing the "shoes" tool to create a window with a button in the middle. I would like the user to be able click the button and then the program runs a Cucumber feature file, but I don't know how to run a feature file from within a class or if its possible. Very new at this so any advice is appreciated. Let me know if more information is necessary.

Trev
  • 13
  • 4

2 Answers2

1

Try something like

Shoes.app do
  @s = stack {}

  button "Run Cucumber" do
    @out = `cucumber`
    @s.clear { para @out }
  end
end
Bala
  • 11,068
  • 19
  • 67
  • 120
0

From the cucumber documentation you just run it as any other rake task from within your app:

require 'rubygems'
require 'cucumber/rake/task'

Cucumber::Rake::Task.new(:features) do |t|
  t.cucumber_opts = "--format pretty" # Any valid command line option can go here.
end

you then just need to put it into a shoes window like so:

require 'rubygems'
require 'cucumber/rake/task'
require 'shoes'

Shoes.app {
  @push = button "Run Features"
  @note = para "Haven't run features"
  @push.click {
    result = Cucumber::Rake::Task.new(:features) do |t|
      t.cucumber_opts = "--format pretty" # Any valid command line option can go here.
    end
    @note.replace result
  }
}

or something like that, I haven't actually tested this but look at the outputs and read the documentation and you'll be fine.

Mike H-R
  • 7,726
  • 5
  • 43
  • 65