Glossary definition

Unit testing

Smart contract unit testing checks small pieces of contract or program behavior in a controlled environment with explicit inputs and expected outcomes.

also: smart contract unit testing, unit test, contract testing · reviewed July 22, 2026

In computer programming, unit testing is a software testing method in which the smallest testable parts of a program are tested individually and independently to determine whether they are fit for use.

When we find it appropriate and useful—which is most of the time—we write our own unit tests.

For EVM smart contracts written in Solidity, the following frameworks can be used to write unit tests:

  • Wake, where tests are written in Python
  • Hardhat, where tests are commonly written in JavaScript or TypeScript
  • Foundry’s Forge, where tests are written in Solidity

The original glossary noted that Solana lacked comparable testing tooling. That is no longer the case: Anchor and Solana’s native Rust testing tools now support local program tests.

Used in context

Articles using this term.