TestOptimal Wiki

Model-Based Testing (MBT)

User Tools

Site Tools


Testing Embedded System

TestOptimal can be used to test Embedded System. Choose from the three options to test your embedded systems:

  • Java handler
  • Custom plugin
  • Remote agent

Also see a slide presentatio on Testing Embedded Systems with TestOptimal

Java Handler

Java Handler option is the easiest among the three options. You just write a java class to handle the specific model state and transition triggers to interact with your embedded system through appropriate API.

To create such java handler, first use TestOptimal IDE to generate the java handler skeleton java code from your model by following steps:

  • enter the java class path for the java handler class, e.g. com.mycompany.mbt.handlers.myHandler.
  • click on generate link next to the field Java Class/Groovy Script on Model Property.
  • copy and paste the generated java code into your Java IDE or any source code editor.
  • implement each of the stub class method to interact with your embedded system. This may involve calling specific external java packages or DLL (through JNI) to interact with the embedded system.
  • deploy Java Handler by copying the .class file to /bin/classes/ folder or the java source code file to /script/ folder.

See Example Java Handler for Embedded System

Java Handler is created for a specific model by design. This may be a good enough solution for some of the use cases. But this may not be desirable if you wish to have multiple models to share a set of common APIs to interact with embedded system, in which case consider Custom Plugin option.

Custom Plugin

Custom Plugin allows users to build a set of common MScript functions shared by multiple models to interact embedded system. These MScript functions are exposed to MScript to allow the model to control and access embedded system directly from the model triggers associated with the states and transitions.

First create and deploy a Custom Plugin with implementation of a set of MScript functions to interact with your embedded systems.

In TestOptimal IDE, enable your plugin on Model Property dialog and start writing MScript in MScript Editor to drive/interact with your embedded systems.

See Example Custom Plugin

Remote Agent

The above two options require that TestOptimal server and the embedded system (AUT) are hosted on the same computer. Often times this is not preferred or possible. Remote Agent allows your model to remotely interact with embedded systems over http link. In this architecture, TestOptimal server and the embedded system being tested can be a world apart as long as the computer hosting embedded system can communicate with TestOptimal server through http (internet/intranet).

To implement this option:

  • create a remote agent by creating a java class extending from com.webmbt.agent.TestOptimalAgent.
  • implement a few java classes including execute(RemoteCommand) to parse the remote commands received from TestOptimmal server and call appropriate API to interact with embedded systems.
  • write MScripction to send remote commands to your remote agent, e.g. $RemoteCommand.remoteCmd('cmd1', 'p1', …).

See Example RemoteAgent

To run the testing, just start your java application (remote agent) on the computer where your embedded system resides.

embeddedtesting.txt · Last modified: 2017/05/04 04:03 by admin