3.3.1. Creating the fragment

The following steps have to be done to extend the remote control:

  1. Reference the zip-file
    development/org.eclipse.jubula.repo.zip
    as a Software Site in your Target Platform. Verify while adding the software site, that the check box Include required software is not checked. This software site also includes the Java documention of the source code.

  2. Set the installed software site as your target platform.

  3. Create a fragment project with one of the following IDs as host:

    • org.eclipse.jubula.rc.swing
      for extending Swing support.

    • org.eclipse.jubula.rc.swt
      for extending SWT support without RCP environment.

    • org.eclipse.jubula.rc.rcp.swt
      for extending SWT support in Eclipse 3.x and 4.x (including compatibility layer).

    • org.eclipse.jubula.rc.rcp.e3.swt
      for extending GEF support in Eclipse 3.x (without compatibility layer).

    • org.eclipse.jubula.rc.javafx
      for extending JavaFX support.

  4. Write your own adapter and Tester Classes.

If you are writing an extension for the JavaFX toolkit, make sure that your adapter and Tester Classes really get compiled with Java 8 and the Bundle-Required Execution Environment is also set to Java 8.

Adapters are used for all supported toolkits, i.e. Swing, SWT, GEF, RCP and JavaFX. They wrap and specify graphic components in a form we need for our Tester Classes. You can write your own adapter or reuse our existing adapters. We recommend reusing our adapters to take advantage of the already existing code.

Before we have a look at the remote control extension examples in Section 3.5, “ITE, client API and remote control extension examples”, we describe in general how to create an adapter and Tester Classes.

3.3.1.1. Creating an adapter

To use an adapter you have to implement the interface IAdapterFactory, which is defined in the package named org.eclipse.jubula.rc.common.adaptable. It is necessary that the implementation of this interface resists in a package named org.eclipse.jubula.ext.rc.common.adapter. The package naming is important for the remote control extension, because adapters can only be found if they are located in a package with the mentioned name.

In order to support your own components, the targeted type must be an instance of IComponent, which is defined in the package named org.eclipse.jubula.rc.common.tester.adapter.interfaces. This targeted type can be used for text components. If you want to support your own graphical component, you should at least use the interface IWidgetComponent as the targeted type, which is a child of IComponent. Both interfaces are defined in the same package.

For Swing, SWT and JavaFX there are also specific implementations of different adapters in the following packages, which can be used for your own component:

  • org.eclipse.jubula.rc.swing.tester.adapter

  • org.eclipse.jubula.rc.swt.tester.adapter

  • org.eclipse.jubula.rc.javafx.tester.adapter

Now we know how to create an own adapter in general. The next step is to implement one or more Tester Class.

3.3.1.2. Creating a Tester Class

The functionally important aspect of a Tester Class is that it contains public methods for the test actions, which will appear in the client. These methods are linked to testable actions within a user-defined ITE toolkit plug-in.

Each ITE toolkit extension provides an XML configuration file, which defines the available methods with parameters, as well as information for string externalization. Reflection is used to call these methods. For this reason, the signature of a defined method including its name, and the ordered parameter types are important for the remote control extension.

You can write your own Tester Classes, but if you only want to support a new component with existing actions, you could use one of our existing Tester Classes, which you can find in the package named org.eclipse.jubula.rc.common.tester. For Swing, SWT and JavaFX there are also specific implementations in the following packages:

  • org.eclipse.jubula.rc.swing.tester

  • org.eclipse.jubula.rc.swt.tester

  • org.eclipse.jubula.rc.javafx.tester

Please take the following guidelines into consideration for creating Tester Classes:

  • The class must not reside within the namespace / package of other classes of the ITE / RC part. If however this should be necessary you can safely use the package prefix org.eclipse.jubula.ext..

  • The class must be compatible with Java 1.5.

  • It must either

    • implement the interface ITester defined in the package named
      org.eclipse.jubula.rc.common.tester.interfaces,

    • or extend the abstract class AbstractUITester defined in the package named
      org.eclipse.jubula.rc.common.tester.

  • The component must provide public methods for all actions declared by the XML configuration file of the corresponding ITE toolkit extension.

  • Each method that implements an action must throw a StepExecutionException defined in the package named org.eclipse.jubula.rc.common.exception to notify the ITE if the execution of the action has failed.

3.3.1.3. Creating an container adapter

This is a JavaFX exclusive way to extend the functionality of Jubula. You can use this extension mechanism to make components "mappable" that are normally not, e.g. components which are part of the skin of a control. With the container extension mechanism you are able to add the possibility of mapping such components. But to keep the user experience in the object mapping like it is designed, such an extension has to be very specific.

The approach is very similar to creating an adapter. Just create an Adapter Factory and an Adapter Class like it is described in the corresponding chapter. You have to create this Adapter Class for the type of the direct parent node from the component which you wish to map to declare it to be a container. For example, if you want to map some content of a cell in a ListView, the type would be ListCell.

Additionally, your Adapter Class has to implement the interface IContainerAdapter. You have to implement the method getContent and return a list of the components which you wish to map.



Copyright BREDEX GmbH 2015. Made available under the Eclipse Public License v1.0.