Class: MobyBase::SUT

Inherits:
Object show all
Defined in:
lib/tdriver/base/sut/sut.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(sut_controller, test_object_factory, sut_id, test_object_adapter = nil) ⇒ SUT

Initialize SUT by giving references to the used controller and test object factory

params

sut_controller

Controller object that acts as a facade to the device represented by this SUT

test_object_factory

TestObjectFactory object, a factory for generating creating test objects for this SUT

sut_id

String representing the identification of this SUT - the identification will need to match with group id in parameters xml



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
# File 'lib/tdriver/base/sut/sut.rb', line 43

def initialize( sut_controller, test_object_factory, sut_id, test_object_adapter = nil )

  @sut_controller = sut_controller

  # remove this line when possible
  @_sutController = sut_controller

  # remove this line when possible
  @test_object_factory = test_object_factory
  
  # remove this line when possible
  @test_object_adapter = test_object_adapter || TDriver::TestObjectAdapter
  
  @id = sut_id

  # reference to self; easier to access (parent) SUT in shared behaviours applied to test object/sut/application 
  @sut = self
  
  # default values
  @input = :key      
  @type = "sut"

  @object_behaviours = []

  @environment = $parameters[ sut_id ][ :env ]

  @forced_xml = false

end

Instance Attribute Details

#environmentObject (readonly)

Returns the value of attribute environment.



32
33
34
# File 'lib/tdriver/base/sut/sut.rb', line 32

def environment
  @environment
end

#idObject

Returns the value of attribute id.



25
26
27
# File 'lib/tdriver/base/sut/sut.rb', line 25

def id
  @id
end

#inputObject

Returns the value of attribute input.



25
26
27
# File 'lib/tdriver/base/sut/sut.rb', line 25

def input
  @input
end

#test_object_adapterObject (readonly)

Returns the value of attribute test_object_adapter.



32
33
34
# File 'lib/tdriver/base/sut/sut.rb', line 32

def test_object_adapter
  @test_object_adapter
end

#typeObject (readonly)

Returns the value of attribute type.



32
33
34
# File 'lib/tdriver/base/sut/sut.rb', line 32

def type
  @type
end

#ui_typeObject

Returns the value of attribute ui_type.



25
26
27
# File 'lib/tdriver/base/sut/sut.rb', line 25

def ui_type
  @ui_type
end

#ui_versionObject

Returns the value of attribute ui_version.



25
26
27
# File 'lib/tdriver/base/sut/sut.rb', line 25

def ui_version
  @ui_version
end

Instance Method Details

#execute_command(command) ⇒ Object

Interface to forward command execution to sut specific controller (SutController#execute_command)

params

command

MobyBase::CommandData descendant object defining the command

raises

?

what ever SutController#execute_command( command ) raises

returns

Boolean

what ever SutController returns



80
81
82
83
84
# File 'lib/tdriver/base/sut/sut.rb', line 80

def execute_command( command )

  @sut_controller.execute_command( command )

end

#inspectObject

TODO: document me



87
88
89
90
91
# File 'lib/tdriver/base/sut/sut.rb', line 87

def inspect

  "#<#{ self.class }:0x#{ ( "%x" % ( object_id.to_i << 1 ) )[ 3 .. -1 ] } @id=#{ @id.inspect } @input=\"#{ @input }\" @type=\"#{ @type }\" @ui_type=\"#{ @ui_type }\" @ui_version=\"#{ @ui_version }\">"

end