Test Your Application

Test against the local tooling first, then move outward to more production-like environments.

This guide focuses on the shared testing progression that applies across SDK, CLI, and direct Rust work, even though the local daemon environment is the first concrete example.

Prerequisites

  • A test framework for your language

  • ant-dev installed from an ant-sdk checkout, or a direct-network local devnet if you are testing ant-core

If you also use the direct-network CLI, isolate ant-dev in a virtualenv, pipx, or a separate PATH so the two ant commands do not shadow each other.

Steps

1. Keep unit tests local to your own code

Mock the daemon client or direct-network wrapper at your application boundary.

from unittest.mock import MagicMock
from antd import PutResult

def test_store_data():
    mock_client = MagicMock()
    mock_client.data_put_public.return_value = PutResult(cost="1", address="abc123")

    result = mock_client.data_put_public(b"test data")
    assert result.address == "abc123"

2. Run integration tests against the local daemon environment

Start the local environment:

Check the daemon:

Then run a round-trip integration test.

3. Use the built-in example smoke tests

The ant-dev CLI can run example programs from the repo:

These are a good smoke-test layer before you run your own suite.

4. Add CI setup explicitly

If your CI job starts the local environment, make the ant-node checkout explicit:

Verify it worked

Your local integration environment is healthy when ant dev status reports a running daemon and your round-trip test passes against http://localhost:8082.

Common errors

Health check never turns green: Inspect ant dev logs.

Wrong daemon API shape in tests: Update tests to the JSON/base64 antd surface.

Local wallet issues: Recreate the environment with ant dev reset or ant dev stop followed by ant dev start.

Next steps

Last updated