Component Resolvers

Marathon and MarathonITE use component resolvers to record and playback on a component. Marathon’s in built resolver supports all standard Java/FX™ controls. The resolver is sufficient for most cases where the components are derived from a standard java/fx control.

However, in cases where your custom component is not recognized by Marathon and the recording and playback are not to your satisfaction, you can develop a custom resolver to extends Marathon.

Java Agents

Your custom resolvers are passed as java agents to the marathon hook to the application. The premain method of the JavaAgent should initialize the behavior of the custom components. You need to bundle the custom resolver as a JAR file and pass it to the Marathon commandline.

When Marathon launches the application under test, all resolvers found in the classpath are passed as java agents to the application VM. Marathon adds all the JAR files that contain a class whose name ends with MarathonExtension to the command line. It is a good practice to name your class that contains premain as <Component>MarathonExtension.

Handling Recording

You need to develop a class that derives from RFXComponent and add it to the RFXComponentFactory.

You need to add your RFXComponent to the factory as follows:

The classes supporting recording are only available in recording mode. Use a guard to ensure that your initialization is performed only in recording mode. Move the recorder related initialization to a separate class to ensure that these classes are not accessed while playing back the test scripts.

In the premain method:

Handling Playback

Playback and recording should complement each other. For implementing playback, you derive your class from JavaFXElement and add it into JavaFXElementFactory.

The JavaFXElementFactory is updated as follows in the premain method:

The Sample Project

A sample resolver that implements custom recording/playback for ListView with custom ListCell from Ensemble8 application is available in downloads section.

The Sample project uses gradle to build and deploy. The project also contains a marathon Ensemble8 project, that you can use to check the resolvers.

Building The Project

  • Set MARATHON_HOME environment variable to point to Marathon/MarathonITE installation folder.
  • From the folder, execute .\gradlew build. The JAR file is created in build/libs folder.
  • You can launch Marathon/MarathonITE using the marathon-extension batch scripts.

Tips

The best place to look for different RFXComponent and JavaFXElement implementations is in the Marathon source code. You can download the source from github.