Class: Applitools::Base::TestResults

Inherits:
Object
  • Object
show all
Defined in:
lib/applitools/base/test_results.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(results = {}) ⇒ TestResults

Returns a new instance of TestResults.



6
7
8
9
10
11
12
13
# File 'lib/applitools/base/test_results.rb', line 6

def initialize(results = {})
  @steps = results.fetch('steps', 0)
  @matches = results.fetch('matches', 0)
  @mismatches = results.fetch('mismatches', 0)
  @missing = results.fetch('missing', 0)
  @is_new = nil
  @url = nil
end

Instance Attribute Details

#is_newObject

Returns the value of attribute is_new.



3
4
5
# File 'lib/applitools/base/test_results.rb', line 3

def is_new
  @is_new
end

#matchesObject (readonly)

Returns the value of attribute matches.



4
5
6
# File 'lib/applitools/base/test_results.rb', line 4

def matches
  @matches
end

#mismatchesObject (readonly)

Returns the value of attribute mismatches.



4
5
6
# File 'lib/applitools/base/test_results.rb', line 4

def mismatches
  @mismatches
end

#missingObject (readonly)

Returns the value of attribute missing.



4
5
6
# File 'lib/applitools/base/test_results.rb', line 4

def missing
  @missing
end

#stepsObject (readonly)

Returns the value of attribute steps.



4
5
6
# File 'lib/applitools/base/test_results.rb', line 4

def steps
  @steps
end

#urlObject

Returns the value of attribute url.



3
4
5
# File 'lib/applitools/base/test_results.rb', line 3

def url
  @url
end

Instance Method Details

#passed?Boolean Also known as: is_passed

Returns:

  • (Boolean)


15
16
17
# File 'lib/applitools/base/test_results.rb', line 15

def passed?
  !is_new && !(mismatches > 0) && !(missing > 0)
end

#to_sObject



20
21
22
23
24
25
26
# File 'lib/applitools/base/test_results.rb', line 20

def to_s
  is_new_str = ''
  is_new_str = is_new ? 'New test' : 'Existing test' unless is_new.nil?

  "#{is_new_str} [ steps: #{steps}, matches: #{matches}, mismatches: #{mismatches}, missing: #{missing} ], "\
    "URL: #{url}"
end