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

I too am looking for resources for testing the VTL’s. If there truly are not any, I would consider building a tool set because the request and response templates are at the heart of the business logic for an AppSync powered app and need to be tested.