Sha256: 4a5ef30dafcd9aba6fb758120d890424ef8abc8e798e74a42465e37608795c50

Contents?: true

Size: 1.06 KB

Versions: 6

Compression:

Stored size: 1.06 KB

Contents

require_relative('./commandarray.rb')

class Test < CommandArray

  def update
    # rspec tests, 'rspec --pattern="**/*.spec"'
	if(Dir.glob("**/*spec.rb").length > 0)
	  self.add 'rspec'
	end
	# nunit tests, 'nunit-console.exe "C::\\Projects\\MyProjects\\bin\\Release\\MyLib.Test.dll"'
	if File.exist? Test.nunit_console
	  Dir.glob("*.csproj").each{|p|
	    text = File.read(p)
		if(text.include?("nunit.framework.dll"))
		  # extract AssemblyName of form:  <AssemblyName>MyLibrary.Test</AssemblyName>
		  assemblyName=text[/<AssemblyName>([\w\.]+)</,1]
		  outputPath=text[/Release[.\w\W]+<OutputPath>([\w\.\\]+)</,1]
		  if(!assemblyName.nil? && !outputPath.nil?)
			nunit_dll = "#{Rake.application.original_dir}\\#{outputPath}\\#{assemblyName}.dll".gsub("\\\\","\\").gsub('/','\\')
			#puts "nunit_dll: " + nunit_dll
			self.add "\"#{Test.nunit_console}\" \"#{nunit_dll}\" /xml:\"#{nunit_dll}.TestResults.xml\""
		  end
		end
	  }
	end
  end

  def self.nunit_console
    "C:\\Program Files (x86)\\NUnit 2.6.3\\bin\\nunit-console.exe"
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
dev_tasks-0.0.161 lib/test.rb
dev_tasks-0.0.160 lib/test.rb
dev_tasks-0.0.159 lib/test.rb
dev_tasks-0.0.158 lib/test.rb
dev_tasks-0.0.157 lib/test.rb
dev_tasks-0.0.156 lib/test.rb