class BradyW::Nunit

Constants

PROGRAM_FILES_DIR

Attributes

arch[RW]

Optional Should :x86 or :anycpu archiecture be used? Default is :anycpu

errors[RW]

Optional Where should test errors be stored? Default is console

files[RW]

Required Files/assemblies to test

framework_version[RW]

Optional What version of the .NET framework to use for the tests? :v2_0, :v3_5, :v4_0, :v4_5, defaults to :v4_5

labels[RW]

Optional Should labels be printed in the test output, default is :include_labels, can also say :exclude_labels

output[RW]

Optional Where should test output be stored? Default is console

path[RW]

Optional Full path of nunit-console.exe, defaults to C:Program Files (x86)NUnit ${version}binnunit-console.exe

tests[RW]

Optional Which tests should be run (specify namespace+class), can be multiple, defaults to all in class

timeout[RW]

Optional Timeout for each test case in milliseconds, by default the timeout is 35 seconds

version[RW]

Optional Version of NUnit in use, defaults to 2.6.2

xml_output[RW]

Optional Should XML be outputted? By default the answer is no, but set this to :enabled if you want XML output

Private Instance Methods

exectask() click to toggle source
   # File lib/nunit.rb
44 def exectask
45   assemblies = files.uniq.join(" ")
46   shell "\"#{full_path}\"#{output}#{errors}#{labels_flat}#{xml_output_flat}/framework=#{framework_version} /timeout=#{timeout}#{testsparam}#{assemblies}"
47 end
executable() click to toggle source
   # File lib/nunit.rb
49 def executable
50   arch == :anycpu ? "nunit-console.exe" : "nunit-console-x86.exe"
51 end
full_path() click to toggle source
    # File lib/nunit.rb
 95 def full_path
 96   possibleDirectories = ["NUnit #{version}","NUnit-#{version}"]
 97   candidates = @path ? [@path] : possibleDirectories.map {|p| File.join(PROGRAM_FILES_DIR,p,"bin",executable) }
 98   found = candidates.detect {|c| File.exists? c}
 99   return found if found
100   raise "We checked the following locations and could not find nunit-console.exe #{candidates}"
101 end
labels_flat() click to toggle source
   # File lib/nunit.rb
81 def labels_flat
82   labels == :include_labels ? " /labels" : ""
83 end
testsparam() click to toggle source
   # File lib/nunit.rb
85 def testsparam
86   return " " unless @tests
87   flat = @tests.is_a?(Array) ? @tests.join(",") : @tests
88   " /run=#{flat} "
89 end
xml_output_flat() click to toggle source
   # File lib/nunit.rb
57 def xml_output_flat
58   xml_output == :disabled ? " /noxml " : " "
59 end