Class: FubuRake::NUnit

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

Class Method Summary collapse

Class Method Details

.create_task(tasks, options) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/nunit.rb', line 4

def self.create_task(tasks, options)
	nunitTask = nil

	tests = Array.new

	if options[:unit_test_projects].any?
		tests = options[:unit_test_projects]
	elsif options[:unit_test_list_file] != nil and File::exists?(options[:unit_test_list_file])
		file = options[:unit_test_list_file]

		tests = NUnitRunner.readFromFile(file)

	else
		# just find testing projects
		Dir.glob('**/*.{Testing,Tests}.csproj').each do |f|
			 test = File.basename(f, ".csproj")
			 tests.push test
		end	
	end

	if !tests.empty?
		nunitTask = Rake::Task.define_task :unit_test do
			runner = NUnitRunner.new options
			runner.executeTests tests
		end

		nunitTask.enhance [:compile]
		nunitTask.add_description "Runs unit tests for " + tests.join(', ')
	end

	if tasks.integration_test != nil
		integrationTask = Rake::Task.define_task :integration_test do
			runner = NUnitRunner.new options
			runner.executeTests tasks.integration_test
		end

		integrationTask.enhance [:compile]
		integrationTask.add_description "integration tests: #{tasks.integration_test.join(', ')}"
	end
end