OTX-Runtime for C++
|
|
One of the most important benefit of OTX is the strict separation of test logic and runtime implementation. Some OTX extensions (HMI, Measure or ExternalServiceProvider) needs access to external systems. This systems are accessed via the OTX-Mapping. The OTX-Mapping is a platform independent access to arbitrary external systems. It can ensure that the same unchanged OTX test logic can be executed in any target system at any time and comes to the same results.
The OTX-Mapping can be edited with the OTX-Mapping Editor inside the OTX Development Environment. All information will be stored inside the so called OTX-Mapping file.
The following mappings exists:
All required mapping data for a specific target environment are stored in a XML file. Solely by exchanging this file, see runtime project settings, the same test logic can be executed in various target environments.
Note: The OTX-Mapping file can be set at the OTX-Runtime via the project settings, see IRuntimeSettings.OtxMapping.
Note: A nonexistent environment can be simulated via a so called Proxy, see Proxy Implementation or Environment Presets.
The standardized test logic in OTX only describes the interface inside an OTX-Signature, see left part of picture below. One of multiple so called custom implementations can be bound to this interface via the OTX-Mapping mechanism, see right part of picture below. OTX-Mapping means linking of the parameters of a signature to an element of an external environment and store it inside an OTX-Mapping file. An OTX-Mapping file can be edited in a graphical Mapping-Editor.
Note: The usage of custom implementations together with the API is described here: Custom Implementations.
It is possible that an external system does not support all parameters which are available in OTX test logic. These parameters can be set (simulated) via the so called environment presets to fix values, see OTX-Mapping Editor and will be stored inside the OTX-Mapping file.
Note: Environment presets are only valid for all not mapped Signature InOut- or Out-parameters as well as context variables (direction from environment into OTX-Runtime).
Note: If available, the
Value
of the parameter or context variable (not theInitValue
) will be set to the environment preset before the related method like OpenScreen or ExecuteDeviceService was called.
If there is no custom implementation available or the custom implementation is not needed, e.g. during authoring of OTX sequences, a proxy can be used. A proxy can simulate a complete environment. It is an implementation without function.
Note: If the Default Custom Implementation is used, all OTX-Mappings which maps to a proxy performs a NOP (no operation).
The following default custom implementations will be delivered with the OTX-Runtime, see Installation. They give the user an easy way to add its own implementation to OTX.
Note: The delivered default custom implementations only supports DotNet and are only available for Windows. To support other technologies or other systems like Linux own custom implementations must be written.
To work with the default custom implementations the following steps have to be done:
Note: A ScreenSignature can generated from a custom screen implementation inside the OTX-Mapping Editor
Note: Before setting the mapping file the related custom implementation must be set, see IRuntimeManager.SetCustomImplementation
Important: An external application and all its dependencies must exist in ExternalAppPath!
Note: The user can also implement its own custom implementations with OTX-Mapping!
Note: If the user uses the OTX-Runtime API the custom implementations must integrated, see Integration. If the user uses the OTX Development Environment the integration is already done.
The usage of the OTX-Mapping in own custom implementations is optional but recommended. To use the OTX-Mapping inside own custom implementations, the related interfaces for the different OTX-Mappings must be implemented, see table below.
Mapping | Interface | Root Object | Parameter | Description |
---|---|---|---|---|
ScreenMapping | ICustomScreenImplementation | IScreenHandle | IScreenParameter | HMI custom screens which can be opened via OpenScreen |
DeviceMapping | IMeasureImplementation | IDeviceService | IDeviceServiceParameter | Measure device services which can be executed via ExecuteDeviceService |
ServiceProviderMapping | IExternalServiceProviderImplementation | IServiceProvider | IExternalParameter | ExternalServiceProvider service which can be executed via ExecuteService |
ContextMapping | IContextVariableImplementation | IStateVariable | n.a. | Context variables which value can get via GetValue |
StateMapping | IStateVariableImplementation | IContextVariable | n.a. | State variables which value can set via SetValue |
The information related to OTX-Mapping will be provided by the OTX-Runtime API and must be also managed by the own custom implementation. The table below lists all available properties related to OTX-Mapping.
Important: The OTX-Runtime API only provides the mapping information from the selected OTX-Mapping file. The handling of this information is task of the related CustomImplementation!
Important: All root objects and parameters which have no mapping (empty MappingName) should be ignored!
Property | Scope (see table above) | Description |
---|---|---|
AppId | Root Object | Gets the Id of the mapped external application. The id identifies the external application inside the mapping file. The Project Setting "Settings.Runtime.ExternalApps" gets a map of all AppIds and the name of the related binary file. |
MappingName | Root Object and Parameter | The mapping name is the full qualified name of the element inside the external system, which is mapped to the OTX element. It contains all namespace elements separated by dots ("."). |
MappingIndex | Parameter | An OTX parameter can be mapping a list element of property inside the external application. This property contains the related index. |
An own custom implementation must handle all parameters which are related to OTX-Mapping, see above. But there are some special parameters, the so called literal parameters, which must be handled too:
A literal parameter exists inside the external system but does not exists in the related OTX Signature. A literal parameter represents a parameter of an external object like a screen or a device, which will be set to a fix (literal) value, if it is mapped to a literal inside the mapping file, see OTX-Mapping Editor.
The OTX Mapping-Editor is part of the OTX Development Environment and can be also executed stand-alone. Inside the OTX mapping editor all mapping can be created and edited graphically as follows:
Note: An external application and all its dependencies must exist in ExternalAppPath.
Note: All dependencies to an external application do not need to be added. But they must be exist in the same directory like the external application.
Note: The left part lists all valid elements found in the external application.
Note: The right part lists the corresponding OTX elements.
Note: Which elements matches is described above.
Note: If a parent element is selected in the right part, a new OTX element can also be generated by clicking at the create arrow.
Note: For all not already mapped Signature InOut- or Out-parameters as well as context variables a certain value can be specified. During procedure execution the OTX runtime will set this parameter
Value
at the specified value.
A sample solution for the OTX Development Environment which shows the different kinds of OTX-Mapping can be found below:
OTF Sample Solution for OTX-Mapping with Player
Note: Unzip into the OTF projects folder and open the solution file (
EmotiveSampleSolution\EmotiveSampleSolution.otfSln
) inside OTF.
Note: The assembly (APP) must be copied into ExternalAppPath.
Note: The source code of the custom implementations can be found in folder
\EmotiveSampleSolution\OtxMappingSample\OTX-Mapping.