Class: FubuRake::NUnitRunner
Class Method Summary collapse
Instance Method Summary collapse
- #executeTests(assemblies) ⇒ Object
- #executeTestsInFile(file) ⇒ Object
-
#initialize(paths) ⇒ NUnitRunner
constructor
A new instance of NUnitRunner.
Constructor Details
#initialize(paths) ⇒ NUnitRunner
Returns a new instance of NUnitRunner.
51 52 53 54 55 56 57 58 |
# File 'lib/nunit.rb', line 51 def initialize(paths) @sourceDir = paths.fetch(:source, 'src') @resultsDir = paths.fetch(:results, 'results') @compilePlatform = paths.fetch(:platform, '') @compileTarget = paths.fetch(:compilemode, 'debug') @clrversion = paths.fetch(:clrversion, 'v4.0.30319') @nunitExe = Nuget.tool("NUnit", "nunit-console#{(@compilePlatform.empty? ? '' : "-#{@compilePlatform}")}.exe") + Platform.switch("nothread") end |
Class Method Details
.readFromFile(file) ⇒ Object
70 71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/nunit.rb', line 70 def self.readFromFile(file) tests = Array.new file = File.new(file, "r") assemblies = file.readlines() assemblies.each do |a| test = a.gsub("\r\n", "").gsub("\n", "") tests.push(test) end file.close return tests end |
Instance Method Details
#executeTests(assemblies) ⇒ Object
60 61 62 63 64 65 66 67 68 |
# File 'lib/nunit.rb', line 60 def executeTests(assemblies) Dir.mkdir @resultsDir unless exists?(@resultsDir) assemblies.each do |assem| file = File.("#{@sourceDir}/#{assem}/bin/#{@compilePlatform.empty? ? '' : @compilePlatform + '/'}#{@compileTarget}/#{assem}.dll") puts "The platform is #{@compilePlatform}" sh Platform.runtime("#{@nunitExe} -noshadow -xml=#{@resultsDir}/#{assem}-TestResults.xml \"#{file}\"", @clrversion) end end |
#executeTestsInFile(file) ⇒ Object
84 85 86 87 88 89 90 91 92 93 94 |
# File 'lib/nunit.rb', line 84 def executeTestsInFile(file) if !File.exist?(file) throw "File #{file} does not exist" end tests = readFromFile(file) if (!tests.empty?) executeTests tests end end |