Component Resolvers

Marathon and MarathonITE use component resolvers to record and playback on a component. Marathon’s in built resolver supports all standard Java/Swing™ components. The resolver is sufficient for most cases where the components are derived from a standard swing 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 RComponent and add it to the RComponentFactory.

You need to add your RComponent 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 AbstractJavaElement and add it into JavaElementFactory.

The JavaElementFactory is updated as follows in the premain method:

The Sample Project

A sample resolver that implements custom recording/playback for JPasswordField and Calculator from SwingSet3 application is available in downloads section.

The Sample project uses gradle to build and deploy. The project also contains a marathon SwingSet3 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.


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