Edit Code Templates (Advanced)

Search Knowledge Base by Keyword

< Back

Edit Code Templates

If you have your own automation framework it will be architectured in a particular way with specific naming conventions and coding standards. Everything in TestModeller.io previously created was done so using code templates which define the structure and type of code to be created. In this section, we’ll review the associated templates and where to edit them.

Create Code Template

  1. Go to the configuration tab under the workspace sidebar submenu.
  2. Select the code template tab within the configuration page.
  3. Click the ‘New Template’ button to create a new code template.
  4. You will be presented with a dialog and asked to specify an appropriate template name. You can select two types of template to produce. Either a page object, or a test case template. It is often easier to select an existing template to copy from and then edit it to create your desired code template.
  5. Once the template is created you can open it and edit associated code, along with adding new code snippets. You’ll find the list of the available keywords below the template that can be plugged into your template files.

Consume a Custom Page Object Template

  1. Once a page object template is created you will want to use it in your framework.
  2. Navigate to the projects and releases tab in the sidebar.
  3. Select the project you want the code template to be applied to.
  4. Finally, navigate to settings within the project and set the automation server along with the page object template to the associated values.
  5. Next time you perform a scan (as shown in section 3.) it will utilise this configuration for the project to create the associated module and automation code.

Consume a Custom Test Case Template

  1. Once you have generated tests in TestModeller.io and are in the execution screen (as shown in section 5.).
  2. Select the ‘Create tests’ jobs as previously shown.
  3. This time you can specify the new code template you have created. The automation scripts will be generated using the specified template and appear in the resulting /code directory for consumption into your automation framework.