Contract Testing for AWS Lambdas

Viewed 2360

Is there any way to do Contract testing for the AWS lambdas. Pact is being used for normal APIs, But I am trying to implement Contract Testing on AWS SAM. Is there any tool for this or Pact can be used with any modifications?

2 Answers

You can use the amazon-cli if you want to test it.

amazon-cli will help you to manually trigger your lamda via aws lambda invoke the command.

Please install amazon-cli at your local from this link.

After that you can invoke the amazon 1st lamda from your cli with aws lamda command. It comes with many options like you can pass payload (supposed to be pass from SNS in actual scenario).

Executing AWS Lamda from Amazon-CLI Command details description

Example command:

aws lambda invoke --function-name your_function_name --invocation-type RequestResponse outfile.txt --payload file:requestFile.txt

I hope it helps.

Related