Class: XCPretty::HTML

Inherits:
Object
  • Object
show all
Includes:
FormatMethods
Defined in:
lib/xcpretty/reporters/html.rb

Constant Summary collapse

FILEPATH =
'build/reports/tests.html'
TEMPLATE =
File.expand_path('../../../../assets/report.html.erb', __FILE__)

Constants included from FormatMethods

FormatMethods::EMPTY

Instance Method Summary collapse

Methods included from FormatMethods

#format_analyze, #format_build_target, #format_check_dependencies, #format_clean, #format_clean_remove, #format_clean_target, #format_codesign, #format_compile, #format_compile_command, #format_compile_error, #format_compile_xib, #format_copy_strings_file, #format_cpresource, #format_duplicate_symbols, #format_error, #format_generate_dsym, #format_libtool, #format_linking, #format_pbxcp, #format_pending_test, #format_phase_script_execution, #format_preprocess, #format_process_info_plist, #format_process_pch, #format_test_run_finished, #format_test_run_started, #format_test_suite_started, #format_test_summary, #format_tiffutil, #format_touch, #format_undefined_symbols

Constructor Details

#initialize(options) ⇒ HTML

Returns a new instance of HTML.



17
18
19
20
21
22
23
24
# File 'lib/xcpretty/reporters/html.rb', line 17

def initialize(options)
  load_dependencies
  @test_suites = {}
  @filepath    = options[:path] || FILEPATH
  @parser      = Parser.new(self)
  @test_count  = 0
  @fail_count  = 0
end

Instance Method Details

#finishObject



39
40
41
42
# File 'lib/xcpretty/reporters/html.rb', line 39

def finish
  FileUtils.mkdir_p(File.dirname(@filepath))
  write_report
end

#format_failing_test(suite, test_case, reason, file) ⇒ Object



30
31
32
33
# File 'lib/xcpretty/reporters/html.rb', line 30

def format_failing_test(suite, test_case, reason, file)
  add_test(suite, {:name => test_case, :failing => true,
    :reason => reason, :file => file, :snippet => formatted_snippet(file)})
end

#format_passing_test(suite, test_case, time) ⇒ Object



35
36
37
# File 'lib/xcpretty/reporters/html.rb', line 35

def format_passing_test(suite, test_case, time)
  add_test(suite, {:name => test_case, :time => time})
end

#handle(line) ⇒ Object



26
27
28
# File 'lib/xcpretty/reporters/html.rb', line 26

def handle(line)
  @parser.parse(line)
end

#load_dependenciesObject



8
9
10
11
12
13
14
15
# File 'lib/xcpretty/reporters/html.rb', line 8

def load_dependencies
  unless @@loaded ||= false
    require 'fileutils'
    require 'pathname'
    require 'erb'
    @@loaded = true
  end
end