Class: NUnitTestRunner

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

Constant Summary collapse

TaskName =
:nunit

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 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) ⇒ NUnitTestRunner

Returns a new instance of NUnitTestRunner.



10
11
12
13
14
15
16
# File 'lib/albacore/nunittestrunner.rb', line 10

def initialize(command=nil)
  @options=[]
  @assemblies=[]
  super()
  update_attributes Albacore.configuration.nunit.to_hash
  @command = command unless command.nil?
end

Instance Method Details

#executeObject



34
35
36
37
38
39
40
# File 'lib/albacore/nunittestrunner.rb', line 34

def execute()
  command_params = get_command_parameters
  result = run_command "NUnit", command_params.join(" ")
  
  failure_message = 'NUnit Failed. See Build Log For Detail'
  fail_with_message failure_message if !result
end

#get_command_lineObject



18
19
20
21
22
23
24
25
# File 'lib/albacore/nunittestrunner.rb', line 18

def get_command_line
  command_params = []
  command_params << @command
  command_params << get_command_parameters
  commandline = command_params.join(" ")
  @logger.debug "Build NUnit Test Runner Command Line: " + commandline
  commandline
end

#get_command_parametersObject



27
28
29
30
31
32
# File 'lib/albacore/nunittestrunner.rb', line 27

def get_command_parameters
  command_params = []
  command_params << @options.join(" ") unless @options.nil?
  command_params << @assemblies.map{|asm| "\"#{asm}\""}.join(' ') unless @assemblies.nil?
  command_params
end