Skip to main content

Testing and Debugging

Sui provides built-in tools for testing and debugging Move smart contracts at every stage of development.

What tools can I use to test and debug Move contracts on Sui?

Sui includes a native test framework for Move. You write unit tests directly in your Move source files using the #[test] attribute, then run them with sui move test. For more complex scenarios, the test_scenario module lets you simulate sequences of transactions and inspect object state between steps.

To step through execution traces interactively, the Move Trace Debugger integrates with VS Code. When something goes wrong at runtime, the error reference documents common abort codes and their causes.

The main tools available are:

  • Unit tests: Write test functions annotated with #[test] inside your Move modules. Run all tests with sui move test.
  • test_scenario: Simulate multi-transaction flows and model different user interactions in a controlled environment.
  • Move Trace Debugger: Step through Move execution traces in VS Code to inspect variable state and identify logic errors.
  • Error reference: Look up abort codes and error messages to diagnose failures quickly.