Module: MobyBehaviour::QT::Method

Includes:
Behaviour
Defined in:
lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/method.rb

Overview

description

Method specific behaviours

behaviour

QtMethod

requires

testability-driver-qt-sut-plugin

input_type

*

sut_type

qt

sut_version

*

objects

*

Instance Method Summary collapse

Methods included from Behaviour

#command_params

Instance Method Details

#call_method(method_name, *params) ⇒ Object

exceptions

RuntimeError

description: invoking the method failed

Raises:

  • (ArgumentError)


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
101
102
103
104
105
# File 'lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/method.rb', line 76

def call_method( method_name, *params )

	raise ArgumentError.new( "Method name was empty" ) if method_name.empty?
	command = command_params #in qt_behaviour      
	command.transitions_off     
	command.command_name( 'CallMethod' )

     # Syntactically terrible..
     pars = {'method_name' => method_name.to_s }

     params.each_with_index{ |param,i|
       case param
       when String
           key = "S"
       when Fixnum
           key = "I"
       when Float
           key = "D"
       when TrueClass,FalseClass
           key = "B"
       else
         raise ArgumentError.new( "Method parameter #{i}: Only String,Fixunum,Float and Boolean types are supported" ) 
       end
      pars["method_param#{i}"] = key+param.to_s
     }
	command.command_params(pars)
	command.service( 'objectManipulation' )

	returnValue = @sut.execute_command( command )
end