Adichatz provide an original and easy to use solution for testing UI components.

  • Based on TestNG testing framework.
  • Launched automatically or on-demand from application (Test classes can be updated and relaunched).
  • Can easily simulate users actions.
  • Results are displayed and interpretable in specific editor.

How to test

Step 1: Add 'org.adichatz.testing' plugin

org.adichatz.testing plugin must be added to application environment.

  • Open file $projectDirectory/META-INF/MANIFEST.MF.
  • add line org.adichatz.testing, in Require-Bundle item.

If you try to relaunch the application, an error must occur.
java.lang.RuntimeException: No application id has been found.

Add 'org.adichatz.testing' plugin

To overcome this problem, follow instructions below:

  • Select Run > Run configurations….

A new window is open, then:

  • Select Plug-ins tab.
  • Select Add Required Plug-ins button.
  • In the same window, select Run button.

Add required plugins

Step 2: Create a Test class

A test case is composed of one or several Java classes with one ore several annoted methods.
Below, a simple Test class is described.

Create java class in package org.mycompany.myproject.testing.

package org.mycompany.myproject.testing;

import org.adichatz.engine.e4.core.PartCore;
import org.adichatz.engine.e4.part.BoundedPart;
import org.adichatz.engine.e4.resource.E4SimulationTools;
import org.adichatz.engine.simulation.SimulationTools;
import org.adichatz.testing.AdiAssert;
import org.adichatz.testing.TestingTools;
import org.testng.annotations.Test;

public class MyFirstTest {
	public void test() {
		// Select Option queriesMenus/filmQuery in navigator "groupNavigator" and return a part.
		BoundedPart filmQueryPart = E4SimulationTools.handleNavigatorOpenPartItem("groupNavigator", "queriesMenu", "filmQUERY");
		// check that part is active.
		TestingTools.testInfo("QueryForm with query 'filmQUERY' is active.");

		PartCore filmQueryCore = filmQueryPart.getGenCode();
		// Launch query in filmQuery part.
		SimulationTools.handleContextMenuAction(filmQueryCore, "tableCM:contextMenu", "launchQueryAction");

This test opens a QueryForm editor and launch a query to supply rows to the Table Controller contained in the editor.

  • Line 12: @Test annotation points out a method to be launched by TestNG.
  • Line 15: Simulates selection of Query Film in navigator.
  • Line 22: Executes launchQueryAction item in context menu.

A more complex Test class which checks databinding between Entity editors could be seen here.

Step 3: Add entry to 'AdichatzRcpConfig.xml' file

You need to add an simple entry in file $projectDirectory/resources/xml/AdichatzRcpConfig.xml as shown below:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<adichatzRcpConfigTree xmlns:xsi="" xsi:noNamespaceSchemaLocation="">
        <param id="defaultQueryMaxResults" value="200"/>
        <param id="defaultRefTextPopupURI" value="adi://org.adichatz.jpa/common/DefaultRefText"/>
        <param id="introPartURI" value="bundleclass://org.adichatz.engine/org.adichatz.engine.intro.DefaultIntroPanel"/>
        <param id="introOutlineURI" value="bundleclass://org.adichatz.jpa/org.adichatz.jpa.recent.RecentOutlinePage"/>
            <navigator id="groupNavigator" iconURI="platform:/plugin/org.adichatz.engine.e4/resources/icons/IMG_NAVIGATOR.png" contributionURI="bundleclass://org.adichatz.engine.e4/org.adichatz.engine.e4.part.GroupNavigator" label="adichatz.navigator" bundleURI="adi://org.adichatz.engine.e4/./adichatzEngineE4">
                <menuPath adiResourceURI="adi://myproject/groupNavigator/GroupNavigatorContent"/>
                <menuPath adiResourceURI="adi://org.adichatz.jpa/./JpaMenu"/>
    <testing expanded="true">
        <suite id="myFirstSuite" label="Suite example" launchOnStartup="false" expanded="true">
            <test id="myFirstTest" label="my first test" testURI="bundleclass://myproject/org.mycompany.myproject.testing.MyFirstTest"/>

A testing

  • Line 15: <testing expanded=“true”> means: A testing menu is added to existing navigators at runtime. The menu is expanded.
  • Line 16: A suite test case is created. The suite is expanded and is not launched automatically during the application startup process.

Step 4: Execute and reexecute tests

Execute a test

To execute or reexecute a test case, click on the corresponding item (my first test).

  • when a test fails, a specific editor was created for reporting test results and is automatically open.
  • Changes done on Test classes in Eclipse IDE are directly considered without relaunching the application.

Step 5: Show results

Display Testing results

A specific editor was created for reporting test results. By default, it is automatically open when a test fails.

  • A tree is used to report results.
    • Level Run: Displays the label of the suite or of the used testNG xml file.
    • Level Suite: Displays onStart event with main features: duration, sucesses, failures….
    • Level Class: Display label for class or onFinish event.
    • Level Test: Reports main features or the Test (a method with annotation @Test): duration, sucesses, failures…


Testing menu provides Testing tools options</wrap> as shown below:

Testing tools

  • Testing result manager: Opens and editor for reporting test results.
  • Display register for active editor: Display in the consol part all the entries of register for the active editor. These entries are used in Test class for naming controllers.
  • Refresh testing menu: Refresh current Testing menu. Changes made on IDE can be seen without having to quit the application.


tutorial/testing.txt · Last modified: 2015/10/05 17:52 (external edit)