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.

Creating a module
Section titled “Creating a module”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
Using a module in a test
Section titled “Using a module in a test”-
In the test creation window, click the
+button below the instructions.
-
Select Modules and choose the module from your project library.
-
Click
Generate. The agent creates a Setup with Module step that contains all the logic of the module.
Chaining modules
Section titled “Chaining modules”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.

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:
-
Navigation module handles the initial page navigation.

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


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

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


