Class: Test
Constant Summary
collapse
- @@nunit_console =
""
- @@nunit_console_x86 =
""
Instance Attribute Summary
Attributes inherited from Array
#env
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Array
#add, #add_passive, #add_quiet, #execute, #has_command?, #initialize, #log_debug_info, #to_html
Constructor Details
This class inherits a constructor from Array
Class Method Details
.nunit3_console_in_path? ⇒ Boolean
60
61
62
63
64
65
66
67
68
|
# File 'lib/tasks/test.rb', line 60
def self.nunit3_console_in_path?
command = Command.new("nunit3-console")
command[:quiet] = true
command[:ignore_failure] = true
command.execute
return true if (command[:exit_code]).zero?
false
end
|
.nunit_console ⇒ Object
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
|
# File 'lib/tasks/test.rb', line 80
def self.nunit_console
return "nunit3-console" if Test.nunit3_console_in_path?
return "nunit-console" if Test.nunit_console_in_path?
unless File.exist?(@@nunit_console)
@@nunit_console = NUNIT_CONSOLE if defined?(NUNIT_CONSOLE)
unless File.exist?(@@nunit_console)
@@nunit_console = "packages/NUnit.ConsoleRunner.3.7.0/tools/nunit3-console.exe"
end
unless File.exist?(@@nunit_console)
@@nunit_console = "packages/NUnit.ConsoleRunner.3.8.0/tools/nunit3-console.exe"
end
unless File.exist?(@@nunit_console)
@@nunit_console = 'C:\\Program Files (x86)\\NUnit.org\\nunit-console\\nunit3-console.exe'
end
unless File.exist?(@@nunit_console)
@@nunit_console = 'C:\\Program Files (x86)\\NUnit 2.6.4\\bin\\nunit-console.exe'
end
unless File.exist?(@@nunit_console)
@@nunit_console = 'C:\\Program Files (x86)\\NUnit 2.6.3\\bin\\nunit-console.exe'
end
Dir.glob("**/nunit3-console.exe") { |n| @@nunit_console = n } unless File.exist?(@@nunit_console)
end
unless File.exist?(@@nunit_console)
raise "unable to locate nunit-console.exe, assign NUNIT_CONSOLE to the correct location."
end
@@nunit_console
end
|
.nunit_console_in_path? ⇒ Boolean
70
71
72
73
74
75
76
77
78
|
# File 'lib/tasks/test.rb', line 70
def self.nunit_console_in_path?
command = Command.new("nunit-console")
command[:quiet] = true
command[:ignore_failure] = true
command.execute
return true if (command[:exit_code]).zero?
false
end
|
.nunit_console_x86 ⇒ Object
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
|
# File 'lib/tasks/test.rb', line 111
def self.nunit_console_x86
unless File.exist?(@@nunit_console_x86)
@@nunit_console_x86 = NUNIT_CONSOLE_X86 if defined?(NUNIT_CONSOLE_X86)
unless File.exist?(@@nunit_console_x86)
@@nunit_console_x86 = 'C:\\Program Files (x86)\\NUnit.org\\nunit-console\\nunit3-console.exe'
end
unless File.exist?(@@nunit_console_x86)
@@nunit_console_x86 = 'C:\\Program Files (x86)\\NUnit 2.6.4\\bin\\nunit-console-x86.exe'
end
unless File.exist?(@@nunit_console_x86)
@@nunit_console_x86 = 'C:\\Program Files (x86)\\NUnit 2.6.3\\bin\\nunit-console-x86.exe'
end
end
unless File.exist?(@@nunit_console_x86)
raise "unable to locate nunit-console-x86.exe, assign NUNIT_CONSOLE_X86 to the correct location."
end
@@nunit_console_x86
end
|
Instance Method Details
#update ⇒ Object
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
# File 'lib/tasks/test.rb', line 14
def update
add_quiet "rspec --format documentation" if File.exist?("spec")
if defined?(NUNIT)
NUNIT.each do |nunit_dll|
skip = false
skip = true if nunit_dll.include?("/netcoreapp")
skip = true if nunit_dll.include?("packages/")
next if skip
nunit_arg = Test.nunit_console
nunit_arg = "\"#{Test.nunit_console}\"" if Test.nunit_console.include?(" ")
dll_arg = nunit_dll
dll_arg = "\"#{nunit_dll}\"" if nunit_dll.include?(" ")
if Test.nunit_console.include?("nunit3")
xml_arg = "--result=#{nunit_dll}.TestResults.xml --labels=All"
xml_arg = "--result=\"#{nunit_dll}.TestResults.xml\" --labels=All" if nunit_dll.include?(" ")
else
xml_arg = "/xml:#{nunit_dll}.TestResults.xml"
xml_arg = "/xml:\"#{nunit_dll}.TestResults.xml\"" if nunit_dll.include?(" ")
end
add_quiet "#{nunit_arg} #{dll_arg} #{xml_arg}"
end
end
if defined?(NUNIT_X86)
NUNIT_X86.each do |nunit_dll|
if Test.nunit_console_x86.include?("nunit3")
add_quiet "\"#{Test.nunit_console_x86}\" \"#{Rake.application.original_dir}\\#{nunit_dll}\" --result=\"#{nunit_dll}.TestResults.xml\" --labels=All"
else
add_quiet "\"#{Test.nunit_console_x86}\" \"#{Rake.application.original_dir}\\#{nunit_dll}\" /xml:\"#{nunit_dll}.TestResults.xml\""
end
end
end
puts "scanning for **/*.Test.csproj" if Environment.default.debug?
Dir.glob("**/*.Test.csproj") do |proj|
puts "found #{proj}" if Environment.default.debug?
text = IO.read(proj)
add_quiet("dotnet test #{proj}") if text.include?("netcoreapp")
end
TEST.each { |t| add_quiet t } if defined?(TESTS)
end
|