Introducing Test Scenarios in

Proving properties of smart contracts is of paramount importance and one of Tezos’ moto is about formally verifying its infrastructure and smart contracts.

We claim that formal verification is not the only tool to understand a smart contract and before formally proving properties, one should first perform unit-tests or scenario tests. It has a few very useful consequences: we may discover bugs, we may discover properties that we want to formally prove and, finally, it may also be the case that, for a given smart contract, we only need a few tests to be convinced of what it’s doing and do not need the full formal verification machinery.

From day one, has used test scenarios for this very purpose.

This small document explains a new version of these test scenarios that brings new nice capabilities.

An example

We start by an example.

Here is a very simple example of a smart contract doing something pretty useless: it stores two values and provides an entry point that can change its first value (called ) as long as it is bounded by 123.

This can be tested by defining the following test and scenario in the same script.

This definition can be evaluated in-browser in or out-of-browser with SmartPyBasic and both compute the scenario.

In, the scenario is computed and then displayed as an html document.
With SmartPyBasic, this is first computed as a .json scenario file that is then evaluated.


As seen in the previous example, a scenario in a test is introduced by . We interact with it by using several constructions.

  • Registering and displaying contracts.
  • Registering and displaying calls to entry points.
  • Adding document informations
  • Computing expressions.
  • Checking assertions.

An intuitive and effective smart contracts language and development platform for Tezos. In Python.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store