Using Techelson With Liquidity

Techelson is a Test Execution Engine for Michelson smart contracts developed by myself at OCamlPro. With the (upcoming) release of Techelson, here is a relatively simple (although a bit dirty) setup to combine it with Liquidity locally, command-line style. Very little knowledge about Techelson is required. This post only assumes some familiarity with Liquidity.

NB: if you want to learn more about Techelson, make sure to read its user documentation.

Liquidity has a nice feature allowing to declare extensions to the language. Turns out they are powerful enough to generate Techelson's special instructions: you can write your tests directly in Liquidity, and tiny script run the tests for you.

First, make sure you have Liquidity and Techelson in your path. I'll assume they are called liquidity and techelson. Let's structure things a bit and have the working directory look like this:

├── contracts
│   └── "contracts go here"
└── tests
    └── "tests go here"

The first step is to teach Liquidity to generate Techelson special instruction and setup a tiny test script in Liquidity Extensions. Then test our setup on a Basic Example. After I will show how to write a test for an external, non-trivial contract in External Contract Example, using more advanced Techelson commands. Finally, there's The End at the end.

There is a listing of all the files used in this post in the File Listing section. Also, they are available here.