Lambda Function
With Testlum you can automatically test your lambda functions from AWS services.
Lambda Integration
Description
<lambdaIntegration>
- command for integration with lambda
Required parameters
- alias - unique name of the integration
- enabled – a boolean flag to enable/disable integration (can be “true” or “false”)
- region - the AWS Region
- endpoint - endpoint URL
- accessKey and secretAccessKey - your AWS credentials
<integrations>
<lambdaIntegration>
<lambda alias="AWS" enabled="true">
<region>us-east-1</region>
<endpoint>https://example-url.com</endpoint>
<accessKeyId>test</accessKeyId>
<secretAccessKey>test</secretAccessKey>
</lambda>
</lambdaIntegration>
</integrations>
How to send the query
Description
<lambda>
- command which is responsible for sending the lambda queries in testing scenarios
Required parameters
- comment
- alias
- functionName
- body:
- from – file
- raw – string
- response:
- code (default 200)
- file
- header (optional): name, data
x
<lambda comment="Invoke python function"
alias="AWS"
functionName="hello-world-python">
<body>
<from file="body_1.json"/>
</body>
<response file="expected_1.json">
<header name="X-Amz-Executed-Version" data="$LATEST"/>
</response>
</lambda>
<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>
body_1.json file example
{
"key1": "Hello Lambda",
"key2": "value2",
"key3": "value3"
}
expected_1.json file example
"Hello Lambda"