hands-on lab

Evaluating CDK Constructs with Fine-Grained Assertions and Validation Tests

Intermediate
45m
33
3.6/5
This lab is currently under maintenance and unavailable. We are actively working to resolve this issue and we apologize for any inconvenience.

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. 

Get guided in a real environmentPractice with a step-by-step scenario in a real, provisioned environment.
Learn and validateUse validations to check your solutions every step of the way.
See resultsTrack your knowledge and monitor your progress.
Lab description

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:

Environment before
Environment after
About the author
Avatar
Jun Fritz
Cloud Labs Developer
Students
38,821
Labs
103
Courses
1
Learning paths
6

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. 

Covered topics
Lab steps
Assessing Construct Features with Fine-grained Assertions
Securing Construct Behavior with Validation Tests