Skip to content

Commit e57556d

Browse files
committed
Update coverage to use nunit3 runner
1 parent 9facd16 commit e57556d

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

Rakefile

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,24 +42,23 @@ task :build do
4242
end
4343

4444
task :test_environment do
45-
NUNIT_TOOLS = 'src/packages/NUnit.Runners.*/tools'
46-
NUNIT_CONSOLE = Dir[File.join(NUNIT_TOOLS, 'nunit-console.exe')].first
47-
NUNIT_EXE = Dir[File.join(NUNIT_TOOLS, 'nunit.exe')].first
45+
NUNIT_TOOLS = 'src/packages/NUnit.ConsoleRunner.*/tools'
46+
NUNIT_CONSOLE = Dir[File.join(NUNIT_TOOLS, 'nunit3-console.exe')].first
4847

4948
OPENCOVER_CONSOLE = Dir['src/packages/OpenCover.*/tools/OpenCover.Console.exe'].first
5049
REPORT_GENERATOR = Dir['src/packages/ReportGenerator.*/tools/ReportGenerator.exe'].first
5150

5251
UNIT_TESTS_DLL = "bin/#{CONFIG}/StateMechanicUnitTests.dll"
5352

54-
raise "NUnit.Runners not found. Restore NuGet packages" unless NUNIT_CONSOLE && NUNIT_EXE
53+
raise "NUnit.ConsoleRunner not found. Restore NuGet packages" unless NUNIT_CONSOLE
5554
raise "OpenCover not found. Restore NuGet packages" unless OPENCOVER_CONSOLE
5655
raise "ReportGenerator not found. Restore NuGet packages" unless REPORT_GENERATOR
5756
end
5857

5958
desc "Generate unit test code coverage reports for CONFIG (or Debug)"
6059
task :cover => [:test_environment, COVERAGE_DIR] do
6160
coverage_file = File.join(COVERAGE_DIR, File.basename(UNIT_TESTS_DLL).ext('xml'))
62-
sh %Q{#{OPENCOVER_CONSOLE} -register:user -target:"#{NUNIT_CONSOLE}" -targetargs:"#{UNIT_TESTS_DLL} /noshadow" -filter:"+[StateMechanic]*" -excludebyattribute:*.ExcludeFromCoverageAttribute -output:"#{coverage_file}"}
61+
sh %Q{#{OPENCOVER_CONSOLE} -register:user -target:"#{NUNIT_CONSOLE}" -targetargs:"#{UNIT_TESTS_DLL}" -filter:"+[StateMechanic]*" -excludebyattribute:*.ExcludeFromCoverageAttribute -output:"#{coverage_file}"}
6362

6463
rm('TestResult.xml', :force => true)
6564

0 commit comments

Comments
 (0)