---
schema_version: "1"
id: e7ed5fe3f309893d786a4562becface3692e16b036cd5d2f0a24dba9c0db05f5
title: Getting Started Writing Tests
collection: mulesoft
version: current
locale: en-us
portal_url: https://docs.salesforce.com/mulesoft/current/en-us/api-functional-monitoring/bat-write-tests-task.md
canonical_url: https://docs.mulesoft.com/api-functional-monitoring/bat-write-tests-task
source_site: docs.mulesoft.com
content_type: documentation
content_hash: 74627d99ce2e469f8ba4350ceec72cd89cf944c646bbbfcc8a00e43198d80069
description: MuleSoft Documentation Site
latest: true
---
---
product: API Functional Monitoring
---

# Getting Started Writing Tests

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

A test suite is composed of the following elements:

- A directory that contains a main file named `bat.yaml` that describes the structure of your test
  suite

- A `config` folder that contains files in which you specify variables

- One or more folders in which you write tests

Tests are written in the BDD Test-Writing syntax and use the `.dwl` file extension.

## Before You Begin

Before you can write and run tests, you must have access to an Anypoint Platform account.

## Use Examples to Learn the Basics

Learn the basics of writing tests using the provided examples.

To select examples:

1.  In the **Create Monitor** page, click **Switch to code editor**.

2.  In the selector menu for the code editor, select a test example. Examples include:

    - Test an expected status code

    - Validate multiple assertions

    - Set and reuse variables

    - Iterate test

    - Extract function

    - Assert with regex expression

    - Repeat N times

      The code in the code editor automatically changes to show the selected example code.

3.  Modify the example test for your own needs. See
    [BDD Test-Writing Syntax Reference](https://docs.mulesoft.com/api-functional-monitoring/bat-bdd-reference) to understand the syntax and write your
    own tests.

4.  Validate whether the test works by clicking **Validate Test**.

> [!NOTE] The example menu is available only when creating a monitor.

## See Also

- [The website for the Deck of Cards API](https://deckofcardsapi.com/)

- [BDD Test-Writing Syntax Reference](https://docs.mulesoft.com/api-functional-monitoring/bat-bdd-reference)

- [Creating Monitors](https://docs.mulesoft.com/api-functional-monitoring/afm-create-monitor)

- [Modifying Monitors](https://docs.mulesoft.com/api-functional-monitoring/afm-modify-monitor)
