Getting Started Writing Tests
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:
-
In the Create Monitor page, click Switch to code editor.
-
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.
-
-
Modify the example test for your own needs. See BDD Test-Writing Syntax Reference to understand the syntax and write your own tests.
-
Validate whether the test works by clicking Validate Test.
The example menu is available only when creating a monitor. |