Class: RakeDotNet::XUnitConsoleCmd

Inherits:
Object
  • Object
show all
Defined in:
lib/rake_dotnet.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(test_dll, reports_dir, xunit = nil, options = {}) ⇒ XUnitConsoleCmd

Returns a new instance of XUnitConsoleCmd.



1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
# File 'lib/rake_dotnet.rb', line 1280

def initialize(test_dll, reports_dir, xunit=nil, options={})
	x86exe = File.join(TOOLS_DIR, 'xunit', 'xunit.console.x86.exe')
	x64exe = File.join(TOOLS_DIR, 'xunit', 'xunit.console.exe')
	path_to_xunit = x64exe
	if File.exist? x86exe
		path_to_xunit = x86exe
	end
	@xunit = xunit || path_to_xunit
	@xunit = File.expand_path(@xunit)
	@test_dll = File.expand_path(test_dll)
	@reports_dir = File.expand_path(reports_dir)
	@options = options
end

Instance Attribute Details

#optionsObject

Returns the value of attribute options.



1278
1279
1280
# File 'lib/rake_dotnet.rb', line 1278

def options
  @options
end

#reports_dirObject

Returns the value of attribute reports_dir.



1278
1279
1280
# File 'lib/rake_dotnet.rb', line 1278

def reports_dir
  @reports_dir
end

#test_dllObject

Returns the value of attribute test_dll.



1278
1279
1280
# File 'lib/rake_dotnet.rb', line 1278

def test_dll
  @test_dll
end

#xunitObject

Returns the value of attribute xunit.



1278
1279
1280
# File 'lib/rake_dotnet.rb', line 1278

def xunit
  @xunit
end

Instance Method Details

#cmdObject



1302
1303
1304
# File 'lib/rake_dotnet.rb', line 1302

def cmd
	cmd = "#{exe} #{test_dll} #{html} #{xml} #{nunit} #{wait} #{noshadow} #{teamcity}"
end

#exeObject



1306
1307
1308
# File 'lib/rake_dotnet.rb', line 1306

def exe
	"\"#{@xunit}\""
end

#htmlObject



1318
1319
1320
1321
# File 'lib/rake_dotnet.rb', line 1318

def html
	path = "#{@reports_dir}/#{suite}.test-results.html".gsub('/', '\\')
	"/html \"#{path}\"" if @options.has_key?(:html)
end

#noshadowObject



1337
1338
1339
# File 'lib/rake_dotnet.rb', line 1337

def noshadow
	'/noshadow' if @options.has_key?(:noshadow)
end

#nunitObject



1328
1329
1330
1331
# File 'lib/rake_dotnet.rb', line 1328

def nunit
	path = "#{@reports_dir}/#{suite}.test-results.nunit.xml".gsub('/', '\\')
	"/nunit \"#{path}\"" if @options.has_key?(:nunit)
end

#runObject



1294
1295
1296
1297
1298
1299
1300
# File 'lib/rake_dotnet.rb', line 1294

def run
	test_dir = Pathname.new(test_dll).dirname
	chdir test_dir do
		puts cmd if VERBOSE
		sh cmd
	end
end

#suiteObject



1310
1311
1312
# File 'lib/rake_dotnet.rb', line 1310

def suite
	@test_dll.match(/.*\/([\w\.]+)\.dll/)[1]
end

#teamcityObject



1341
1342
1343
# File 'lib/rake_dotnet.rb', line 1341

def teamcity
	'/teamcity' if @options.has_key?(:teamcity)
end

#waitObject



1333
1334
1335
# File 'lib/rake_dotnet.rb', line 1333

def wait
	'/wait' if @options.has_key?(:wait)
end

#xmlObject



1323
1324
1325
1326
# File 'lib/rake_dotnet.rb', line 1323

def xml
	path = "#{@reports_dir}/#{suite}.test-results.xml".gsub('/', '\\')
	"/xml \"#{path}\"" if @options.has_key?(:xml)
end