Class: Inferno::Entities::Result

Inherits:
Entity
  • Object
show all
Includes:
HasRunnable
Defined in:
lib/inferno/entities/result.rb

Overview

A Result represents the result of running a Test, TestGroup, or TestSuite

Constant Summary collapse

ATTRIBUTES =
[
  :id, :created_at, :updated_at, :test_id, :test, :test_group_id,
  :test_group, :test_suite_id, :test_suite, :test_run_id,
  :test_session_id, :result, :result_message, :messages, :requests,
  :input_json, :output_json
].freeze
RESULT_OPTIONS =
['cancel', 'wait', 'running', 'error', 'fail', 'skip', 'pass', 'omit'].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from HasRunnable

#runnable

Methods inherited from Entity

#to_hash

Constructor Details

#initialize(params) ⇒ Result

Returns a new instance of Result.



55
56
57
58
59
60
# File 'lib/inferno/entities/result.rb', line 55

def initialize(params)
  super(params, ATTRIBUTES - [:messages, :requests])

  @messages = (params[:messages] || []).map { |message| Message.new(message) }
  @requests = (params[:requests] || []).map { |request| Request.new(request) }
end

Instance Attribute Details

#created_atTime

Returns creation timestamp.

Returns:

  • (Time)

    creation timestamp



43
44
45
46
47
48
49
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
# File 'lib/inferno/entities/result.rb', line 43

class Result < Entity
  ATTRIBUTES = [
    :id, :created_at, :updated_at, :test_id, :test, :test_group_id,
    :test_group, :test_suite_id, :test_suite, :test_run_id,
    :test_session_id, :result, :result_message, :messages, :requests,
    :input_json, :output_json
  ].freeze
  RESULT_OPTIONS = ['cancel', 'wait', 'running', 'error', 'fail', 'skip', 'pass', 'omit'].freeze

  include Inferno::Entities::Attributes
  include Inferno::Entities::HasRunnable

  def initialize(params)
    super(params, ATTRIBUTES - [:messages, :requests])

    @messages = (params[:messages] || []).map { |message| Message.new(message) }
    @requests = (params[:requests] || []).map { |request| Request.new(request) }
  end

  def optional?
    runnable.nil? || runnable.optional?
  end

  def required?
    !optional?
  end

  # @return [Boolean]
  def waiting?
    result == 'wait'
  end
end

#idString

Returns id of the session.

Returns:

  • (String)

    id of the session



43
44
45
46
47
48
49
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
# File 'lib/inferno/entities/result.rb', line 43

class Result < Entity
  ATTRIBUTES = [
    :id, :created_at, :updated_at, :test_id, :test, :test_group_id,
    :test_group, :test_suite_id, :test_suite, :test_run_id,
    :test_session_id, :result, :result_message, :messages, :requests,
    :input_json, :output_json
  ].freeze
  RESULT_OPTIONS = ['cancel', 'wait', 'running', 'error', 'fail', 'skip', 'pass', 'omit'].freeze

  include Inferno::Entities::Attributes
  include Inferno::Entities::HasRunnable

  def initialize(params)
    super(params, ATTRIBUTES - [:messages, :requests])

    @messages = (params[:messages] || []).map { |message| Message.new(message) }
    @requests = (params[:requests] || []).map { |request| Request.new(request) }
  end

  def optional?
    runnable.nil? || runnable.optional?
  end

  def required?
    !optional?
  end

  # @return [Boolean]
  def waiting?
    result == 'wait'
  end
end

#input_jsonString

Returns JSON string of the inputs used for this result.

Returns:

  • (String)

    JSON string of the inputs used for this result



43
44
45
46
47
48
49
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
# File 'lib/inferno/entities/result.rb', line 43

class Result < Entity
  ATTRIBUTES = [
    :id, :created_at, :updated_at, :test_id, :test, :test_group_id,
    :test_group, :test_suite_id, :test_suite, :test_run_id,
    :test_session_id, :result, :result_message, :messages, :requests,
    :input_json, :output_json
  ].freeze
  RESULT_OPTIONS = ['cancel', 'wait', 'running', 'error', 'fail', 'skip', 'pass', 'omit'].freeze

  include Inferno::Entities::Attributes
  include Inferno::Entities::HasRunnable

  def initialize(params)
    super(params, ATTRIBUTES - [:messages, :requests])

    @messages = (params[:messages] || []).map { |message| Message.new(message) }
    @requests = (params[:requests] || []).map { |request| Request.new(request) }
  end

  def optional?
    runnable.nil? || runnable.optional?
  end

  def required?
    !optional?
  end

  # @return [Boolean]
  def waiting?
    result == 'wait'
  end
end

#messagesArray<Inferno::Entities::Message>

result

Returns:



43
44
45
46
47
48
49
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
# File 'lib/inferno/entities/result.rb', line 43

class Result < Entity
  ATTRIBUTES = [
    :id, :created_at, :updated_at, :test_id, :test, :test_group_id,
    :test_group, :test_suite_id, :test_suite, :test_run_id,
    :test_session_id, :result, :result_message, :messages, :requests,
    :input_json, :output_json
  ].freeze
  RESULT_OPTIONS = ['cancel', 'wait', 'running', 'error', 'fail', 'skip', 'pass', 'omit'].freeze

  include Inferno::Entities::Attributes
  include Inferno::Entities::HasRunnable

  def initialize(params)
    super(params, ATTRIBUTES - [:messages, :requests])

    @messages = (params[:messages] || []).map { |message| Message.new(message) }
    @requests = (params[:requests] || []).map { |request| Request.new(request) }
  end

  def optional?
    runnable.nil? || runnable.optional?
  end

  def required?
    !optional?
  end

  # @return [Boolean]
  def waiting?
    result == 'wait'
  end
end

#output_jsonString

Returns JSON string of the outputs created by this result.

Returns:

  • (String)

    JSON string of the outputs created by this result



43
44
45
46
47
48
49
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
# File 'lib/inferno/entities/result.rb', line 43

class Result < Entity
  ATTRIBUTES = [
    :id, :created_at, :updated_at, :test_id, :test, :test_group_id,
    :test_group, :test_suite_id, :test_suite, :test_run_id,
    :test_session_id, :result, :result_message, :messages, :requests,
    :input_json, :output_json
  ].freeze
  RESULT_OPTIONS = ['cancel', 'wait', 'running', 'error', 'fail', 'skip', 'pass', 'omit'].freeze

  include Inferno::Entities::Attributes
  include Inferno::Entities::HasRunnable

  def initialize(params)
    super(params, ATTRIBUTES - [:messages, :requests])

    @messages = (params[:messages] || []).map { |message| Message.new(message) }
    @requests = (params[:requests] || []).map { |request| Request.new(request) }
  end

  def optional?
    runnable.nil? || runnable.optional?
  end

  def required?
    !optional?
  end

  # @return [Boolean]
  def waiting?
    result == 'wait'
  end
end

#requestsArray<Inferno::Entities::Request>

associated with this result

Returns:



43
44
45
46
47
48
49
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
# File 'lib/inferno/entities/result.rb', line 43

class Result < Entity
  ATTRIBUTES = [
    :id, :created_at, :updated_at, :test_id, :test, :test_group_id,
    :test_group, :test_suite_id, :test_suite, :test_run_id,
    :test_session_id, :result, :result_message, :messages, :requests,
    :input_json, :output_json
  ].freeze
  RESULT_OPTIONS = ['cancel', 'wait', 'running', 'error', 'fail', 'skip', 'pass', 'omit'].freeze

  include Inferno::Entities::Attributes
  include Inferno::Entities::HasRunnable

  def initialize(params)
    super(params, ATTRIBUTES - [:messages, :requests])

    @messages = (params[:messages] || []).map { |message| Message.new(message) }
    @requests = (params[:requests] || []).map { |request| Request.new(request) }
  end

  def optional?
    runnable.nil? || runnable.optional?
  end

  def required?
    !optional?
  end

  # @return [Boolean]
  def waiting?
    result == 'wait'
  end
end

#resultString

running, wait, cancel)

Returns:

  • (String)

    the result (pass, fail, skip, omit, error,



43
44
45
46
47
48
49
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
# File 'lib/inferno/entities/result.rb', line 43

class Result < Entity
  ATTRIBUTES = [
    :id, :created_at, :updated_at, :test_id, :test, :test_group_id,
    :test_group, :test_suite_id, :test_suite, :test_run_id,
    :test_session_id, :result, :result_message, :messages, :requests,
    :input_json, :output_json
  ].freeze
  RESULT_OPTIONS = ['cancel', 'wait', 'running', 'error', 'fail', 'skip', 'pass', 'omit'].freeze

  include Inferno::Entities::Attributes
  include Inferno::Entities::HasRunnable

  def initialize(params)
    super(params, ATTRIBUTES - [:messages, :requests])

    @messages = (params[:messages] || []).map { |message| Message.new(message) }
    @requests = (params[:requests] || []).map { |request| Request.new(request) }
  end

  def optional?
    runnable.nil? || runnable.optional?
  end

  def required?
    !optional?
  end

  # @return [Boolean]
  def waiting?
    result == 'wait'
  end
end

#result_messageString

Returns summary message for this result.

Returns:

  • (String)

    summary message for this result



43
44
45
46
47
48
49
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
# File 'lib/inferno/entities/result.rb', line 43

class Result < Entity
  ATTRIBUTES = [
    :id, :created_at, :updated_at, :test_id, :test, :test_group_id,
    :test_group, :test_suite_id, :test_suite, :test_run_id,
    :test_session_id, :result, :result_message, :messages, :requests,
    :input_json, :output_json
  ].freeze
  RESULT_OPTIONS = ['cancel', 'wait', 'running', 'error', 'fail', 'skip', 'pass', 'omit'].freeze

  include Inferno::Entities::Attributes
  include Inferno::Entities::HasRunnable

  def initialize(params)
    super(params, ATTRIBUTES - [:messages, :requests])

    @messages = (params[:messages] || []).map { |message| Message.new(message) }
    @requests = (params[:requests] || []).map { |request| Request.new(request) }
  end

  def optional?
    runnable.nil? || runnable.optional?
  end

  def required?
    !optional?
  end

  # @return [Boolean]
  def waiting?
    result == 'wait'
  end
end

#testTest?

Returns the Test this result belongs to.

Returns:

  • (Test, nil)

    the Test this result belongs to



43
44
45
46
47
48
49
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
# File 'lib/inferno/entities/result.rb', line 43

class Result < Entity
  ATTRIBUTES = [
    :id, :created_at, :updated_at, :test_id, :test, :test_group_id,
    :test_group, :test_suite_id, :test_suite, :test_run_id,
    :test_session_id, :result, :result_message, :messages, :requests,
    :input_json, :output_json
  ].freeze
  RESULT_OPTIONS = ['cancel', 'wait', 'running', 'error', 'fail', 'skip', 'pass', 'omit'].freeze

  include Inferno::Entities::Attributes
  include Inferno::Entities::HasRunnable

  def initialize(params)
    super(params, ATTRIBUTES - [:messages, :requests])

    @messages = (params[:messages] || []).map { |message| Message.new(message) }
    @requests = (params[:requests] || []).map { |request| Request.new(request) }
  end

  def optional?
    runnable.nil? || runnable.optional?
  end

  def required?
    !optional?
  end

  # @return [Boolean]
  def waiting?
    result == 'wait'
  end
end

#test_groupTestGroup?

Returns the TestGroup this result belongs to.

Returns:

  • (TestGroup, nil)

    the TestGroup this result belongs to



43
44
45
46
47
48
49
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
# File 'lib/inferno/entities/result.rb', line 43

class Result < Entity
  ATTRIBUTES = [
    :id, :created_at, :updated_at, :test_id, :test, :test_group_id,
    :test_group, :test_suite_id, :test_suite, :test_run_id,
    :test_session_id, :result, :result_message, :messages, :requests,
    :input_json, :output_json
  ].freeze
  RESULT_OPTIONS = ['cancel', 'wait', 'running', 'error', 'fail', 'skip', 'pass', 'omit'].freeze

  include Inferno::Entities::Attributes
  include Inferno::Entities::HasRunnable

  def initialize(params)
    super(params, ATTRIBUTES - [:messages, :requests])

    @messages = (params[:messages] || []).map { |message| Message.new(message) }
    @requests = (params[:requests] || []).map { |request| Request.new(request) }
  end

  def optional?
    runnable.nil? || runnable.optional?
  end

  def required?
    !optional?
  end

  # @return [Boolean]
  def waiting?
    result == 'wait'
  end
end

#test_group_idString?

Returns id of the TestGroup this result belongs to.

Returns:

  • (String, nil)

    id of the TestGroup this result belongs to



43
44
45
46
47
48
49
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
# File 'lib/inferno/entities/result.rb', line 43

class Result < Entity
  ATTRIBUTES = [
    :id, :created_at, :updated_at, :test_id, :test, :test_group_id,
    :test_group, :test_suite_id, :test_suite, :test_run_id,
    :test_session_id, :result, :result_message, :messages, :requests,
    :input_json, :output_json
  ].freeze
  RESULT_OPTIONS = ['cancel', 'wait', 'running', 'error', 'fail', 'skip', 'pass', 'omit'].freeze

  include Inferno::Entities::Attributes
  include Inferno::Entities::HasRunnable

  def initialize(params)
    super(params, ATTRIBUTES - [:messages, :requests])

    @messages = (params[:messages] || []).map { |message| Message.new(message) }
    @requests = (params[:requests] || []).map { |request| Request.new(request) }
  end

  def optional?
    runnable.nil? || runnable.optional?
  end

  def required?
    !optional?
  end

  # @return [Boolean]
  def waiting?
    result == 'wait'
  end
end

#test_idString?

Returns id of the Test this result belongs to.

Returns:

  • (String, nil)

    id of the Test this result belongs to



43
44
45
46
47
48
49
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
# File 'lib/inferno/entities/result.rb', line 43

class Result < Entity
  ATTRIBUTES = [
    :id, :created_at, :updated_at, :test_id, :test, :test_group_id,
    :test_group, :test_suite_id, :test_suite, :test_run_id,
    :test_session_id, :result, :result_message, :messages, :requests,
    :input_json, :output_json
  ].freeze
  RESULT_OPTIONS = ['cancel', 'wait', 'running', 'error', 'fail', 'skip', 'pass', 'omit'].freeze

  include Inferno::Entities::Attributes
  include Inferno::Entities::HasRunnable

  def initialize(params)
    super(params, ATTRIBUTES - [:messages, :requests])

    @messages = (params[:messages] || []).map { |message| Message.new(message) }
    @requests = (params[:requests] || []).map { |request| Request.new(request) }
  end

  def optional?
    runnable.nil? || runnable.optional?
  end

  def required?
    !optional?
  end

  # @return [Boolean]
  def waiting?
    result == 'wait'
  end
end

#test_run_idString

Returns the TestRun this result belongs to.

Returns:

  • (String)

    the TestRun this result belongs to



43
44
45
46
47
48
49
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
# File 'lib/inferno/entities/result.rb', line 43

class Result < Entity
  ATTRIBUTES = [
    :id, :created_at, :updated_at, :test_id, :test, :test_group_id,
    :test_group, :test_suite_id, :test_suite, :test_run_id,
    :test_session_id, :result, :result_message, :messages, :requests,
    :input_json, :output_json
  ].freeze
  RESULT_OPTIONS = ['cancel', 'wait', 'running', 'error', 'fail', 'skip', 'pass', 'omit'].freeze

  include Inferno::Entities::Attributes
  include Inferno::Entities::HasRunnable

  def initialize(params)
    super(params, ATTRIBUTES - [:messages, :requests])

    @messages = (params[:messages] || []).map { |message| Message.new(message) }
    @requests = (params[:requests] || []).map { |request| Request.new(request) }
  end

  def optional?
    runnable.nil? || runnable.optional?
  end

  def required?
    !optional?
  end

  # @return [Boolean]
  def waiting?
    result == 'wait'
  end
end

#test_session_idString

Returns the TestSession this result belongs to.

Returns:

  • (String)

    the TestSession this result belongs to



43
44
45
46
47
48
49
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
# File 'lib/inferno/entities/result.rb', line 43

class Result < Entity
  ATTRIBUTES = [
    :id, :created_at, :updated_at, :test_id, :test, :test_group_id,
    :test_group, :test_suite_id, :test_suite, :test_run_id,
    :test_session_id, :result, :result_message, :messages, :requests,
    :input_json, :output_json
  ].freeze
  RESULT_OPTIONS = ['cancel', 'wait', 'running', 'error', 'fail', 'skip', 'pass', 'omit'].freeze

  include Inferno::Entities::Attributes
  include Inferno::Entities::HasRunnable

  def initialize(params)
    super(params, ATTRIBUTES - [:messages, :requests])

    @messages = (params[:messages] || []).map { |message| Message.new(message) }
    @requests = (params[:requests] || []).map { |request| Request.new(request) }
  end

  def optional?
    runnable.nil? || runnable.optional?
  end

  def required?
    !optional?
  end

  # @return [Boolean]
  def waiting?
    result == 'wait'
  end
end

#test_suiteTestSuite?

Returns the TestSuite this result belongs to.

Returns:

  • (TestSuite, nil)

    the TestSuite this result belongs to



43
44
45
46
47
48
49
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
# File 'lib/inferno/entities/result.rb', line 43

class Result < Entity
  ATTRIBUTES = [
    :id, :created_at, :updated_at, :test_id, :test, :test_group_id,
    :test_group, :test_suite_id, :test_suite, :test_run_id,
    :test_session_id, :result, :result_message, :messages, :requests,
    :input_json, :output_json
  ].freeze
  RESULT_OPTIONS = ['cancel', 'wait', 'running', 'error', 'fail', 'skip', 'pass', 'omit'].freeze

  include Inferno::Entities::Attributes
  include Inferno::Entities::HasRunnable

  def initialize(params)
    super(params, ATTRIBUTES - [:messages, :requests])

    @messages = (params[:messages] || []).map { |message| Message.new(message) }
    @requests = (params[:requests] || []).map { |request| Request.new(request) }
  end

  def optional?
    runnable.nil? || runnable.optional?
  end

  def required?
    !optional?
  end

  # @return [Boolean]
  def waiting?
    result == 'wait'
  end
end

#test_suite_idString?

Returns id of the TestSuite this result belongs to.

Returns:

  • (String, nil)

    id of the TestSuite this result belongs to



43
44
45
46
47
48
49
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
# File 'lib/inferno/entities/result.rb', line 43

class Result < Entity
  ATTRIBUTES = [
    :id, :created_at, :updated_at, :test_id, :test, :test_group_id,
    :test_group, :test_suite_id, :test_suite, :test_run_id,
    :test_session_id, :result, :result_message, :messages, :requests,
    :input_json, :output_json
  ].freeze
  RESULT_OPTIONS = ['cancel', 'wait', 'running', 'error', 'fail', 'skip', 'pass', 'omit'].freeze

  include Inferno::Entities::Attributes
  include Inferno::Entities::HasRunnable

  def initialize(params)
    super(params, ATTRIBUTES - [:messages, :requests])

    @messages = (params[:messages] || []).map { |message| Message.new(message) }
    @requests = (params[:requests] || []).map { |request| Request.new(request) }
  end

  def optional?
    runnable.nil? || runnable.optional?
  end

  def required?
    !optional?
  end

  # @return [Boolean]
  def waiting?
    result == 'wait'
  end
end

#updated_atTime

Returns update timestamp.

Returns:

  • (Time)

    update timestamp



43
44
45
46
47
48
49
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
# File 'lib/inferno/entities/result.rb', line 43

class Result < Entity
  ATTRIBUTES = [
    :id, :created_at, :updated_at, :test_id, :test, :test_group_id,
    :test_group, :test_suite_id, :test_suite, :test_run_id,
    :test_session_id, :result, :result_message, :messages, :requests,
    :input_json, :output_json
  ].freeze
  RESULT_OPTIONS = ['cancel', 'wait', 'running', 'error', 'fail', 'skip', 'pass', 'omit'].freeze

  include Inferno::Entities::Attributes
  include Inferno::Entities::HasRunnable

  def initialize(params)
    super(params, ATTRIBUTES - [:messages, :requests])

    @messages = (params[:messages] || []).map { |message| Message.new(message) }
    @requests = (params[:requests] || []).map { |request| Request.new(request) }
  end

  def optional?
    runnable.nil? || runnable.optional?
  end

  def required?
    !optional?
  end

  # @return [Boolean]
  def waiting?
    result == 'wait'
  end
end

Instance Method Details

#optional?Boolean

Returns:

  • (Boolean)


62
63
64
# File 'lib/inferno/entities/result.rb', line 62

def optional?
  runnable.nil? || runnable.optional?
end

#required?Boolean

Returns:

  • (Boolean)


66
67
68
# File 'lib/inferno/entities/result.rb', line 66

def required?
  !optional?
end

#waiting?Boolean

Returns:

  • (Boolean)


71
72
73
# File 'lib/inferno/entities/result.rb', line 71

def waiting?
  result == 'wait'
end