2014-05-06 00:35:07 -07:00
|
|
|
require 'albacore'
|
|
|
|
|
2014-05-06 04:18:06 -07:00
|
|
|
CONFIG = ENV['CONFIG'] || 'Debug'
|
2014-05-06 00:35:07 -07:00
|
|
|
|
2014-05-06 04:18:06 -07:00
|
|
|
NUNIT_TOOLS = Dir['packages/NUnit.Runners.*/tools'].first
|
|
|
|
NUNIT_CONSOLE = File.join(NUNIT_TOOLS, 'nunit-console.exe')
|
|
|
|
NUNIT_EXE = File.join(NUNIT_TOOLS, 'nunit.exe')
|
|
|
|
|
|
|
|
OPENCOVER_CONSOLE = Dir['packages/OpenCover.*/OpenCover.Console.exe'].first
|
|
|
|
REPORT_GENERATOR = Dir['packages/ReportGenerator*/ReportGenerator.exe'].first
|
|
|
|
|
|
|
|
UNIT_TESTS_DLL = "StyletUnitTests/bin/#{CONFIG}/StyletUnitTests.dll"
|
2014-05-06 00:35:07 -07:00
|
|
|
|
2014-05-06 04:18:06 -07:00
|
|
|
COVERAGE_DIR = 'Coverage'
|
2014-05-06 05:11:51 -07:00
|
|
|
COVERAGE_FILE = File.join(COVERAGE_DIR, 'coverage.xml')
|
2014-05-06 04:18:06 -07:00
|
|
|
|
|
|
|
desc "Build Stylet.sln using the current CONFIG (or Debug)"
|
|
|
|
build :build do |b|
|
|
|
|
b.sln = "Stylet.sln"
|
|
|
|
b.target = [:Build]
|
|
|
|
b.prop 'Configuration', CONFIG
|
2014-05-06 00:35:07 -07:00
|
|
|
end
|
|
|
|
|
2014-05-06 05:11:51 -07:00
|
|
|
test_runner :nunit_test_runner => [:build] do |t|
|
2014-05-06 04:18:06 -07:00
|
|
|
t.exe = NUNIT_CONSOLE
|
|
|
|
t.files = [UNIT_TESTS_DLL]
|
|
|
|
t.add_parameter '/nologo'
|
2014-05-06 00:35:07 -07:00
|
|
|
end
|
|
|
|
|
2014-05-06 05:11:51 -07:00
|
|
|
desc "Run unit tests using the current CONFIG (or Debug)"
|
|
|
|
task :test => [:nunit_test_runner] do |t|
|
|
|
|
rm 'TestResult.xml'
|
|
|
|
end
|
|
|
|
|
2014-05-06 04:18:06 -07:00
|
|
|
desc "Launch the NUnit gui pointing at the correct DLL for CONFIG (or Debug)"
|
|
|
|
task :nunit do |t|
|
|
|
|
sh NUNIT_EXE, UNIT_TESTS_DLL
|
|
|
|
end
|
2014-05-06 00:35:07 -07:00
|
|
|
|
2014-05-06 04:18:06 -07:00
|
|
|
desc "Generate code coverage reports for CONFIG (or Debug)"
|
|
|
|
task :cover => [:build] do |t|
|
2014-05-06 05:11:51 -07:00
|
|
|
sh OPENCOVER_CONSOLE, %Q{-register:user -target:"#{NUNIT_CONSOLE}" -filter:+[Stylet]* -targetargs:"#{UNIT_TESTS_DLL} /noshadow" -output:"#{COVERAGE_FILE}"}
|
|
|
|
sh REPORT_GENERATOR, %Q{-reports:"#{COVERAGE_FILE}" -targetdir:"#{COVERAGE_DIR}"}
|
2014-05-06 04:18:06 -07:00
|
|
|
end
|
2014-05-06 00:35:07 -07:00
|
|
|
|