Evaluating CDK Constructs with Fine-Grained Assertions and Validation Tests
Version 1 of the AWS Cloud Development Kit (AWS CDK) is now in maintenance mode.
Refer to the AWS Cloud Development Kit (AWS CDK) v2 Learning Path for updated CDK v2 Labs and Challenges.
Custom CDK constructs allow organizations to implement specific configurations on AWS services to meet their requirements. Although writing custom constructs provides the guardrails to allow this, the development of the constructs themselves requires a form of testing to ensure these requirements are met. The Snapshot Testing AWS CDK Constructs hands-on lab introduced the built-in Jest testing framework and how to incorporate snapshot tests into your CDK development process.
Snapshot tests verify that a construct will generate the same template resource definition every time, but how can developers ensure the constructs are utilized correctly while they build out their applications?
Fine-grained assertions are tests that drill down to the individual properties of your constructs and ensure that specific values are set. Validation tests check your CDK constructs to make sure they raise the appropriate errors when you pass them invalid data.
In this lab, you will write fine-grained assertions and validation tests to evaluate a custom Amazon Kinesis stream construct.
Learning Objectives
Upon completion of this intermediate-level lab, you will be able to:
- Write fine-grained assertions to assess CDK construct features
- Write validation tests to ensure correct construct erroring behavior
Intended Audience
- Cloud Architects
- DevOps Engineers
- Software Engineers
Prerequisites
Familiarity with the following will be beneficial:
- AWS Cloud Development Kit
- TypeScript Programming
- Jest Testing Framework
- JavaScript Object Notation (JSON)
Refer to the following labs to fulfill the prerequisite:
Jun is a Cloud Labs Developer with previous experience as a Software Engineer and Cloud Developer. He holds the AWS Certified Solutions Architect and DevOps Engineer Professional certifications. He also holds the AWS Certified Solutions Architect, Developer, and SysOps Administrator Associate certifications.
Jun is focused on giving back to the growing cloud community by sharing his knowledge and experience with students and creating engaging content.