-
Notifications
You must be signed in to change notification settings - Fork 2
AWS Commands
Testlum supports a range of AWS services, including S3 and Lambda, to help you test cloud-based applications and workflows. This page covers how to interact with AWS services through Testlum commands.
S3
Description:
Amazon S3 (Simple Storage Service) is an object storage service providing industry-leading scalability, data availability, security, and performance. It is widely used for storing and managing files and backups in the cloud.
The <s3>
tag allows interaction with S3 buckets and files. It supports actions such as creating/removing buckets, uploading/downloading files, and comparing files.
Parameter | Type | Required | Description |
---|---|---|---|
comment |
String | ✅ | Description of the S3 action |
alias |
String | ✅ | Unique alias for the S3 integration in integration.xml
|
condition |
Boolean | ❌ | Optional condition to execute the test step |
threshold |
Integer (ms) | ❌ | Maximum allowed execution time for the step (in milliseconds) |
The bucket
commands are used to manage S3 buckets.
Parameter | Required | Description |
---|---|---|
create |
✅ | Create a new S3 bucket |
remove |
✅ | Remove an existing S3 bucket by name |
<s3 comment="s3 commands" alias="S3_0"> <bucket comment="Create a new bucket"> <create>bucket-one</create> </bucket> <bucket comment="Remove an existing bucket"> <remove>bucket-one</remove> </bucket> </s3>
The file
commands are used to interact with files in S3.
Parameter | Required | Description |
---|---|---|
bucket |
✅ | The S3 bucket containing the file |
key |
✅ | The unique key for the file in the selected bucket |
upload |
✅ | Upload a file from the scenario directory to S3 |
download |
✅ | Download a file from S3 and compare it with the expected file |
remove |
✅ | Remove a file from the specified S3 bucket |
<s3 comment="Upload, download, and remove files" alias="S3_0"> <file comment="Upload file" bucket="bucket-one" key="/test/upload_1.json"> <upload>upload_1.json</upload> </file> <file comment="Download file" bucket="bucket-one" key="/test/upload_1.json"> <download> <file>expected_1.json</file> </download> </file> <file comment="Remove file" bucket="bucket-one" key="/test/upload_1.json"> <remove/> </file> </s3>
- Use
key
to uniquely identify a file in the S3 bucket.- Ensure your S3 bucket is properly configured and accessible.
- For bulk operations, you can include multiple file operations inside one
<s3>
command.
Lambda
Description:
With Testlum, you can easily test AWS Lambda functions. Lambda lets you run code in response to events without managing servers, and Testlum simplifies the testing process of your Lambda functions.
The <lambda>
command is used to invoke Lambda functions and manage their responses in your Testlum scenarios.
Parameter | Type | Required | Description |
---|---|---|---|
comment |
String | ✅ | Description of the Lambda function test |
alias |
String | ✅ | Unique alias for the Lambda integration in integration.xml
|
functionName |
String | ✅ | The name of the Lambda function to invoke |
condition |
Boolean | ❌ | Optional condition for executing the test step |
threshold |
Integer (ms) | ❌ | Maximum allowed execution time for this step (in milliseconds) |
The body
parameter defines the content that will be passed to the Lambda function.
Parameter | Required | Description |
---|---|---|
from |
❌ | Specify the file containing the body of the request |
raw |
❌ | Provide the raw content as a JSON string |
<lambda comment="Invoke python function" alias="AWS" functionName="hello-world-python"> <body> <from file="body_1.json"/> </body> </lambda>
The response
parameter defines how to handle the Lambda function's response.
Parameter | Required | Description |
---|---|---|
code |
❌ | Expected HTTP response code. Default is 200
|
file |
❌ | A file that contains the expected response |
mode |
❌ | A mode for response comparison (lenient strict ) |
header |
❌ | Header name and data to validate in the response |
<lambda comment="Invoke python function" alias="AWS" functionName="hello-world-python"> <body> <raw> { "key1": "Hello Lambda", "key2": "value2", "key3": "value3" } </raw> </body> <response file="expected_2.json"/> </lambda>
- Use the
raw
option to directly input JSON strings into the request body.- The
file
can be used for both the input and expected output to streamline testing.- Ensure the Lambda function is properly configured and accessible from your test environment.
body_1.json
{ "key1": "Hello Lambda", "key2": "value2", "key3": "value3" }expected_1.json
"Hello Lambda"