Share this page

# Generate application model code

This topic includes information on the different ways to generate application model code.

In this topic:

## Methods for generating the code file

Application models include two types of files: an XML file (.tsrx) and a code file (.tsrx.cs or .java). The code file is generated from the XML file. For details, see Overview.

The code file can be generated in the following ways:

- The OpenText Functional Testing for Developers IDE plugin automatically generates the code file when the testing project is opened in the IDE.
- Using a command line tool. This method is recommended when you want to generate the code file or multiple code files without opening your testing projects. For details, see AppModel code generation tool.
- For Maven-based projects, we recommend that you use the Maven plugin (Mojo). Use this method to automatically generate the code when the project is built. For details, see Maven application model generator plugin.

Back to top

## AppModel code generation tool

Use the AppModel code generation tool to generate the application model code files. This is a useful method when you upgrade, especially when dealing with multiple files. For details, see Upgrade.

There are two tools: one for Java and one for C#. Use the one relevant for your project.

Run the tool for every project that includes an application model.

You can run the tool in one of the following modes:

- Single file mode. Generates a single application model from a single .tsrx file.
- Source folder mode. Generates application models for all .tsrx files under the Source folder.

The sections below describe how to run the Java and C# tools.

Back to top

## Run the Java code generation tool

Run the Java tool from the following location:

Windows: <Installdir>\Tools\AppModelCodeGenerator\Java\

Linux/Mac: <Installdir>/Tools/appmodel-code-generator/Java

To run the Java tool in the single file mode

Use the following format:

    java -jar appmodel-code-generator.jar <tsrx path> -package <package name> -outputDir <output directory> -inPlace -sdk <sdk standalone jar>

Command argument | Description
--- | ---
<tsrx path> | The full path to the .tsrx file.
-package (mandatory) | The package name of the generated application model java file. Example: com.company
-outputDir | Sets the directory to the starting place of the generated file package. Example: if the package is com.company and output directory is set to /tmp, then the generated file is placed in /tmp/com/company. Note: You must supply either -outputDir or -inPlace (not both).
-inPlace | The generated file is placed in the same folder as the .tsrx file. Note: You must supply either -outputDir or -inPlace (not both).
-sdk (optional) | The path to the sdk standalone JAR. The default is the JAR from the product installation. Note: You must use this argument if you run the tool on a machine without an installation.

To run the Java tool in the source folder mode

Use the following format:

    java -jar appmodel-code-generator.jar <Source folder path> -outputDir <output directory> -inPlace -sdk <sdk standalone jar>

Command argument | Description
--- | ---
<Source folder path> | The path of the source folder. The source folder is the root folder for your Java project's source files. If you set only this parameter, then the files are generated to the appmodels folder next to the source folder.
-outputDir (optional) | Sets the directory to the starting place of the generated files package. Example: if the package is com.company and output directory is set to /tmp, then the generated file is placed in /tmp/com/company. Note: You can supply either -outputDir or -inPlace (not both).
-inPlace (optional) | The generated files are placed in the same folder as the .tsrx file. Note: You can supply either -outputDir or -inPlace (not both).
-sdk (optional) | The path to the sdk standalone JAR. The default is the JAR from the product installation. Note: You must use this argument if you run the tool on a machine without an installation.

Back to top

## Run the C# code generation tool

Run the C# tool from the following location:

Windows: <Installdir>\Tools\AppModelCodeGenerator\DotNet\

To run the C# tool in the single file mode

Use the following format:

    AppModelCodeGenerator.exe <tsrx path> -namespace <namespace name> -outputDir <output directory> -inPlace -sdk <sdk dll>

Command argument | Description
--- | ---
<tsrx path> | The full path to the .tsrx file.
-namespace(mandatory) | The namespace name of the generated application model C# file. Example: LFT.TESTS
-outputDir | Sets the directory to the starting place of the generated file package. Example: if the namespace is LFT.TESTS and output directory is set to c:\tmp, then the generated file is placed in c:\tmp\LFT\TESTS. Note: You must supply either -outputDir or -inPlace (not both).
-inPlace | The generated file is placed in the same folder as the .tsrx file. Note: You must supply either -outputDir or -inPlace (not both).
-sdk (optional) | The path to the sdk DLL. The default is the DLL from the product installation. Note: You must use this argument if you run the tool on a machine without an installation.

To run the C# tool in the source folder mode

Use the following format:

AppModelCodeGenerator.exe <Source folder path> -namespace <namespace name> -inPlace -outputDir <output directory> -sdk <sdk dll>

Command argument | Description
--- | ---
<Source folder path> | The path of the source folder. If you set only this parameter, then the files are generated to the appmodels folder next to the source folder.
-namespace(mandatory) | The to level namespace name of the generated application model C# file. Example: LFT.TESTS
-outputDir (optional) | Sets the directory to the starting place of the generated file package. Example: if the namespace is LFT.TESTS and output directory is set to c:\tmp, then the generated file is placed in c:\tmp\LFT\TESTS. Note: You can supply either -outputDir or -inPlace (not both).
-inPlace (optional) | The generated file is placed in the same folder as the .tsrx file. Note: You can supply either -outputDir or -inPlace (not both).
-sdk (optional) | The path to the standalone sdk DLL. The default is the DLL from the product installation. Note: You must use this argument if you run the tool on a machine without an installation.

Back to top

## Maven application model generator plugin

The Maven application model generator plugin can be used to automatically generate application model code whenever a Maven-based project is built.

Perform the following for each Maven-based project.

Dependencies

The application model code generator Mojo is dependent on the following JARs:

- OpenText Functional Testing for Developers common and SDK JARs.

  Make sure that they are installed in your local or remote repository. For details, see Prerequisites for Maven-based projects.

- AppModel code generator (helper) JAR.

  To deploy the JAR to your organization's repository, run the following command:

  mvn deploy:deploy-file

  -DpomFile=<path-to-pom>

  -Dfile=<path-to-file>

  -DrepositoryId=<id-to-map-on-server-section-of-settings.xml>

  -Durl=<url-of-the-repository-to-deploy>

  To install the JAR to your local repository, run the following command:

  mvn install:install-file

  -Dfile=<path-to-file>

  -DpomFile=<path-to-pomfile>

  The path to the JARs and POMs is:

  - Windows: <Installdir>\Tools\AppModelCodeGenerator\Java
  - Linux/Mac: <Installdir>/Tools/appmodel-code-generator/Java

  JAR | POM
  --- | ---
  appmodel-code-generator-helper.jar | appmodel-code-generator-helper-pom.xml

To configure the plugin

1. Install the Mojo to your Maven repository. (Follow the instructions in Dependencies.):

   appmodel-code-generator-mojo-2025.2.0.jar

   appmodel-code-generator-mojo-2025.2.0-pom.xml

2. Enable the plugin.

   Open the project pom.xml file and uncomment the Application model generator plugin section.

3. (Optional) Configure where the generated code file is placed.

   By default, the file is generated under the appmodels folder in the project.

   To change the location:

   1. Copy the following code into the configuration element in the Maven plugin section in the pom.xml:

          <!--The output directory of the generated application models.The Default is the appmodels folder under the project-->

          <!--<outputDir>set_path</outputDir> -->

          <!--If set to true, the  application models are generated next to the tsrx files. Mutually exclusive with the outputDir parameter -->

          <!--<inPlace>true</inPlace> -->

   2. Uncomment either the outputDir or the inPlace element, and edit as required.
4. Save your changes to the file.

Back to top

See also:

- Upgrade

https://admhelp.microfocus.com Functional Testing for Developers 8942
Tips to improve your search results... OpenText™ Functional Testing for Developers Help Center OpenText™ Functional Testing for Developers Help 25.2 All View Local Help Center View Online Help Center Version: