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

# Parameterized

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

![logo acb active](/mulesoft/current/en-us/_/img/icons/anypoint-code-builder.svg "Anypoint Code Builder")Anypoint Code
Builder

![logo studio active](/mulesoft/current/en-us/_/img/icons/studio.svg "Anypoint Studio")Anypoint Studio

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.
