Sha256: 609afcc601233584bc5cf736435a712272909d5b936e734ae613ad0ba570ed7b

Contents?: true

Size: 1.57 KB

Versions: 11

Compression:

Stored size: 1.57 KB

Contents

require 'albacore/albacoretask'
require 'albacore/config/specflowreportconfig'

class SpecFlowReport
  include Albacore::Task
  include Albacore::RunCommand
  include Configuration::SpecFlowReport
  
  attr_array :projects, :options, :report
  
  def initialize(command=nil, report=nil)
    @options=[]
    @projects =[]
    super()
    update_attributes specflowreport.to_hash
  	@command = command unless command.nil?
  	@report = report unless command.nil?
  end
  
  def get_command_line
    command_params = []
    command_params << @command
    command_params << get_command_parameters
    commandline = command_params.join(" ")
    @logger.debug "Build SpecFlow Command Line: " + commandline
    commandline
  end
  
  def get_projects
  	if @projects.empty? then
    	failure_message = "SpecFlow Expects at list one project file"
    	@logger.debug failure_message
    	fail_with_message failure_message
    else
    	@projects.map{|asm| "\"#{asm}\""}.join(' ')
    end
  end
  
  def get_options  	
  	if @options.empty? then
      "/xmlTestResult:TestResult.xml /out:specs.html"
    else
      @options.join(" ") 
    end
  end
  	
  def get_command_parameters
    command_params = []
    command_params << @report
    command_params << get_projects
    command_params << get_options
    command_params
  end
  
  def execute()
    command_params = get_command_parameters
    result = run_command "specflow.exe", command_params.join(" ")
    
    failure_message = 'SpecFlow Failed. See Build Log For Detail. ' +  command_params.join(" ")
    fail_with_message failure_message if !result
  end  
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
albacore-0.3.6 lib/albacore/specflowreport.rb
albacore-1.0.0.rc.2 lib/albacore/specflowreport.rb
albacore-1.0.0.rc.1 lib/albacore/specflowreport.rb
albacore-0.3.5 lib/albacore/specflowreport.rb
albacore-0.3.4 lib/albacore/specflowreport.rb
albacore-0.3.3 lib/albacore/specflowreport.rb
albacore-0.3.2 lib/albacore/specflowreport.rb
albacore-0.3.1 lib/albacore/specflowreport.rb
albacore-0.3.0 lib/albacore/specflowreport.rb
albacore-0.2.7 lib/albacore/specflowreport.rb
albacore-0.2.6 lib/albacore/specflowreport.rb