Module: Inferno::DSL::Results

Included in:
Entities::TestGroup, Entities::TestSuite
Defined in:
lib/inferno/dsl/results.rb

Overview

This module contains methods to set test results.

Instance Method Summary collapse

Instance Method Details

#cancel(message = '') ⇒ Object

Halt execution of the current test. This provided for testing purposes and should not be used in real tests.

Parameters:

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

Raises:



107
108
109
# File 'lib/inferno/dsl/results.rb', line 107

def cancel(message = '')
  raise Exceptions::CancelException, message
end

#identifier(identifier = nil) ⇒ Object



93
94
95
# File 'lib/inferno/dsl/results.rb', line 93

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

#omit(message = '') ⇒ void

This method returns an undefined value.

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

Parameters:

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

Raises:



45
46
47
# File 'lib/inferno/dsl/results.rb', line 45

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

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

This method returns an undefined value.

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

Parameters:

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

Raises:



55
56
57
# File 'lib/inferno/dsl/results.rb', line 55

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

#pass(message = '') ⇒ void

This method returns an undefined value.

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

Parameters:

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

Raises:



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

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

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

This method returns an undefined value.

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

Parameters:

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

Raises:



19
20
21
# File 'lib/inferno/dsl/results.rb', line 19

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

#skip(message = '') ⇒ void

This method returns an undefined value.

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

Parameters:

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

Raises:



27
28
29
# File 'lib/inferno/dsl/results.rb', line 27

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

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

This method returns an undefined value.

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

Parameters:

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

Raises:



37
38
39
# File 'lib/inferno/dsl/results.rb', line 37

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

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

This method returns an undefined value.

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:



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

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

  raise Exceptions::WaitException, message
end

#wait_timeout(timeout = nil) ⇒ Object



98
99
100
# File 'lib/inferno/dsl/results.rb', line 98

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