Class: Bozo::TestRunners::Nunit3
- Inherits:
-
Object
- Object
- Bozo::TestRunners::Nunit3
- Defined in:
- lib/bozo/test_runners/nunit3.rb
Overview
A TestRunner for NUnit3
Instance Method Summary collapse
- #agents(agents) ⇒ Object
- #execute ⇒ Object
-
#initialize ⇒ Nunit3
constructor
A new instance of Nunit3.
- #platform(platform) ⇒ Object
- #project(path) ⇒ Object
- #report_path(path) ⇒ Object
-
#runner_args ⇒ Object
Returns the arguments required for the runner’s executable.
-
#runner_path ⇒ Object
Returns the path to the runner’s executable.
- #to_s ⇒ Object
Constructor Details
#initialize ⇒ Nunit3
Returns a new instance of Nunit3.
6 7 8 |
# File 'lib/bozo/test_runners/nunit3.rb', line 6 def initialize @projects = [] end |
Instance Method Details
#agents(agents) ⇒ Object
22 23 24 |
# File 'lib/bozo/test_runners/nunit3.rb', line 22 def agents(agents) @agents = agents end |
#execute ⇒ Object
80 81 82 |
# File 'lib/bozo/test_runners/nunit3.rb', line 80 def execute execute_command :nunit, [runner_path] << runner_args end |
#platform(platform) ⇒ Object
10 11 12 |
# File 'lib/bozo/test_runners/nunit3.rb', line 10 def platform(platform) @platform = platform end |
#project(path) ⇒ Object
14 15 16 |
# File 'lib/bozo/test_runners/nunit3.rb', line 14 def project(path) @projects << path end |
#report_path(path) ⇒ Object
18 19 20 |
# File 'lib/bozo/test_runners/nunit3.rb', line 18 def report_path(path) @report_path = path end |
#runner_args ⇒ Object
Returns the arguments required for the runner’s executable.
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/bozo/test_runners/nunit3.rb', line 50 def runner_args args = [] @projects.each do |project| ('temp', 'msbuild', project, '**', "#{project}.dll").each do |test_dll| args << "\"#{test_dll}\"" end end args << '--noheader' if @platform == 'x86' args << '--x86' end # If @agents is defined and not 0 if (defined? @agents) && (@agents || 0) != 0 args << "--agents=#{@agents}" end report_path = @report_path report_path = ('temp', 'nunit', "#{Time.now.to_i}-nunit-report.xml") unless report_path # Ensure the directory is there because NUnit won't make it FileUtils.mkdir_p File.dirname(report_path) args << "--result=\"#{report_path}\"" args end |
#runner_path ⇒ Object
Returns the path to the runner’s executable.
33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/bozo/test_runners/nunit3.rb', line 33 def runner_path exe_name = 'nunit3-console.exe' nunit_runners = ('packages', 'NUnit*', 'tools', exe_name) raise nunit_runner_not_found if nunit_runners.empty? raise multiple_runners_found if nunit_runners.size > 1 nunit_runner = nunit_runners.first log_debug "Found runner at #{nunit_runner}" nunit_runner end |
#to_s ⇒ Object
26 27 28 |
# File 'lib/bozo/test_runners/nunit3.rb', line 26 def to_s "Run tests with nunit3 against projects #{@projects}" end |