Class: SpecFlowReport

Inherits:
Object
  • Object
show all
Includes:
Albacore::RunCommand, Albacore::Task, Configuration::SpecFlowReport
Defined in:
lib/albacore/specflowreport.rb

Instance Attribute Summary

Attributes included from Albacore::RunCommand

#command, #working_directory

Attributes included from Logging

#current_log_device, #logger

Instance Method Summary collapse

Methods included from Configuration::SpecFlowReport

included, #specflowreport, specflowreportconfig

Methods included from Albacore::Configuration

included

Methods included from Albacore::RunCommand

#get_command, #run_command

Methods included from AttrMethods

#attr_array, #attr_hash

Methods included from Albacore::Task

clean_dirname, create_rake_task, include_config, included

Methods included from UpdateAttributes

#<<, #update_attributes

Methods included from YAMLConfig

#configure, #load_config_by_task_name

Methods included from Logging

#create_logger, #log_device=, #log_level, #log_level=

Methods included from Failure

#fail_with_message

Constructor Details

#initialize(command = nil, report = nil) ⇒ SpecFlowReport

Returns a new instance of SpecFlowReport.



11
12
13
14
15
16
17
18
# File 'lib/albacore/specflowreport.rb', line 11

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

Instance Method Details

#executeObject



55
56
57
58
59
60
61
# File 'lib/albacore/specflowreport.rb', line 55

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

#get_command_lineObject



20
21
22
23
24
25
26
27
# File 'lib/albacore/specflowreport.rb', line 20

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

#get_command_parametersObject



47
48
49
50
51
52
53
# File 'lib/albacore/specflowreport.rb', line 47

def get_command_parameters
  command_params = []
  command_params << @report
  command_params << get_projects
  command_params << get_options
  command_params
end

#get_optionsObject



39
40
41
42
43
44
45
# File 'lib/albacore/specflowreport.rb', line 39

def get_options  	
	if @options.empty? then
    "/xmlTestResult:TestResult.xml /out:specs.html"
  else
    @options.join(" ") 
  end
end

#get_projectsObject



29
30
31
32
33
34
35
36
37
# File 'lib/albacore/specflowreport.rb', line 29

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