1

I know this is a vague question. But I have my CDK setup in Python. I want to now carry out unit tests, but with the exploration it seems that relevant libraries aren't available in Python, as in Typescript.

Just trying to understand if anyone has faced such issue? If yes, how did you go about implementing unit tests in TypeScript for Python CDK? Or is there a way to unit test my cloudformation template without doing a cdk deploy?

I am just a beginner to CDK, Any leads will be appreciated!

Tech girl
  • 15
  • 3

1 Answers1

1

First off - awesome on you for unit testing. More testing! :)

And it is your lucky day. It is only in experimental, so it is rather barebones (You really have to understand what a CloudFormation template would like like even without CDK to be able to write proper tests) but the Assertions library (https://docs.aws.amazon.com/cdk/api/latest/python/aws_cdk.assertions/README.html ) is now available for use in python!

Basically you have to know what properties your resources would have and then write your tests around those. But its super awesome to have unit testing of any variety for CDK, and even means TDD is (at least to start) possible with CDK now!

lynkfox
  • 2,003
  • 1
  • 8
  • 16
  • Hey thanks for pointing out the documentation link. I will check it out. Thanks for the tips, I will surely keep them in mind! – Tech girl Nov 02 '21 at 06:54
  • Hope it helps - if it does, please consider marking this as answer as accepted! – lynkfox Nov 02 '21 at 15:41