---
schema_version: "1"
id: f9ee02b0b58fef656e9269664e5e25098ef7cec9d16a0e5d9fb6bd0152a8f1b8
title: Scheduling Testing and Monitoring
collection: mulesoft
version: current
locale: en-us
portal_url: https://docs.salesforce.com/mulesoft/current/en-us/api-functional-monitoring/bat-schedule-test-task.md
canonical_url: https://docs.mulesoft.com/api-functional-monitoring/bat-schedule-test-task
source_site: docs.mulesoft.com
content_type: documentation
content_hash: e7a6861ece39a7c5897471fb44de29bd4488fa00ddddeff819b242dfa3c7a37e
description: MuleSoft Documentation Site
latest: true
---
---
product: API Functional Monitoring
---

# Scheduling Testing and Monitoring

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

You can schedule, run, and monitor an API test in Anypoint Platform using the default schedule and
use a cron job to change the schedule. BAT is deployed by default in the Production environment of
Anypoint Platform when you execute the `bat login` command. After deploying BAT, you execute a
`bat schedule <options>` command. By default, if you don’t include the optional cron expression in
the command, the test runs every 15 minutes. The last step in this procedure changes the default to
use a cron expression that runs the test once a day for a month.

After running the command, BAT creates a monitor in Anypoint Platform. The monitor collects
information about the scheduled execution of the test. To obtain this information, you need to set
up a third-party reporting tool as described in the linked topic.

To schedule testing and monitoring:

1.  Log in to Anypoint Platform using BAT CLI. For example:

    `bat login --client-id=<value> --client-secret=<value>` or
    `bat login --username=<value> --password=<value>`

2.  Create a schedule using the default and monitor the testing. Provide an arbitrary endpoint URL
    and optionally specify the current directory by using --init-folder to store scheduling
    information. For example:

    `bat schedule endpoint http://www.example.com --init-folder`

    The schedule is published to Exchange using the default login profile.

    Output looks like this in Mac OSX:

    BAT Version: 1.0.51

    # File: ./tests/step.0.dwl

        api-mon
          ✓ GET http://apimon.cloudhub.io/users (1316.85ms)
            ✓ 200 must equal 200

    # File: ./tests/step.1.dwl

    ... ✓ 10 must equal 10

    # Reporter: bat/Reporters/JSON.dwl >> /var/folders/w5/\_cc\_5\_z12pq3qnymf3f0zh840000gq/T/bat\_report\_20180226111256.json

    # Reporter: bat/Reporters/HTML.dwl >> /var/folders/w5/\_cc\_5\_z12pq3qnymf3f0zh840000gq/T/bat\_report\_20180226111256.html

    #Creating artifact...
    - exchange.json
    - .DS\_Store
    - tests/step.0.dwl
    - tests/step.1.dwl
    - main.dwl
    - bat.yaml

    # Creating artifact...OK

    # Uploading 88f362bd-2092-4dbf-b9f2-db5624d7b4ab:www.telhill.com-ncQRvDwc:0.0.1

    # Version 0.0.1 published

    scheduleId: 99c24a04-b82b-4366-b02b-4682fa405ead

3.  Go to the path for one of the local reporters listed in the output to see information about the
    executed test. For example, on Mac OSX, go to
    `/var/folders/w5/_cc_5_z12pq3qnymf3f0zh840000gq/T/bat_report_20180226111256.html`.

4.  Go to Exchange and view the asset named after the monitor URL that you provided in the
    `bat schedule endpoint` command. It is `http://www.example.com` in this example.

5.  List the schedule of tests.

    `bat schedule list [--profile=<value>]`

6.  Schedule a test to run repeated using a cron expression. For example, run the test at 12:00 PM
    every day for one month:

    `bat schedule create --cron="0 0 12 1/1 * ? *"`

Next, configure and view test reports.

## Limits for Schedule Intervals by Location

The minimum interval for schedules that run in private locations is always five minutes.

The minimum interval for schedules that run in public locations depends on the number of schedule
entitlements, or API monitor entitlements, that you have. If you have more than five, the limit is
five minutes. Otherwise, it is fifteen minutes.

The limit depends on the type of location, not on whether the API is public or private, because you
can test a public API from a private location.

<table><colgroup><col> <col> <col> <col></colgroup><thead><tr><th>Location Type</th><th>Number of Entitlements</th><th>Account Type</th><th>Interval Time Allowed</th></tr></thead><tbody><tr><td><p>Public</p></td><td><p>5 or less</p></td><td><p>Developer</p></td><td><p>15 minutes</p></td></tr><tr><td><p>Public</p></td><td><p>5 or less</p></td><td><p>Other</p></td><td><p>15 minutes</p></td></tr><tr><td><p>Public</p></td><td><p>More than 5</p></td><td><p>Developer</p></td><td><p>15 minutes</p></td></tr><tr><td><p>Public</p></td><td><p>More than 5</p></td><td><p>Other</p></td><td><p>5 minutes</p></td></tr><tr><td><p>Private</p></td><td><p>Any number</p></td><td><p>N/A</p></td><td><p>5 minutes</p></td></tr></tbody></table>

## See Also

- [Configuring and Viewing Reports](https://docs.mulesoft.com/api-functional-monitoring/bat-reporting-task)

- [BAT CLI Reference](https://docs.mulesoft.com/api-functional-monitoring/bat-command-reference)

- [Monitoring the Endpoints of Public APIs](https://docs.mulesoft.com/api-functional-monitoring/afm-monitoring-public-apis)
