---
schema_version: "1"
id: fdaff98e7732e317077ca7e3d027c39247a347a9533f33af75acee7b8d5d9c83
title: Parameterized
collection: mulesoft
version: current
locale: en-us
portal_url: https://docs.salesforce.com/mulesoft/current/en-us/munit/2.3/parameterized.md
canonical_url: https://docs.mulesoft.com/munit/2.3/parameterized
source_site: docs.mulesoft.com
content_type: documentation
content_hash: efddbd19db96049f4184f551ba036aec8eabd31e436023891a77789239b263ce
description: MuleSoft Documentation Site
release: "2.3"
latest: false
---
---
product: MUnit
version: 2.3
keywords: munit, testing, unit testing
---

# Parameterized

> For the full documentation index, see: https://docs.mulesoft.com/llms.txt

A parameterized test suite runs the same tests but with different inputs.

The test suite parameterization is defined at a configuration level as follows:

```xml
<munit:config>
    <munit:parameterizations>
        <munit:parameterization name="firstParameterization">
            <munit:parameters>
                <munit:parameter propertyName="name" value="Robert"/>
                <munit:parameter propertyName="lastname" value="Plant"/>
            </munit:parameters>
        </munit:parameterization>
        <munit:parameterization name="secondParameterization">
            <munit:parameters>
                <munit:parameter propertyName="name" value="Jimmy"/>
                <munit:parameter propertyName="lastname" value="Page"/>
            </munit:parameters>
        </munit:parameterization>
    </munit:parameterizations>
</munit:config>
```

The Test Suite runs twice: Firstly, with the `firstParameterization` parameters. Secondly, with the
`secondParameterization` parameters.

For example, if you have a test that sets a payload for a flow and expects a result:

Parameterization Example

```xml
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns="http://www.mulesoft.org/schema/mule/core"
      xmlns:munit="http://www.mulesoft.org/schema/mule/munit"
      xmlns:munit-tools="http://www.mulesoft.org/schema/mule/munit-tools"
      xsi:schemaLocation="
        http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
        http://www.mulesoft.org/schema/mule/munit http://www.mulesoft.org/schema/mule/munit/current/mule-munit.xsd
        http://www.mulesoft.org/schema/mule/munit-tools http://www.mulesoft.org/schema/mule/munit-tools/current/mule-munit-tools.xsd">

    <munit:config name="parameterized-test.xml">
        <munit:parameterizations>
            <munit:parameterization name="sumThree">
                <munit:parameters>
                    <munit:parameter propertyName="input" value="#[1]"/>
                    <munit:parameter propertyName="output" value="#[2]"/>
                </munit:parameters>
            </munit:parameterization>
            <munit:parameterization name="sumFive">
                <munit:parameters>
                    <munit:parameter propertyName="input" value="#[2]"/>
                    <munit:parameter propertyName="output" value="#[4]"/>
                </munit:parameters>
            </munit:parameterization>
        </munit:parameterizations>
    </munit:config>

    <munit:test name="expectFlowResult">
        <munit:behavior>
            <set-payload value="${input}"/>
        </munit:behavior>
        <munit:execution >
            <flow-ref name="myFlow"/>
        </munit:execution>
        <munit:validation>
            <munit-tools:assert-equals actual="#[payload]" expected="${output}" />
        </munit:validation>
    </munit:test>

</mule>
```

## Parameterization from File

To use the same parameterized values on different test suites, you must save your parameterizations
values in a YAML file in the `/test/resources` directory of your Mule application project:

parameterizations.yaml Example

```yaml
firstParameterization:
  name: "Robert"
  lastname: "Plant"

secondParameterization:
  name: "Jimmy"
  lastname: "Page"
```

And reference it from your test suite configuration:

Example Parameterization From File

```xml
<munit:config>
    <munit:parameterizations file="parameterizations.yaml" />
</munit:config>
```

You can combine both methods to add parameterized values to a test suite:

Example Parameterization From File and in the Test Suite Configuration

```xml
<munit:config name="parameterization-from-file-test.xml">
    <munit:parameterizations file="parameterizations.yaml" >
        <munit:parameterization name="thirdParameterization">
            <munit:parameters>
                <munit:parameter propertyName="name" value="John"/>
                <munit:parameter propertyName="lastname" value="Bonham"/>
            </munit:parameters>
        </munit:parameterization>
    </munit:parameterizations>
</munit:config>
```

If you define the same parameterization key in a YAML file and your test suite configuration, the
test suite parameterization overrides your YAML parameterization.
