Module: MobyBehaviour::QT::ConfigureBehaviour

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

Overview

description

Behaviours for configuring the logging services on the target.

behaviour

QtConfigureBehaviour

requires

testability-driver-qt-sut-plugin

sut_type

qt

input_type

All

sut_version

*

objects

sut;application

Constant Summary collapse

@@_valid_levels =
[ :FATAL, :ERROR, :INFO, :WARNING, :DEBUG ]

Instance Method Summary collapse

Methods included from Behaviour

#command_params

Instance Method Details

#clear_logObject

description

Clears the log file.

returns

NilClass

description: -
example: -


200
201
202
# File 'lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/configure_behaviour.rb', line 200

def clear_log
 configure_logger( {:clearLog => true} )
end

#disable_loggerObject

description

Disable the logging on the target for the given application or sut (qttasserver). Logs are left as they are.

returns

NilClass

description: -
example: -

exceptions

ArgumentError

description:  In case the given parameters are not valid.


79
80
81
# File 'lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/configure_behaviour.rb', line 79

def disable_logger		
 configure_logger( {:logEnabled => false} )
end

#enable_loggerObject

description

Enabled the logging on the target for the given application or sut (qttasserver). Logs are written to the target in (/logs/testability)

returns

NilClass

description: -
example: -

exceptions

ArgumentError

description:  In case the given parameters are not valid.


63
64
65
# File 'lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/configure_behaviour.rb', line 63

def enable_logger
 configure_logger( {:logEnabled => true} )
end

#log_events(event_list = '') ⇒ Object

description

Set the logger to log listed events. Events have to be separated by comma. e.g MouseEvent, Paint The event name does not have to be complete. e.g Mouse will log all events with the word Mouse.

arguments

event_list

String
 description:
  Comma separated list of events
  example: 'Mouse','Touch'

returns

NilClass

description: -
example: -


222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
# File 'lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/configure_behaviour.rb', line 222

def log_events( event_list = '')
 begin 

   params = {:logEvents => 'true'}
   perform_command( MobyCommand::ConfigureCommand.new( "configureEventLogging", params, event_list ) )		

 rescue Exception => e
   
   $logger.behaviour "FAIL;Failed to enable event logging. With event_list \"#{event_list};log_events"
   raise e        

 end      

 $logger.behaviour "PASS;Event logging enabled. With event_list \"#{event_list};log_events"

end

#log_qdebug(include = true) ⇒ Object

description

Set the qDebug message to be append to the logs or not. By default qDebug messages are not written to the logs.

arguments

include

Boolean
 description:
  True to log qDebug messages and false to not
  example: true

returns

NilClass

description: -
example: -


169
170
171
# File 'lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/configure_behaviour.rb', line 169

def log_qdebug(include = true)
 configure_logger( {:logQDebug => include} )
end

#log_to_qdebug(to_qdebug = true) ⇒ Object

description

Can be used to set logging to be done to qDebug. All tdriver target logging will go to qDebug not the log file.

arguments

to_qdebug

Boolean
 description:
  True to logs message to qDebug instead of a file.	  
  example: true

returns

NilClass

description: -
example: -


150
151
152
# File 'lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/configure_behaviour.rb', line 150

def log_to_qdebug(to_qdebug = true)
 configure_logger( {:logToQDebug => to_qdebug} )
end

#set_log_folder(folder) ⇒ Object

description

Change the folder to where the logs are written to for the application or sut (qttasserver).

arguments

folder

String 
 description:
  New location for the logs.
  example: '/tmp/logs'

returns

NilClass

description: -
example: -


131
132
133
# File 'lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/configure_behaviour.rb', line 131

def set_log_folder(folder)
 configure_logger( {:logFolder => folder} )
end

#set_log_level(level) ⇒ Object

description

Set the log level for the application or sut (qttasserver). Affects only the running process. Will not be stored as permanent setting.

arguments

level

Symbol 
 description:
  The log level.
  See [link="#log_levels_table"]Valid log levels table[/link] for valid keys. 
  example: :INFO

tables

log_levels_table

title: Valid log levels
|Level|Type|Description|
|:FATAL|Symbol|Log fatal level message|
|:ERROR|Symbol|Log fatal and error level messages|
|:INFO|Symbol|Log fatal, error and info level messages|
|:WARNING|Symbol|Log fatal, error, info and warning level messages|
|:DEBUG|Symbol|Log all messages|

returns

NilClass

description: -
example: -

exceptions

ArgumentError

description:  In case the given level is not valid.


113
114
115
# File 'lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/configure_behaviour.rb', line 113

def set_log_level(level)
 configure_logger( {:logLevel => level} )
end

#set_log_size(size) ⇒ Object

description

Set max size for the log file. When the level is reached the log file is renamed as old_“name of log file”.log and a new file is started. By default the size is 100000.

arguments

size

Fixnum
 description:
  The new log file size
  example: 500000

returns

NilClass

description: -
example: -


189
190
191
# File 'lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/configure_behaviour.rb', line 189

def set_log_size(size)
 configure_logger( {:logSize => size} )
end

#stop_event_loggingObject

description

Stop logging events.

returns

NilClass

description: -
example: -


247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
# File 'lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/configure_behaviour.rb', line 247

def stop_event_logging
 begin

   params = {:logEvents => 'false'}
   perform_command( MobyCommand::ConfigureCommand.new( "configureEventLogging", params) )		

 rescue Exception => e
   
   $logger.behaviour "FAIL;Failed to stop event logging.;stop_event_logging"
   raise e        

 end      

 $logger.behaviour "PASS;Event logging stopped.;stop_event_logging"

end