Hi everyone, I'm James. In this video I'm going to show how you can use the theory feature of xUnit to create parametrised tests for your Lambda functions.
Unit testing is a vital part of the software development life cycle. Providing fast feedback to developers to ensure your business logic is working as it should be essential for a productive workflow.
00:00 - Introduction
01:05 - Generate sample events
02:10 - The Lambda function under test
03:00 - Test cases
04:40 - Writing parametrised tests
06:00 - Mocking
06:40 - Assert on the response
07:00 - Execute the tests
08:30 - Event Schema Validation
11:00 - Build helpful validation errors
Links
Moq - https://github.com/moq/moq4
Generate test events with sam local - https://docs.aws.amazon.com/serverles...
Serverless Test Samples - https://github.com/aws-samples/server...
xUnit Theories - https://hamidmosalla.com/2017/02/25/x...
NJsonSchema Library - https://github.com/RicoSuter/NJsonSchema
Twitter - / plantpowerjames
LinkedIn - / james-eastham