Class: TripAdvisor::TestReport

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/trip_advisor/rake_tasks.rb

Instance Method Summary collapse

Constructor Details

#initializeTestReport

Returns a new instance of TestReport.



46
47
48
49
# File 'lib/trip_advisor/rake_tasks.rb', line 46

def initialize
  @namespaces = {}
  @success = true
end

Instance Method Details

#[](ios_version) ⇒ Object



58
59
60
# File 'lib/trip_advisor/rake_tasks.rb', line 58

def [](ios_version)
  @namespaces[ios_version]
end

#add_result(namespace, ios_version, test_device, success) ⇒ Object



51
52
53
54
55
56
# File 'lib/trip_advisor/rake_tasks.rb', line 51

def add_result(namespace, ios_version, test_device, success)
  @namespaces[namespace] ||= {}
  @namespaces[namespace][ios_version] ||= {}
  @namespaces[namespace][ios_version][test_device] = success
  @success = false unless success
end

#failure?Boolean

Returns:

  • (Boolean)


66
67
68
# File 'lib/trip_advisor/rake_tasks.rb', line 66

def failure?
  @success == false
end

#reportObject



70
71
72
73
74
75
76
77
78
79
# File 'lib/trip_advisor/rake_tasks.rb', line 70

def report
  @namespaces.each do |namespace, version_status|
    version_status.each do |ios_version, device_status|
      device_status.each do |test_device, success|
        puts "\033[0;31m!! #{namespace} tests failed on #{test_device} under iOS #{ios_version}" unless success
      end
    end
  end
  puts "\033[0;32m** All tests executed successfully" if success?
end

#success?Boolean

Returns:

  • (Boolean)


62
63
64
# File 'lib/trip_advisor/rake_tasks.rb', line 62

def success?
  @success
end