Sha256: a9ce41fc74077322436d5b39be9429a55d3b495f51504764852840f8c50f7d49

Contents?: true

Size: 1.92 KB

Versions: 42

Compression:

Stored size: 1.92 KB

Contents

require 'rake'
require 'fwtoolkit/rake/ext/rake'

require 'fwtoolkit/rake/tasks/config'
require 'fwtoolkit/projectfile'
require 'cucumber/rake/task'

module FWToolkit
  module Rake
    class TestTask < ::Rake::Task
      include ::Rake::DSL if defined?(::Rake::DSL)
      include Config
      def initialize(&block)
        yield self if block_given?
        define_task
      end


      private

      def define_task
        namespace :test do

          tasklib = Cucumber::Rake::Task.new(:frank, 'Run Frank acceptance tests')
          task = ::Rake::Task['test:frank'] 
          task.set_arg_names [:tags, :cucumber_options, :sim_launcher]
          task.enhance_r do |t, args|
            Projectfile.load! projectfile_path
            args.with_defaults(:tags => '~@wip', :cucumber_options => '', :sim_launcher => nil)
            ENV['APP_BUNDLE_PATH'] = File.join Dir.pwd, Projectfile.frankified_app
            ENV['USE_SIM_LAUNCHER_SERVER'] = nil || args[:sim_launcher]
            tasklib.cucumber_opts = "#{Projectfile.frank_root}/Features --tags=\"#{args[:tags]}\" #{args[:cucumber_options]}"
          end
        end

        namespace :test do

          desc 'Build the frankified App'
          task :build do
            Projectfile.load! projectfile_path
            `frank build --workspace #{Projectfile.xcode_workspace} --scheme #{Projectfile.xcode_scheme}`
          end

          namespace :ci do
            desc 'Run Frank acceptance tests with CI options'
            task :frank, :tags do |t, args|
              Projectfile.load! projectfile_path

              artifacts_dir = ENV['CC_BUILD_ARTIFACTS'] || '/tmp'
              cucumber_options = "--format pretty --format html --out '#{artifacts_dir}/frank_results.html' --format rerun --out '#{artifacts_dir}/frank_rerun.txt'"
              ::Rake::Task['test:frank'].invoke args[:tags], cucumber_options, 'yes'

            end
          end
        end
      end
    end
  end
end

Version data entries

42 entries across 42 versions & 1 rubygems

Version Path
fwtoolkit-2.6.4 lib/fwtoolkit/rake/tasks/test.rb
fwtoolkit-2.6.3 lib/fwtoolkit/rake/tasks/test.rb
fwtoolkit-2.6.2 lib/fwtoolkit/rake/tasks/test.rb
fwtoolkit-2.6.1 lib/fwtoolkit/rake/tasks/test.rb
fwtoolkit-2.6.0 lib/fwtoolkit/rake/tasks/test.rb
fwtoolkit-2.5.0 lib/fwtoolkit/rake/tasks/test.rb
fwtoolkit-2.4.0 lib/fwtoolkit/rake/tasks/test.rb
fwtoolkit-2.3.6 lib/fwtoolkit/rake/tasks/test.rb
fwtoolkit-2.3.5 lib/fwtoolkit/rake/tasks/test.rb
fwtoolkit-2.3.4 lib/fwtoolkit/rake/tasks/test.rb
fwtoolkit-2.3.3 lib/fwtoolkit/rake/tasks/test.rb
fwtoolkit-2.3.2 lib/fwtoolkit/rake/tasks/test.rb
fwtoolkit-2.3.1 lib/fwtoolkit/rake/tasks/test.rb
fwtoolkit-2.3.0 lib/fwtoolkit/rake/tasks/test.rb
fwtoolkit-2.2.4 lib/fwtoolkit/rake/tasks/test.rb
fwtoolkit-2.2.3 lib/fwtoolkit/rake/tasks/test.rb
fwtoolkit-2.2.2 lib/fwtoolkit/rake/tasks/test.rb
fwtoolkit-2.2.1 lib/fwtoolkit/rake/tasks/test.rb
fwtoolkit-2.2.0 lib/fwtoolkit/rake/tasks/test.rb
fwtoolkit-2.1.10 lib/fwtoolkit/rake/tasks/test.rb