# LoadRunner Operator

This page introduces the LoadRunner operator, a workflow operator that allows piloting performance tests on a target system by leveraging Micro Focus LoadRunner. This page assumes you are familiar with the definition of a workflow and its tasks. If this is not the case, then check [Creating automation workflows](https://docs.akamas.io/akamas-docs/3.6/using/workflow).

## Prerequisites <a href="#prerequisites" id="prerequisites"></a>

This section provides the minimum requirements that you should meet to use this operator.

### Supported versions <a href="#supported-versions" id="supported-versions"></a>

* Micro Focus LoadRunner 12.60 or 2020
* Microsoft Windows Server 2016 or 2019
  * Powershell version 5.1 or greater

### User and WinRM configuration <a href="#user-and-winrm-configuration" id="user-and-winrm-configuration"></a>

To configure WinRM to allow Akamas to launch tests please read the [Integrating LoadRunner Professional](https://docs.akamas.io/akamas-docs/3.6/integrating/integrating-telemetry-providers/loadrunner-professional-provider) page.

All LoadRunner test files (VuGen scripts and folder, lrs files) and their parent folders, must be readable and writable by the user account used by Akamas.

## Configuration options <a href="#configuration-options" id="configuration-options"></a>

When you define a task that uses the LoadRunner operator you should specify some configuration information to allow the operator to connect to the LoadRunner controller and execute a provided test scenario.

You can specify configuration information within the `arguments` that are part of a task in the YAML of the definition of a workflow.

You can avoid specifying each configuration information at the task level, by including a `component` property with the name of a component; in this way, the operator will take any configuration information from the properties of the referenced component

### Required properties <a href="#configuration-options-reference" id="configuration-options-reference"></a>

* `controller` - a set of pieces of information useful for connecting to the LoadRunner controller
* `scenarioFile` - the path to the scenario file within the LoadRunner controller to execute the performance test
* `resultFolder` - the path to the performance tests results folder with the LoadRunner controller

#### Connect to a LoadRunner controller <a href="#connect-to-a-loadrunner-controller" id="connect-to-a-loadrunner-controller"></a>

To make it possible for the operator to connect to a LoadRunner controller to execute a performance test you can use the `controller` property within the workflow task definition:

```yaml
controller:
  hostname: loarrunner.example.com
  username: Domain\LoadRunnerUser
  password: j(sBdH5fsG9.I56P%7n2XPjmgO6!ARm=
```

## Operator arguments <a href="#configuration-options-reference" id="configuration-options-reference"></a>

This table reports the configuration reference for the `arguments` section.

| Field                   | Type   | Value restrictions                                                         | Required | Default                                                     | Description                                                                                                                                                                                                                                                                                                                   |
| ----------------------- | ------ | -------------------------------------------------------------------------- | -------- | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `controller`            | Object |                                                                            | Yes      |                                                             | The information required to connect to LoadRunner controller machine.                                                                                                                                                                                                                                                         |
| `component`             | String |                                                                            | No       |                                                             | The name of the component from which the operator will take its configuration options                                                                                                                                                                                                                                         |
| `scenarioFile`          | String | Matches an existing file within the LoadRunner controller                  | Yes      |                                                             | The LoadRunner scenario file to execute the performance test.                                                                                                                                                                                                                                                                 |
| `resultFolder`          | String |                                                                            | Yes      |                                                             | <p>The folder, on the controller, where Loadrunner will put the results of a performance test.</p><p>You can use the placeholders <em>{study},</em> <em>{exp},</em> <em>{trial}</em> to generate a path that is unique for the running Akamas trial.</p><p>It can be a local path on the controller or on a network share</p> |
| `loadrunnerResOverride` | String | A valid name for a Windows folder                                          | No       | res                                                         | <p>The folder name where LoadRunner save the analysis results.</p><p>The default value can be changed in the LoadRunner controller.</p>                                                                                                                                                                                       |
| `timeout`               | String | The string must contain a numeric value followed by a suffix (s, m, h, d). | No       | 2h                                                          | The timeout for the Loadrunner scenario. If Loadrunner doesn’t finish the scenario within the specified amount of time, Akamas will consider the workflow as failed.                                                                                                                                                          |
| `checkFrequency`        | String | The string must contain a numeric value followed by a suffix (s, m, h, d). | No       | 1m                                                          | The interval at which Akamas check’s the status of the Loadrunner scenario.                                                                                                                                                                                                                                                   |
| `executable`            | String | A valid windows path                                                       | No       | C:\Program Files (x86)\Micro Focus\LoadRunner\bin\Wlrun.exe | The LoadRunner executable path                                                                                                                                                                                                                                                                                                |

Important notice: remember to escape your path with four backslashes (e.g. `C:\\\\Users\\\\\...`)

#### `Controller` arguments

This table reports the configuration reference for the `controller` section, which is an object with the following fields:

| Field                   | Type   | Value restrictions                                                         | Required | Default                                                     | Description                                                                                                                                                                                                                                                                                                                    |
| ----------------------- | ------ | -------------------------------------------------------------------------- | -------- | ----------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `component`             | String |                                                                            | No       |                                                             | The name of the component from which the operator will take its configuration options.                                                                                                                                                                                                                                         |
| `scenarioFile`          | String | Matches an existing file within the LoadRunner controller                  | Yes      |                                                             | The LoadRunner scenario file to execute the performance test.                                                                                                                                                                                                                                                                  |
| `resultFolder`          | String |                                                                            | Yes      |                                                             | <p>The folder, on the controller, where Loadrunner will put the results of a performance test.</p><p>You can use the placeholders <em>{study},</em> <em>{exp},</em> <em>{trial}</em> to generate a path that is unique for the running Akamas trial.</p><p>It can be a local path on the controller or on a network share.</p> |
| `loadrunnerResOverride` | String | A valid name for a Windows folder                                          | No       | res                                                         | <p>The folder name where LoadRunner save the analysis results.</p><p>The default value can be changed in the LoadRunner controller.</p>                                                                                                                                                                                        |
| `timeout`               | String | The string must contain a numeric value followed by a suffix (s, m, h, d). | No       | 2h                                                          | The timeout for the Loadrunner scenario. If Loadrunner doesn’t finish the scenario within the specified amount of time, Akamas will consider the workflow as failed.                                                                                                                                                           |
| `checkFrequency`        | String | The string must contain a numeric value followed by a suffix (s, m, h, d). | No       | 1m                                                          | The interval at which Akamas check’s the status of the Loadrunner scenario.                                                                                                                                                                                                                                                    |
| `executable`            | String | A valid windows path                                                       | No       | C:\Program Files (x86)\Micro Focus\LoadRunner\bin\Wlrun.exe | The LoadRunner executable path.                                                                                                                                                                                                                                                                                                |

Important notice: remember to escape your path with four backslashes (e.g. `C:\\\\Users\\\\\...`)

### Examples <a href="#examples" id="examples"></a>

#### A simple performance test <a href="#a-simple-performance-test" id="a-simple-performance-test"></a>

```yaml
name: "task1"
operator: "LoadRunner"
arguments:
  controller:
    hostname: loarrunner.example.com
    username: Domain\LoadRunnerUser
    password: j(sBdH5fsG9.I56P%7n2XPjmgO6!ARm=
  scenarioFile: 'C:\Users\LoadRunnerUser\Desktop\test\scenario\Scenario1.lrs'
  resultFolder: 'c:\Temp\{study}\{exp}\{trial}'
  timeout: 15m
  checkFrequency: 30s
```
