# Test Parameters

## Parameterization <a href="#parameterization" id="parameterization"></a>

Using variety of test data is crucial for a successful automation testing. Let's see how simple it's to add parameters to your test case file. All you need to do is to replace inline values with parameter names and create a CSV or XLSX file with the same name as the test case (script) file and corresponding columns with parameter names. Let's take the second step from the script we have built in "Getting Started - Desktop" tutorial and parameterize it:

{% hint style="info" %}
Here is the CSV file for example:
{% endhint %}

| name,    | phone,      |   |
| -------- | ----------- | - |
| Tony,    | 0523539924, |   |
| Josh,    | 0548819925, |   |
| Tiffany, | 0518853395, |   |

Original

```javascript
web.type('name=search', 'Tony');
```

Parameterized

```javascript
web.type('name=search', '${name}');
```

```bash
web.type('name=search', params.name);
```

We replaced "Tony" value with "${name}". `${<parameter name>}` syntax is used to define external parameters.

First row defines columns for each parameter. This row must include comma separated parameter names. Parameter name can include white-space. We will save the CSV file in the same directory as our test case file as `wikipedia.csv`.

Now we have two files:

* wikipedia.js
* wikipedia.csv

All we need to do now is to use the `-p` switch to specify the parameters file:

```bash
oxygen -p=wikipedia.csv wikipedia.js
```

To use parameters when executing from within the IDE; click Settings icon and specify the parameterization CSV.

### Multiple Iterations <a href="#multiple-iterations" id="multiple-iterations"></a>

You probably noticed that we have defined three different values under `name` parameter. If we would run the test as before, Oxygen will pick the first value, e.g. "Tony" and will use it in the test. Ideally we would like to iterate over multiple values. This can be done using the `-i` switch specifying number of iterations. For example, if we wanted to run the test three times:

```bash
oxygen -p=wikipedia.csv -i=3 --pm=seq wikipedia.js
```

This will run three iterations of the test, each time using the next value which will be selected either randomly or sequentially depending on the setting of `--pm` switch. `random` and `seq` specify random and sequential modes respectively.

Similarly, number of iterations in the IDE can be defined using the settings screen.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.oxygenhq.org/download-installation-start/test-parameters.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
