Edit online

Creating and Running Automated Tests

If you have developed complex custom plugins or frameworks (document types), the best way to test your implementation and ensure that further changes will not interfere with the current behavior is to make automated tests for your customization.

An Oxygen XML Author standalone installation includes a main oxygen.jar library located in the [OXYGEN_INSTALL_DIR]. That JAR library contains a base class for testing developer customizations named: ro.sync.exml.workspace.api.PluginWorkspaceTCBase.

To develop JUnit tests for your customizations using the Eclipse workbench, follow these steps:

  1. Create a new Eclipse Java project and copy the entire contents of the [OXYGEN_INSTALL_DIR] folder to the new project under the oxygen sub-directory.
  2. Add all JAR libraries present in the ./oxygen/lib directory to the Java Build Path->Libraries tab. Make sure that the main JAR library oxygen.jar or oxygenAuthor.jar is the first one in the Java classpath by moving it up in the Order and Export tab.
  3. Click Add Library and add the JUnit and JFCUnit libraries.
  4. Create a new Java class that extends ro.sync.exml.workspace.api.PluginWorkspaceTCBase.
  5. Pass the following parameters to the constructor of the super class:
    • File installationFolder - The file path to the main application installation directory. If not specified, it defaults to the folder where the test is started. According to step 1, it should be oxygen.
    • File frameworksFolder - The file path to the frameworks directory. It can point to a custom framework directory where it resides. According to step 1, it should be oxygen/frameworks.
    • File pluginsFolder - The file path to the plugins directory. It can point to a custom plugin directory where it resides. According to step 1, it should be oxygen/plugins.
    • File optionsFolder - The folder that contains the application options. If not specified, the application will auto-detect the location based on the started product ID.
    • String licenseKey - The license key used to license the test class.
    • int productID - The ID of the product and should be one of the following: PluginWorkspaceTCBase.XML_AUTHOR_PRODUCT, PluginWorkspaceTCBase.XML_EDITOR_PRODUCT, or PluginWorkspaceTCBase.XML_DEVELOPER_PRODUCT.
  6. Create test methods that use the API in the base class to open XML files and perform various actions on them.