Appearance
AireGlu Commands
A library of test commands to use when testing AireGlu.
Invoking an AireGlu endpoint
You can invoke an AireGlu endpoint by providing an endpoint name, which can be found on the Endpoints page on your AireGlu instance.
You will also need a payload to send to AireGlu, the supported types are XML and Json. Add an XML or Json file within an 'AireGluPayloads' directory in your Test Set.
json
aireglu-commands
Configuration.json
aireglu-commands.feature
AireGluPayloads
payload-1.json
payload-2.xmlThe filenames excluding the file extension must be unique.
Now we are ready to invoke the endpoint. In the example below we are invoking an AireGlu endpoint with the endpoint name of 'test-endpoint' and sending the payload payload-1 (do not include the file extension).
gherkin
When we invoke endpoint 'test-endpoint' with payload 'payload-1'This will pass if AireGlu returns a
Payload Templates
Your payloads can be templatable. In your payload, use the --*TOKENNAME*-- format to show where data can be passed in. For example:
payload-2.xml
xml
<agent>
<id>--*Id*--</id>
<name>--*Name*--</name>
</agent>The payloads can be overloaded in the .feature file:
gherkin
When we invoke endpoint 'test-endpoint' with payload 'payload-2'
| Id | 123 |
| Name | John Doe |Test an existing endpoint invocation
If you know the transaction Id, you can also test an existing endpoint invocation with the following command:
gherkin
Given we executed an endpoint with transaction 'xxx' at '2023-01-01T12:00:00.000Z'Endpoint Structure
When talking about endpoints it is useful to understand how an endpoint is structured. It will have this format:
- Endpoint
- Tasks
- Action name: This is one of the following:
- EndpointInvocation
- NonExistantEndpointInvocation
- EndpointValidationFailure
- EndpointException
- EndpointAuthentication
- EndpointAuthenticationFailure
- EndpointManagementAuthenticationFailure
- EndpointTaskSuccess
- EndpointTaskInvocationDemoMode
- EndpointTaskFailure
- EndpointTaskSkipped
- EndpointTaskBegins
- EndpointResponds
- FaxReceivingFailed
- MESHMessageReceived
- EmailMessageReceived
- ReceiverException
- EmailAttachmentExtractionError
- EndpointValidationSuccess
- EndpointTaskValuesResolved
- EmailMessageProcessed
- EmailMessageRejected
- EmailMessageAccepted
- EndpointInvocationFailure
- MESHMessageProcessed
- MESHMessageRejected
- MESHMessageAccepted
- Task label: A description of the task
- Debug data: Further debug-level data describing the task actions
- Action name: This is one of the following:
- Tasks
So an endpoint can have 1 or more Tasks, which each execute an Action. We can access the debug data for each of these as discussed below.
How do I know that the invocation of an endpoint is the one I am looking for?
Glad you asked! When we submit an AireForm, a Transaction ID is given to us, which we track internally. When you run any of the following commands this Transaction ID is included for you, ensuring that you are always asserting on the correct endpoint invocation.
Commands
gherkin
Then the aireglu endpoint '*endpoint*' logs action '*action-name*' within *seconds* seconds
Then the aireglu endpoint '*endpoint*' logs actions within *seconds* seconds
| *action-name* |
| *action-name* |Checks that the specified endpoint has executed tasks with matching action names within the given timeframe.
gherkin
Then the aireglu endpoint '*endpoint*' does not log action '*action-name*' within *seconds* secondsChecks that the specified endpoint has not executed a task with a matching action name within the given timeframe. Be careful with this assertion - as it has to wait the entire length of time you specify before the assertion passes it can seriously slow down your tests. Use only when really necessary!
gherkin
Then the '*task-label*' task of aireglu endpoint '*endpoint*' succeeds within *seconds* secondsChecks that a task with a matching label has been executed within the given timeframe. This will also set the matching task as the current task - which means that the following assertions will match against it's debug data.
gherkin
Then the task sends data in a valid formatChecks that the current task has submitted its data in a format matching the template in your tests AireGlu Config (todo: link). This template will need to be defined before you can run this assertion!
gherkin
Then the task sets '*task-variable*' to '*expected-value*'Checks that the current task's submitted data contains the expected variable. This requires a template for the AireGlu task to be defined in config (todo: link) before you can run the assertion.