Instant Unit tests boilerplate with syntax analysis + synthetic events

Опубликовано: 10 Март 2023
на канале: Unlogged
113
2

How does Unlogged generate an instant boilerplate for unit tests?

A lot of folks asked us if we use Codex or other generative techniques to create a boilerplate for unit tests.

No. Here is how we do it.

We figure out the syntax tree of the code. We traverse over the AST to identify what’s happening inside a method body. We look for any variables getting initialized or any methods being called - we keep a track of their type information too. We then simulate events synthetically and using those events, we create a boilerplate for unit tests.

Our current focus is to make the product work fully offline, and syntax tree + synthetic events help us keep it offline.