Module: Inferno::DSL::Results

Defined in:
lib/inferno/dsl/results.rb

Overview

This module contains methods to set test results.

Instance Method Summary collapse

Instance Method Details

#identifier(identifier = nil) ⇒ Object



85
86
87
# File 'lib/inferno/dsl/results.rb', line 85

def identifier(identifier = nil)
  @identifier ||= identifier
end

#omit(message = '') ⇒ Object

Halt execution of the current test and mark it as omitted.

Parameters:

  • message (String) (defaults to: '')

Raises:



40
41
42
# File 'lib/inferno/dsl/results.rb', line 40

def omit(message = '')
  raise Exceptions::OmitException, message
end

#omit_if(test, message = '') ⇒ Object

Halt execution of the current test and mark it as omitted if a condition is true.

Parameters:

  • test (Boolean)
  • message (String) (defaults to: '')

Raises:



49
50
51
# File 'lib/inferno/dsl/results.rb', line 49

def omit_if(test, message = '')
  raise Exceptions::OmitException, message if test
end

#pass(message = '') ⇒ Object

Halt execution of the current test and mark it as passed.

Parameters:

  • message (String) (defaults to: '')

Raises:



8
9
10
# File 'lib/inferno/dsl/results.rb', line 8

def pass(message = '')
  raise Exceptions::PassException, message
end

#pass_if(test, message = '') ⇒ Object

Halt execution of the current test and mark it as passed if a condition is true.

Parameters:

  • test (Boolean)
  • message (String) (defaults to: '')

Raises:



17
18
19
# File 'lib/inferno/dsl/results.rb', line 17

def pass_if(test, message = '')
  raise Exceptions::PassException, message if test
end

#skip(message = '') ⇒ Object

Halt execution of the current test and mark it as skipped.

Parameters:

  • message (String) (defaults to: '')

Raises:



24
25
26
# File 'lib/inferno/dsl/results.rb', line 24

def skip(message = '')
  raise Exceptions::SkipException, message
end

#skip_if(test, message = '') ⇒ Object

Halt execution of the current test and mark it as skipped if a condition is true.

Parameters:

  • test (Boolean)
  • message (String) (defaults to: '')

Raises:



33
34
35
# File 'lib/inferno/dsl/results.rb', line 33

def skip_if(test, message = '')
  raise Exceptions::SkipException, message if test
end

#wait(identifier:, message: '', timeout: 300) ⇒ Object

Halt execution of the current test and wait for execution to resume.

Examples:

resume_test_route :get, '/launch' do
  request.query_parameters['iss']
end

test do
  input :issuer
  receives_request :launch

  run do
    wait(
      identifier: issuer,
      message: "Wating to receive a request with an issuer of #{issuer}"
    )
  end
end

Parameters:

  • identifier (String)

    An identifier which can uniquely identify this test run based on an incoming request. This is necessary so that the correct test run can be resumed.

  • message (String) (defaults to: '')
  • timeout (Integer) (defaults to: 300)

    Number of seconds to wait for an incoming request

Raises:

See Also:



78
79
80
81
82
83
# File 'lib/inferno/dsl/results.rb', line 78

def wait(identifier:, message: '', timeout: 300)
  identifier(identifier)
  wait_timeout(timeout)

  raise Exceptions::WaitException, message
end

#wait_timeout(timeout = nil) ⇒ Object



89
90
91
# File 'lib/inferno/dsl/results.rb', line 89

def wait_timeout(timeout = nil)
  @wait_timeout ||= timeout
end