Do you write unit test for velocity templates?

Is this even possible?

Hello friends.
I’m in the process of building a production application using AppSync + DynamoDB and I’m starting to have quite a large pile of resolver mapping templates, all which are written using the Apache Velocity Template Language (VTL).

The concern I’m starting to have is that these vtl files are quite critical to the application and a bug in one of the could wreak havoc. So like any critical part of a system… I would like to write some automated unit tests for them. But I haven’t found much about others doing this.

  1. If you’re using VTL (with AppSync or API Gateway), how do you test them?
  2. Is it even possible to write automated tests to velocity templates?
  3. Or am I going down the total wrong path and I should just be using Lambdas as my resolvers?

Thanks in advance!

2 Likes