class BradyW::Nunit
Constants
- PROGRAM_FILES_DIR
Attributes
Optional Should :x86 or :anycpu archiecture be used? Default is :anycpu
Optional Where should test errors be stored? Default is console
Required Files/assemblies to test
Optional What version of the .NET framework to use for the tests? :v2_0, :v3_5, :v4_0, :v4_5, defaults to :v4_5
Optional Should labels be printed in the test output, default is :include_labels, can also say :exclude_labels
Optional Where should test output be stored? Default is console
Optional Full path of nunit-console.exe, defaults to C:Program Files (x86)NUnit ${version}binnunit-console.exe
Optional Which tests should be run (specify namespace+class), can be multiple, defaults to all in class
Optional Timeout for each test case in milliseconds, by default the timeout is 35 seconds
Optional Version of NUnit in use, defaults to 2.6.2
Optional Should XML be outputted? By default the answer is no, but set this to :enabled if you want XML output
Private Instance Methods
# 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
# File lib/nunit.rb 49 def executable 50 arch == :anycpu ? "nunit-console.exe" : "nunit-console-x86.exe" 51 end
# 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
# File lib/nunit.rb 81 def labels_flat 82 labels == :include_labels ? " /labels" : "" 83 end
# 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
# File lib/nunit.rb 57 def xml_output_flat 58 xml_output == :disabled ? " /noxml " : " " 59 end