Module: MobyBehaviour::Find
- Includes:
- Behaviour
- Defined in:
- lib/tdriver/base/sut/generic/behaviours/find.rb
Overview
description
This module contains generic find behaviour
behaviour
GenericFind
requires
input_type
sut_type
sut_version
objects
*;sut
Instance Method Summary collapse
-
#find(attributes = {}) ⇒ Object
nodoc == description Finds a child test_object given its name and type and returns it as a reference .
Instance Method Details
#find(attributes = {}) ⇒ Object
nodoc
description
Finds a child test_object given its name and type and returns it as a reference
arguments
attributes Hash description: one or more attributes defining the rules for the test object search. Must not be empty. example: { :name => 'oneButton' } default: {}
returns
MobyBase::TestObject description: found test object example: -
exceptions
TypeError
description: Wrong argument type
ArgumentError description: Attributes hash must not be empty
info
Same as calling child method.
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 |
# File 'lib/tdriver/base/sut/generic/behaviours/find.rb', line 73 def find( attributes = {} ) begin # verify that attributes argument type is correct attributes.check_type Hash, 'Wrong argument type $1 for attributes (expected $2)' # verify that attributes hash is not empty attributes.not_empty 'Attributes hash must not be empty' # retrieve desired object result = child( attributes ) rescue $logger.behaviour "FAIL;Failed to find test object.;#{ id.to_s };sut;{};find;#{ attributes.kind_of?( Hash ) ? attributes.inspect : attributes.class.to_s }" # raise original exception raise end $logger.behaviour "PASS;Test object found.;#{ id.to_s };sut;{};application;#{ attributes.inspect }" # pass the result object result end |