Class: NUnitRunner
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.
40 41 42 43 44 45 46 47 |
# File 'lib/nunit.rb', line 40 def initialize(paths) @sourceDir = paths.fetch(:source, 'src') @resultsDir = paths.fetch(:results, 'results') @compilePlatform = paths.fetch(:platform, 'x86') @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 |
Instance Method Details
#executeTests(assemblies) ⇒ Object
49 50 51 52 53 54 55 56 |
# File 'lib/nunit.rb', line 49 def executeTests(assemblies) Dir.mkdir @resultsDir unless exists?(@resultsDir) assemblies.each do |assem| file = File.("#{@sourceDir}/#{assem}/bin/#{@compileTarget}/#{assem}.dll") sh Platform.runtime("#{@nunitExe} -xml=#{@resultsDir}/#{assem}-TestResults.xml \"#{file}\"", @clrversion) end end |
#executeTestsInFile(file) ⇒ Object
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/nunit.rb', line 58 def executeTestsInFile(file) if !File.exist?(file) throw "File #{file} does not exist" end 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 if (!tests.empty?) executeTests tests end end |