class DotCoverWrapper
Public Class Methods
new(&block)
click to toggle source
# File lib/DotCoverRakeTask.rb, line 10 def initialize(&block) @block = block; end
Public Instance Methods
run()
click to toggle source
# File lib/DotCoverRakeTask.rb, line 14 def run() configuration = DotCoverConfiguration.new @block.call(configuration) nunit_command_line_args = "#{configuration.nunit_assemblies.join(' ')} #{configuration.nunit_parameters.join(' ')}" snapshot_output_file = "#{configuration.report_directory}/#{configuration.snapshot_name}" report_file_path_and_name = "#{configuration.report_directory}/#{configuration.report_name}" run_coverage(configuration.executable, configuration.nunit_executable, nunit_command_line_args, snapshot_output_file, configuration.filters) if (configuration.html_report) report_html_file = "#{report_file_path_and_name}.html" create_html_report(configuration.executable, snapshot_output_file, report_html_file) end if (configuration.xml_report) report_xml_file = "#{report_file_path_and_name}.xml" create_xml_report(configuration.executable, snapshot_output_file, report_xml_file) end end
Private Instance Methods
create_html_report(executable, snapshot_output_file, report_file)
click to toggle source
# File lib/DotCoverRakeTask.rb, line 47 def create_html_report(executable, snapshot_output_file, report_file) create_report(executable, snapshot_output_file, report_file, "HTML") end
create_report(executable, snapshot_output_file, report_file, report_type)
click to toggle source
# File lib/DotCoverRakeTask.rb, line 55 def create_report(executable, snapshot_output_file, report_file, report_type) output = `#{executable} report /Source="#{snapshot_output_file}" /Output="#{report_file}" /ReportType="#{report_type}"` puts output end
create_xml_report(executable, snapshot_output_file, report_file)
click to toggle source
# File lib/DotCoverRakeTask.rb, line 51 def create_xml_report(executable, snapshot_output_file, report_file) create_report(executable, snapshot_output_file, report_file, "XML") end
run_coverage(executable, nunit_executable, nunit_command_line_args, snapshot_output_file, filters)
click to toggle source
# File lib/DotCoverRakeTask.rb, line 37 def run_coverage(executable, nunit_executable, nunit_command_line_args, snapshot_output_file, filters) output = `#{executable} cover /TargetExecutable=#{nunit_executable} /TargetArguments="#{nunit_command_line_args}" /Output=#{snapshot_output_file} /Filters=#{filters}` puts output raise 'Unit Test Failures!' if unit_test_errors? end
unit_test_errors?()
click to toggle source
# File lib/DotCoverRakeTask.rb, line 43 def unit_test_errors? $?.to_i != 0 end