Next: , Previous: Test case file details, Up: Python test case definition


7.3.2 MIN python extension library reference

MIN python extension library provides users with set of functions that enable them to use the same features as in other types of modules. Functions are described below (note that arguments are specified in order in which they should appear in function calls):

Print_to_cui
Prints specified message to MIN console UI
(mandatory) String
Contains message to be printed
Return value
Integer, always 0

Example:

     min_ext.Print_to_cui("Printout text")
Set_indication_event
Sets MIN event of type "indication" and specified name
(mandatory) String
Name of event to set
Return value
Integer, always 0

Example:

     min_ext.Set_indication_event("MyEventInd")
Set_state_event
Sets MIN event of type "state" and specified name
(mandatory) String
Name of event to set
Return value
Integer, always 0

Example:

     min_ext.Set_state_event("MyEventState")
Unset_event
Unsets MIN event of type "state" and specified name. Note, that only events of type "state" can be unset.
(mandatory) String
Name of event to unset
Return value
Integer, always 0

Example:

     min_ext.Unset_event("MyStateEvent")
Request_event
Requests event. If test case will be waiting for some event, it first needs to request.
(mandatory) String
Name of requested event
(optional) "state"
Keyword that should be specified if event is of type "state". If it is omitted system will assume that requested event is of type "indication"
Return value
Integer, always 0

Example:

     min_ext.Request_event("MyEventInd")
     
     min_ext.Request_event("MyEventState","state")
Release_event
Releases the previously requested event when it is not needed anymore.
(mandatory) String
Name of event to request
Return value
Integer, always 0

Example:

     min_ext.Release_event("MyEvent")
Wait_event
Waits on previously requested event
(mandatory) String
Name of event
Return value
Integer, 0 if event was properly received, other value in case of error

Example:

     min_ext.Wait_event("MyEvent")
Complete_case
Executes test case from other MIN test module. Function doesn't return until started test case finishes execution.
(mandatory) String
Name of test module
(optional)String
Name of test case file
(mandatory) String
Title of test case
Return value
Integer, result of test case (See Test Module API.)

Example:

     min_ext.Complete_case("min_hardcoded_module","testcase_title")
     
     min_ext.Complete_case("min_other_module","testcase_file","testcase_title")
Start_case
Starts asynchronous execution of test case from another module. Note that Python test case won't end until this test case finishes, but result of test case is not provided. It is possible to synchronize with this test case via events.
(mandatory) String
Name of test module
(optional)String
Name of test case file
(mandatory) String
Title of test case
Return value
Integer, always 0

Example:

     min_ext.Start_case("min_hardcoded_module","testcase_title")
     
     min_ext.Start_case("min_other_module","testcase_file","testcase_title")
Create_logger
Creates MIN logger structure (Keep in mind, that the logger created in test case has to be destroyed in the same case, otherwise there will be resource leak)
(mandatory) String
Path to log directory
(mandatory) String
Log filename
(mandatory) String
Log format (can be "html" or "txt")
Return value
Handle to MIN logger structure (used to log and destroy logger)

Example:

     My_logger = min_ext.Create_logger("/tmp","logfile.log","txt")
Log
Writes specified string to log
(mandatory) int
Handle to logger (returned by Create_log)
(optional) char
Style (can be "b" or "B" for bold, "u" or "U" for underline and "i" or "I" for italic - other values are ignored.). Styles work of course only in case of html logger.
(mandatory) String
Log message to write
Return value
Integer, always 0

Example:

     min_ext.Log(My_logger,"b","log this text")
Destroy_logger
Destroys MIN logger structures, required to free system resources allocated by Create_logger.
(mandatory) int
Handle to logger returned by Create_logger
Return value
Integer, always 0

Example:

     min_ext.Destroy_logger(My_logger)
Allocate_slave
Allocates slave device, in external controlled master/slave scenarios
(mandatory) String
Name of slave device
Return value
Integer, 0 if operation was successful, error value otherwise

Example:

     min_ext.Allocate_slave("other_device")
Free_slave
Releases slave device in external controlled master/slave scenarios
(mandatory) String
Name of slave device
Return value
Integer, 0 if operation was successful, error value otherwise

Example:

     min_ext.Free_slave("the_other_device")
Request_remote_event
Requests event from slave device in externally controlled master/slave scenarios
(mandatory) String
Name of slave device
(mandatory) String
Name of the event
(optional) "State"
Indicates if the requested event is of type state. If it is specified as a string different than "State" (case insensitive), or not specified at all, event will be considered indication event.
Return value
Integer, 0 if operation was successful, error value otherwise

Comment: After the event is requested from remote device, master test case can wait on it in the same way it would wait on local event.

Example:

     min_ext.Request_remote_event("other_device","some_indication_event")
     
     min_ext.Request_remote_event("the_other_device","some_state_event","state")
Release_remote_event
Releases previously requested remote event
(mandatory) String
Name of slave device
(mandatory) String
Name of event
Return value
Integer, 0 if operation was successful, error value otherwise

Comment: Function fails in case of problems in master/slave communication or faulty argument specification

Example:

     min_ext.Release_remote_event("other_device","event")
Run_remote_case
Executes Test case in previously allocated slave device
(mandatory) String
Name of slave device
(mandatory) String
Name of module
(optional) String
Test case filename
(mandatory) int
Number of test case
Return value
Integer, 0 if operation was successful, error value otherwise

Comment: Function is considered successful if remote test case was started. After that, only available method of communication with slave test case is by events. Result of remote test case will not be provided. However, python test case will not finish, until slave test case finishes (or external controller timeout expires).

Example:

     min_ext.Run_remote_case("other_device","hardcoded_min_module",1)
     
     min_ext.Run_remote_case("another_device","other_min_module","testcase_file",3)