OtfOtxMapping
Contents
Introduction
One of the most important benefit of OTX is the strict separation of test logic and runtime implementation. The so called “OTX Mapping” is a platform independent access to arbitrary external systems. It can be edited inside the graphical mapping editor. The mapping consists of 4 different parts, see picture below: First, the Screen-Mapping realize an access to controls inside a graphical user interface. The Device-Mapping can execute device services inside an arbitrary device driver like a native DLL and can return their results. The context and the state mapping reads information from or writes it to the environment.
![]() |
Overview OTX Mapping |
- Allows the user an unlimited communication with any external systems from inside OTX. For example, Test bench hardware, measurement data acquisition, web services, special graphical interfaces, etc.
- Platform neutral
- In OTX there are 4 ways to communicate with systems outside of OTX:
- Screen signatures (Note: A signature describes the parameters of an interface)
- Device signatures
- Context variables
- Status variables
- In OTX, there are various activities to use the screen and device signatures as well as the context and status variables, e.g. OpenScreen or ExecuteDeviceService.
- OTX mapping binds these activities to an existing external system at runtime. According to the element to be bound, this is called:
- Screen Mapping: Binds a screen signature to an external screen (e.g. AssemblyScreen)
- Device mapping: Binds a device signature to a public method in a DotNet assembly
- Context mapping: Bind the reading of a context variable to a property (read only) in a DotNet assembly
- Status mapping: Bind the writing of a status variable to a property (write only) in a DotNet assembly
- The OTX mapping is saved to a file
Implementations
There are currently the following implementations for external systems.
- Proxy
- Assembly Screen
- DotNet Assembly
- Web Service
- Implementation by user (event interface)
Each implementation has special system requirements and can not be executed on every target system!
- New implementations can easily be added if needed.
- The selected implementation is stored in the so-called OTX mapping file. By exchanging this file, the same OTX procedure can be executed on different target systems (e.g., test bench A from manufacturer 1 or test bench B from manufacturer 2).
Proxy
A proxy will be used if there is no real implementation or implementation by the user, see below. A proxy is an implementation without function.
![]()
When a procedure is executed which is used a proxy, all activities with access to external systems, e.g. OpenScreen or ExecuteDeviceService, perform a NOP (no operation).
- A proxy stores the interface in an XML file
- A proxy can be graphically edited in the OTX Mapping Editor
- The OTX mapping editor can generate screen and device signatures as well as context and status variables from a proxy, and vice versa.
AssemblyScreen
An AssemblyScreen implementation is a DotNet class that is marked as a screen by special attributes, see table below. The attributes show the OTX Runtime which public methods, properties or events are used to open a screen or set a parameter. The screen can be implemented with an arbitrary complexity within the class, e.g. in WPF. In some cases, it may be useful not to create a screen, but to do something else, e.g. a database access.
C# Code Sample
using System;
using System.ComponentModel;
using System.Windows.Forms;
using OtxMappingSample.Attribute;
using OtxMappingSample.Forms;
namespace OtxMappingSample
{
[OtxScreenSignature]
public class Screen1
{
#region fields
private string inputText;
private bool checkedBox = false;
private static int count = 0;
private string buttonText;
private Screen1Form diplayWindow;
public delegate void ScreenSignatureParameterValueChangedEventHandler(string propertyName, object value);
#endregion
#region ctors
public Screen1()
{
}
#endregion
#region screen methods
[OtxScreenSignatureParameterValueChangedEvent]
public event ScreenSignatureParameterValueChangedEventHandler ScreenSignatureParameterValueChangedEvent;
[OtxOpenScreen]
public Form OpenScreen()
{
if (diplayWindow == null)
{
diplayWindow = new Screen1Form();
diplayWindow.Closed += DiplayWindow_Closed;
diplayWindow.textBoxTest.TextChanged += new EventHandler(textBoxText_TextChanged);
diplayWindow.checkBoxTest.CheckedChanged += new EventHandler(checkBox_CheckedChanged);
diplayWindow.buttonClick.Click += new EventHandler(buttonClick_Click);
diplayWindow.buttonClose.Click += new EventHandler(buttonClose_Click);
}
return diplayWindow;
}
[OtxCloseScreen]
public void CloseScreen()
{
if (diplayWindow != null)
{
diplayWindow.Closed -= DiplayWindow_Closed;
diplayWindow.Close();
diplayWindow = null;
}
}
[OtxHighlightScreen]
public void HighlightScreen()
{
if (diplayWindow != null)
{
diplayWindow.Activate();
}
}
[OtxScreenIsOpen]
public bool ScreenIsOpen
{
get { return diplayWindow != null; }
}
#endregion
#region screen parameters
[OtxScreenSignatureInParameter]
[Description("The screen title")]
public string Title
{
set
{
if (diplayWindow == null)
{
return;
}
diplayWindow.labelTitle.Text = value;
}
}
[OtxScreenSignatureInOutParameter]
[Description("The input text")]
public string Text
{
get
{
return this.inputText;
}
set
{
this.inputText = value;
this.diplayWindow.textBoxTest.Text = value;
}
}
[OtxScreenSignatureOutParameter]
[Description("The input text")]
public bool Checked
{
get
{
return this.checkedBox;
}
}
[OtxScreenSignatureOutParameter]
[Description("The input text")]
public string ButtonText
{
get
{
return this.buttonText;
}
}
#endregion
#region helper
private void buttonClose_Click(object sender, EventArgs e)
{
this.CloseScreen();
}
private void buttonClick_Click(object sender, EventArgs e)
{
count++;
this.buttonText = diplayWindow.buttonClick.Text + " " + count;
if (ScreenSignatureParameterValueChangedEvent != null)
{
ScreenSignatureParameterValueChangedEvent("ButtonText", this.buttonText);
}
}
private void checkBox_CheckedChanged(object sender, EventArgs e)
{
this.checkedBox = diplayWindow.checkBoxTest.Checked;
if (ScreenSignatureParameterValueChangedEvent != null)
{
ScreenSignatureParameterValueChangedEvent("Checked", this.checkedBox);
}
}
private void textBoxText_TextChanged(object sender, EventArgs e)
{
this.inputText = diplayWindow.textBoxTest.Text;
if (ScreenSignatureParameterValueChangedEvent != null)
{
ScreenSignatureParameterValueChangedEvent("Text", this.inputText);
}
}
private void DiplayWindow_Closed(object sender, EventArgs e)
{
CloseScreen();
}
#endregion
}
}
![]()
In this case, the method indicated by the OpenScreen attribute can also return NULL.
Attribute List
The following table lists all supported attributes:
Attribute | Description |
[OtxScreenSignature] | Class containing the screen. There can be several classes. |
[OtxScreenSignatureTermParameter] | Write property that sets the value of a ScreenSignatureTermParameter |
[OtxScreenSignatureInParameter] | Write property that sets the value of a ScreenSignatureInParameter |
[OtxScreenSignatureOutParameter] | Read property, which reads out the value of a ScreenSignatureOutParameter |
[OtxScreenSignatureInOutParameter] | Read and write property that reads or sets the value of a ScreenSignatureInOutParameter |
[OtxScreenIsOpen] | Reading property, which checks if the screen is open |
[OtxOpenScreen] | Method in which the screen is generated (returns a form object of this screen) |
[OtxCloseScreen] | Method in which closes the screen |
[OtxHighlightScreen] | Method in which the screen comes to the foreground |
[OtxScreenSignatureParameterValueChangedEvent] | Event that the OTX Runtime signals that a parameter has changed in the screen |
[OtxStructure] | Class describing an OTX structure |
[OtxStructureElement] | Read and write property within the class that describes an element of the structure |
[Description] | Optional description for display in the OTX Mapping Editor |
DotNet Assembly
A DotNet Assembly implementation is a DotNet class which public methods can be bound to a device service. A bound method can be called inside OTX via an ExecuteDeviceService activity. The called device service can be implemented with an arbitrary complexity within this class.
C# Code Sample
using System.Windows.Forms;
namespace OtxMappingSample
{
public class Device1
{
#region fields
#endregion
#region ctors
public Device1()
{
}
#endregion
#region methods
public bool Service1(string message, string title)
{
DialogResult result = MessageBox.Show(message, title, MessageBoxButtons.OKCancel);
return result == DialogResult.OK;
}
#endregion
}
}
Web Service
The web service implementation allows the author to call a web service from inside OTX. An example Web service for Euro conversion is http://webservices.gama-system.com/exchangerates.asmx. The services found in the web service are bound to a device service, which can be called via the ExecuteDeviceService activity.
![]() |
OTX Mapping Editor for Web Service |
User-specific (Event Interface)
The user can also implement his own implementation via the event interface of the OTX Runtime API. Detailed information can be found in the OTX Runtime user documentation (DotNet/Java). If the activity is called within an OTX procedure, the OTX Runtime API fires the corresponding event. In the event processing function, the user can then implement his own implementation.
Mapping Editor
Inside the OTX mapping editor all mapping links can be created and edited graphically as follows:
1. Add the external application to the mapping
![]()
An external application can be stored in a central directory or within the project. This is a global OTF setting.
![]()
All dependencies to an external application do not need to be added. But they must be exists in the same directory as the external application!
2. Create the mappings separately for screen, device, context and status mapping as follows:
![]()
The left part lists valid elements found in the external application
![]()
The right part lists the corresponding OTX elements.
3. Select two matching elements on the left and the right list.
![]()
Which elements matches is described above the list.
4. Clicked at the arrow between the two lists.
![]()
If a parent element is selected in the right part, a new OTX element can also be generated by clicking at the arrow.
5. Optionally specify the environment preset values to simulate a certain environment.
![]() |
OTX Mapping Editor |