---
schema_version: "1"
id: 7465e958fa72e8e73e1cd880dc9870408d47314618add1c6da4034f6cd5dd0dd
title: MUnit Dynamic Ports
collection: mulesoft
version: current
locale: en-us
portal_url: https://docs.salesforce.com/mulesoft/current/en-us/munit/latest/dynamic-ports.md
canonical_url: https://docs.mulesoft.com/munit/latest/dynamic-ports
source_site: docs.mulesoft.com
content_type: documentation
content_hash: 362bcee80be4b62e97fd25f8d6af984132d0a3308627837392d14e6e76fa8175
description: MuleSoft Documentation Site
release: "3.7"
latest: true
---
---
product: MUnit
version: 3.7
is-latest-version: true
---

# MUnit Dynamic Ports

> 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

The MUnit Dynamic Ports element binds a free port to a property at test runtime, preventing port
conflicts when running MUnit tests in parallel. You can optionally restrict the port search to a
specific range using min and max values.

For example, a dynamic port would look something like this:

```xml
<munit:dynamic-port propertyName="a.dynamic.port"/>
```

And it can be used in the http configuration:

```xml
<http:request-config name="httpRequestConfig">
    <http:request-connection host="localhost" port="${a.dynamic.port}"/>
</http:request-config>
```

Additionally you can set min and max values from where to get the port:

```xml
<munit:dynamic-port propertyName="a.dynamic.port" min="6000" max="7000"/>
```

## See Also

- [Dynamic Directories](https://docs.mulesoft.com/munit/latest/dynamic-directories)

- [Storage Event Processors](https://docs.mulesoft.com/munit/latest/storage-event-processors)
