Class: MobyBehaviour::QT::ApiMethod::Method

Inherits:
Object
  • Object
show all
Defined in:
lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/qt_api_method.rb

Constant Summary collapse

RETURN_RESULT_VALUE =
0x01
RETURN_RESULT_AS_LIST =
0x02
RETURN_RESULT_AS_XML =
0x03

Instance Method Summary collapse

Constructor Details

#initialize(parent, fixture_name) ⇒ Method

Returns a new instance of Method.

Raises:

  • (ArgumentError)


55
56
57
58
# File 'lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/qt_api_method.rb', line 55

def initialize( parent, fixture_name )
	raise ArgumentError.new("Invalid argument type for fixture name. (Actual: %s, Expected: String)" % [ fixture_name.class.to_s ] ) unless fixture_name.kind_of?( String )
	@parent, @fixture_name = parent, fixture_name
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_name, *args, &block) ⇒ Object



69
70
71
# File 'lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/qt_api_method.rb', line 69

def method_missing( method_name, *args, &block )
	execute( RETURN_RESULT_VALUE, 'invoke_method', { :method => "#{ method_name }", :args =>  MobyUtil::FixtureParameter.new( *args ).to_s } )
end

Instance Method Details

#debug_invoke_method(method_name, *args) ⇒ Object



73
74
75
76
# File 'lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/qt_api_method.rb', line 73

def debug_invoke_method( method_name, *args )
	# call methods normally
	execute( RETURN_RESULT_AS_XML, 'invoke_method', { :method => "#{ method_name }", :args =>  MobyUtil::FixtureParameter.new( *args ).to_s } )
end

#list_class_methods(class_name) ⇒ Object

Raises:

  • (ArgumentError)


64
65
66
67
# File 'lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/qt_api_method.rb', line 64

def list_class_methods( class_name )
	raise ArgumentError.new("Invalid argument type for class name. (Actual: %s, Expected: String)" % [ class_name.class.to_s ]) unless class_name.kind_of?( String )
	execute( RETURN_RESULT_AS_LIST, 'list_class methods', { :class => class_name } )
end

#list_methodsObject



60
61
62
# File 'lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/qt_api_method.rb', line 60

def list_methods
	execute( RETURN_RESULT_AS_LIST, 'list_methods' )
end