I'm trying to set up a very basic AWS Lambda script, but I struggle to get the AWS Lambda Test
functionality to recognize the changes I make.
To setup the simplest possible test, I created a new AWS Lambda function for Python 3.7. I then make a simple change in the code as below, add a test output and run Test:
import json
def lambda_handler(event, context):
# TODO implement
return {
'statusCode': 200,
'body': json.dumps('I changed this text')
}
I've verified that Version:
is set to $LATEST
- yet when I run the test, there is no change in my output - it keeps returning the original code output. Further, if I try to export the function, I get the original code - not my updated code above (despite having saved it).
I realize this seems very basic, but I wanted to check if others have experienced this as well.
Based on feedback, it seems hitting Deploy
is required in order to be able to test the updated function
additional: Deploy updates the code the test runs against.
However, if you want to test different inputs to the same code then you can create a test and invoke it without deploying. See the hello world template for how to pass the input.