Sha256: b4bb572e577a418b7a518b17db8fc18007236c5f7439b64809570684833a922f

Contents?: true

Size: 1.66 KB

Versions: 3

Compression:

Stored size: 1.66 KB

Contents

#!/usr/bin/env ruby


require 'thor'
require 'cuke_cataloger'


class CLI < Thor

  desc 'catalog_test_cases', 'Catalog the test cases in LOCATION with an id based on PREFIX'
  option :location, :default => '.'
  option :prefix, :default => '@test_case_'
  option :row_id, :type => :boolean, :default => true
  option :id_column_name, :default => 'test_case_id'

  def catalog_test_cases
    puts "Tagging tests in '#{options[:location]}' with tag '#{options[:prefix]}'\n"
    puts "Including outline rows\n" if options[:row_id]

    tagger = CukeCataloger::UniqueTestCaseTagger.new
    tagger.tag_tests(options[:location], options[:prefix], {}, options[:row_id], options[:id_column_name])
  end

  desc 'validate_test_cases', 'Validate the test cases in LOCATION with an id based on PREFIX. Will output the report to FILE, if provided.'
  option :location, :default => '.'
  option :prefix, :default => '@test_case_'
  option :row_id, :type => :boolean, :default => true
  option :id_column_name, :default => 'test_case_id'
  option :file

  def validate_test_cases
    puts "Validating tests in '#{options[:location]}' with tag '#{options[:prefix]}'\n"
    puts "Including outline rows\n" if options[:row_id]

    results = CukeCataloger::UniqueTestCaseTagger.new.validate_test_ids(options[:location], options[:prefix], options[:row_id], options[:id_column_name])
    report_text = CukeCataloger::TextReportFormatter.new.format_data(results)

    if options[:file]
      puts "Problems found: #{results.count}"
      File.open(options[:file], 'w') { |file| file.write(report_text) }
    else
      puts report_text
    end
  end

end


CLI.start(ARGV)

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
cuke_cataloger-1.6.0 bin/cuke_cataloger
cuke_cataloger-1.5.0 bin/cuke_cataloger
cuke_cataloger-1.4.1 bin/cuke_cataloger