Create a Test
To create a valid Test, you need to provide the test ID and at least one task. This serves as the foundation for the Test and ensures its basic functionality. However, the true power of Test creation lies in the ability to include multiple tasks. By incorporating multiple tasks, you can construct more complex and intricate testing scenarios.
Example
# Define the tests
tests:
# Define a test
sampleTest:
# Define the tasks for the test
tasks:
# Define the first task with an ID
- id: task1
# Specify the action to be performed
action: actions.sampleHttpGetRequest
# Specify the validation script to validate the action's output
validate: scripts.validateHttpOk
# Define the actions
actions:
# Define the sampleHttpGetRequest action
sampleHttpGetRequest:
# Specify the type of action, in this case, an HTTP client request
type: HTTP::CLIENT
# Specify the properties for the HTTP request
props:
method: GET
fullUrl: https://httpbin.org/get
# Define the scripts
scripts:
# Define the validateHttpOk script for validating HTTP status code
validateHttpOk:
# Use an assertion to validate the status code from the previous action
assert context["last_output"]["statusCode"] == 200