---
schema_version: "1"
id: ab9ed6db473e05e2e989901fc0dfac014cf20fd512cc0e2d4e9b5fd8408161f6
title: Recording a Test from an Exchange Example
collection: mulesoft
version: current
locale: en-us
portal_url: https://docs.salesforce.com/mulesoft/current/en-us/munit/3.6/test-recorder-examples.md
canonical_url: https://docs.mulesoft.com/munit/3.6/test-recorder-examples
source_site: docs.mulesoft.com
content_type: documentation
content_hash: 934495abd2ef83c9f1b6388bb84932af10d947940ac293a915f8b3dd4c9a7afa
description: MuleSoft Documentation Site
release: "3.6"
latest: false
---
---
product: MUnit
version: 3.6
---

# Recording a Test from an Exchange Example

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

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

The following example shows you how to import to Anypoint Studio an existing project from Anypoint
Exchange and then record the flow processing to create a unit test for the flows.

## Prerequisite

- Your Anypoint Platform credentials are configured in Studio.  
  See [Configuring Anypoint Platform Credentials](https://docs.mulesoft.com/studio/set-credentials-in-studio-to) for
  more information.

## Test the Login Form Using the HTTP Connector Example

1.  Click the Open Exchange icon ![3%](/mulesoft/current/en-us/munit/3.6/_images/exchange-icon.png).

2.  Select **Provided by MuleSoft** in the pop-up Exchange window, filter per **Examples**, and look
    for the **Login Form Using the HTTP Connector**.

3.  Click **Open**.  
    Studio imports the example as a new working project.

4.  If prompted, select **Perform Update** in **Update your Workspace**.

5.  Select the Manage Mule Projects APIs icon ![2%](/mulesoft/current/en-us/munit/3.6/_images/manage-project-api-icon.png).

6.  Select **Modules** and update both **MUnit** and **Munit Tools**:

    ![update munit](/mulesoft/current/en-us/munit/3.6/_images/update-munit.png)

7.  Select **Apply and Close**.

### Test the Process for a Successful Login Attempt

1.  In your project, right-click `DoLoginFlow` and select **Munit** > **Record new test for this
    flow**:

    ![login flow test recorder example](/mulesoft/current/en-us/munit/3.6/_images/login-flow-test-recorder-example.png)

    The test recorder starts your project and starts recording the event going through that flow.

2.  Open a browser and navigate to `http://0.0.0.0:8081/login`.

3.  Type `mule` for both **Username** and **Password**, and click **Submit**.

    The test recorder captures this event and stops the recording.

4.  Return to Studio and click **Configure Test**:

    ![stops recording](/mulesoft/current/en-us/munit/3.6/_images/stops-recording.png)

5.  Select the file name for the MUnit test suite in which you want to record your test.

6.  Under **Test name**, type `_DoLoginFlow-successfull_`.

7.  Set the test recorder to set the recorded input of the flow, and assert that the recorded output
    is the expected output by the test.

8.  In **Successful login**, select **Verify that this process was called** and set the counter
    **equal to** to `_1_` time.

9.  Click **Next** and then **Finish**.

    A fully functional MUnit test is generated to assert that the process in your application works
    as expected when the login is successful.

### Test the Process for an Unsuccessful Login Attempt

1.  In your project, right-click `DoLoginFlow` and select **Munit** > **Record new test for this
    flow**:

    ![login flow test recorder example](/mulesoft/current/en-us/munit/3.6/_images/login-flow-test-recorder-example.png)

    The test recorder starts your project and starts recording the event going through that flow.

2.  Open a browser and navigate to `http://0.0.0.0:8081/login`.

3.  Type `admin` in both **Username** and **Password**, and click **Submit**:

    The test recorder captures this event and stops the recording.

4.  Return to Studio and click **Configure Test**:

    ![stops recording](/mulesoft/current/en-us/munit/3.6/_images/stops-recording.png)

5.  Select the file name for the MUnit test suite in which you want to record your test.

6.  Under **Test name**, type `_DoLoginFlow-unsuccessfull_`.

7.  Set the test recorder to set the recorded input of the flow, and assert that the recorded output
    is the expected output by the test.

8.  In the **Unsuccessful login** parse template step, select **Verify that this process was
    called** and set the counter to **equal to** `_1_` time.

9.  Click **Next** and then **Finish**.

    A fully functional MUnit test is generated to assert that the process in your application works
    as expected when the login fails.

## See Also

- [Test Recorder in Studio](https://docs.mulesoft.com/munit/3.6/test-recorder)
