Skip to content

Modules

Modules are reusable setup steps that run before a test starts. They work the same way for web and mobile tests.

Use a module to:

  • continue where a previous test left off
  • prepare the test environment, like logging in
  • manage data
  • restore a specific application state

The module’s steps run first, then the primary steps of the new test begin.

Create module dialog


A module can be created from:

Source Notes
Another test Reuses the steps of a test you already have
Python script Must be reviewed and approved by a Klarent Admin before use

Typical uses for Python script modules:

  • clean the account data
  • reset the databases
  • inject test data, or populate the database with data to operate on
  • use your product’s internal API

  1. In the test creation window, click the + button below the instructions.

    Select module from library

  2. Select Modules and choose the module from your project library.

  3. Click Generate. The agent creates a Setup with Module step that contains all the logic of the module.


Modules can be chained to build layered test environments. For example, if Module B needs the user to be logged in, it can include Module A as its first step.

When a test uses a chained module, the whole path runs, from the base setup to the final state. The environment is fully prepared before the new test instructions start.

Module example

Example: multi-page bank account application

Section titled “Example: multi-page bank account application”

Instead of recording the whole flow every time, break it into modules that build on each other:

  1. Navigation module handles the initial page navigation.

    Navigation module

  2. Nav + Personal Details module uses the navigation module as its base, then goes straight to the Personal Details form without repeating the navigation steps.

    Nav + Personal details module

    Nav + Personal details module steps

    The module appears in a test as a single setup step:

    Module setup step

  3. Nav + Personal Details + Contact Details module uses the previous module as its base and also completes the Contact Details section.

    Select the module

    Nav + Personal Details + Contact Details steps 1

    Nav + Personal Details + Contact Details steps 2