---
schema_version: "1"
id: fd440cd42402220d8c5abfcdf80103946e70255d5fddee5fbb5c012007a0c979
title: Configure the MUnit FTP Server Utility
collection: mulesoft
version: current
locale: en-us
portal_url: https://docs.salesforce.com/mulesoft/current/en-us/munit/latest/ftp-server-cookbook.md
canonical_url: https://docs.mulesoft.com/munit/latest/ftp-server-cookbook
source_site: docs.mulesoft.com
content_type: documentation
content_hash: cc929ab60e264fe946acbd3685fd4f823f69c7a9feeafaf40461fdafdf13fa34
description: MuleSoft Documentation Site
release: "3.7"
latest: true
---
---
product: MUnit
version: 3.7
is-latest-version: true
---

# Configure the MUnit FTP Server Utility

> 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

Configure the MUnit FTP Server utility to run MUnit tests against an in-memory FTP server without
connecting to an external FTP server. Use it to test Mule flows that interact with FTP or SFTP
connectors in an isolated environment.

If you want to test the following Mule application:

```xml
<sftp:config name="SFTP_Config">
    <sftp:connection host="${ftp.host}" port="${ftp.port}" username="${ftp.user}" password="${ftp.password}"/>
</sftp:config>

<configuration-properties file="ftp.properties" />

<flow name="listFlow">
    <sftp:list config-ref="SFTP_Config" directoryPath="."/>
    <foreach>
        <logger level="INFO" message="#[attributes.fileName]"/>
    </foreach>
</flow>
```

The `ftp.properties` in `src/main/resources` has the following content:

```none
ftp.host=localhost
ftp.port=22
ftp.user=max
ftp.password=munittest
```

The username field can’t be empty. If you don’t have a username-password pair, set the username to
`anonymous` and don’t set any password. By default, the `anonymous` attribute is set to `true`.

## Install the FTP Server

To install the FTP server:

1.  Look for the **MUnit Utils FTP Server** module.

2.  Add the module to your project:

    ```xml
    <!-- Ftp Server Dependency -->
    <dependency>
        <groupId>com.mulesoft.munit.utils</groupId>
        <artifactId>munit-ftpserver-module</artifactId>
        <version>2.0.1</version>
        <classifier>mule-plugin</classifier>
        <scope>test</scope>
    </dependency>
    ```

    The MUnit FTP server artifact in your POM file must have the `test` scope.

> [!NOTE] The **MUnit FTP Server** module is located at
> [MuleSoft Nexus repository](https://repository.mulesoft.org/nexus/content/repositories/releases/com/mulesoft/munit/utils/munit-ftpserver-module/).
> The **MUnit FTP Server** module version 3 and later is compatible with Java 17. Previous versions
> of this module available at Anypoint Exchange are deprecated.

## Define the FTP Server

To define the FTP server, change the FTP server attributes as follows:

```xml
<ftpserver:config name="MUnit_FTP_Server_Config">
    <ftpserver:connection port="${ftp.port}" username="${ftp.user}" password="${ftp.password}" secure="true" homeDir="${app.home}"/>
----
</ftpserver:config>
----
```

## Run the Test

After configuring the FTP server, you can run the test:

```xml
<munit:test name="listFlowTest" description="Test listFlow" >
    <munit:execution>
        <flow-ref name="listFlow"/>
    </munit:execution>
    <munit:validation>
        <munit-tools:assert-that expression="#[sizeOf(payload)]" is="#[MunitTools::greaterThan(0)]"/>
    </munit:validation>
</munit:test>
```

This FTP accepts any user, so you must not set up a user database or list.

## See Also

- [FTP Util](https://docs.mulesoft.com/munit/latest/ftp-util)
