---
title: "5. Testing Scrypto Blueprints"
path: "/developers/scrypto/05-testing-scrypto"
version: "1.2.0"
author: "Hydrate"
createdAt: "2026-02-19T06:11:26.645Z"
updatedAt: "2026-03-16T18:26:10.252Z"
---

# 5. Testing Scrypto Blueprints

<Infobox>
| **Building & Testing [Scrypto](/developers/legacy-docs/updates/roadmap/scrypto/scrypto) Packages** |
| Difficulty | Beginner–Intermediate |
| Est. Time | 45–60 minutes |
| Prerequisites | [Dev environment setup](/developers/getting-started/01-install-scrypto) |
| Language | [Scrypto](/contents/tech/core-protocols/scrypto-programming-language) |
| Key Tools | `[scrypto](/developers/legacy-docs/updates/roadmap/scrypto/scrypto)`, `resim`, `scrypto-test` |
| Official Docs | [Scrypto Documentation](https://docs.radixdlt.com/docs/scrypto-1) |
</Infobox>

## Introduction

Once your [development environment](/developers/getting-started/01-install-scrypto) is set up, the next step is understanding the [Scrypto](/developers/legacy-docs/updates/roadmap/scrypto/scrypto) development workflow: creating packages, writing [blueprints](/contents/tech/core-concepts/blueprints-and-packages), building to [WebAssembly](https://webassembly.org), and testing locally. Radix provides two complementary testing approaches — the `resim` simulator for interactive exploration and the `[scrypto](/developers/legacy-docs/updates/roadmap/scrypto/scrypto)-test` framework for automated testing.

## Package Structure

A [Scrypto](/developers/legacy-docs/updates/roadmap/scrypto/scrypto) package is a standard Rust crate with [Scrypto](/developers/legacy-docs/updates/roadmap/scrypto/scrypto)-specific dependencies. When you run `scrypto new-package my-dapp`, you get:

```
my-dapp/
├── Cargo.toml          # Dependencies (scrypto crate)
├── src/
│   └── lib.rs          # Blueprint definitions
└── tests/
    └── lib.rs          # Test suite
```

The `src/lib.rs` file contains one or more [blueprints](/contents/tech/core-concepts/blueprints-and-packages) — reusable templates that define the structure and logic of on-ledger components. Each blueprint is annotated with the `#[blueprint]` macro and contains a struct (state) and an `impl` block (functions and methods).

### Building

Compile your package to [WebAssembly](https://webassembly.org) with:

`scrypto build`
This produces a `.wasm` binary and a `.rpd` (Radix Package Definition) file in the `target/` directory. The `.rpd` contains the package's ABI — the blueprint names, functions, methods, and their type signatures — which the [Radix Engine](/contents/tech/core-protocols/radix-engine) uses to validate calls at runtime.

## Interactive Testing with resim

The [Radix Engine](/developers/legacy-docs/reference/radix-engine/radix-engine) Simulator (`resim`) is a local ledger emulator that lets you publish packages, instantiate components, and call methods without connecting to any network. It is invaluable for rapid iteration.

### Core Commands

```
# Reset simulator state
resim reset

# Create a new account (returns address, public key, private key, owner badge)
resim new-account

# Set the active account
resim set-default-account <account_address> <private_key> <owner_badge_address>

# Publish a package (returns package address)
resim publish .

# Call a blueprint function (e.g. instantiate a component)
resim call-function <package_address> <BlueprintName> <function_name> [args...]

# Call a method on an instantiated component
resim call-method <component_address> <method_name> [args...]

# Inspect an entity's state
resim show <address>
```

### Typical Workflow

1. $1

2. $1

3. $1

4. $1

5. $1

6. $1

## Automated Testing with [scrypto](/developers/legacy-docs/updates/roadmap/scrypto/scrypto)-test

While `resim` is great for exploration, production packages need automated tests. Radix provides two testing frameworks:

### Unit Testing: [scrypto](/developers/legacy-docs/updates/roadmap/scrypto/scrypto)-test

The [scrypto-test](https://docs.radixdlt.com/docs/scrypto-test) framework uses an invocation-based approach — you call blueprint functions and methods directly in Rust, receiving actual [Bucket](/contents/tech/core-concepts/buckets-proofs-and-vaults) and Proof objects that you can assert against. At its core is the `TestEnvironment` struct, which encapsulates a self-contained [Radix Engine](/developers/legacy-docs/reference/radix-engine/radix-engine) instance.

```
use scrypto_test::prelude::*;

#[test]
fn test_instantiation() {
    let mut env = TestEnvironment::new();
    let package = Package::compile_and_publish(".", &mut env).unwrap();
    // Call functions, assert on returned [buckets](https://docs.radixdlt.com/docs/resources-and-data)/proofs
}
```

Key utilities include `BucketFactory` and `ProofFactory` for creating test resources, with strategies like `CreationStrategy::DisableAuthAndMint` for bypassing auth in test contexts.

### Integration Testing: TestRunner

The [TestRunner](https://docs.radixdlt.com/docs/learning-to-test-a-multi-blueprint-package) is an in-memory ledger simulator where you interact as an external user submitting transactions. It applies all the same costing limits and auth checks as the real network, making it ideal for end-to-end testing.

Run all tests with:

`scrypto test`
This wraps `cargo test` with the correct Scrypto feature flags and environment.

## External Links

- [Resim — Radix Engine Simulator](https://docs.radixdlt.com/docs/resim-radix-engine-simulator)

- [scrypto-test Framework — Official Docs](https://docs.radixdlt.com/docs/scrypto-test)

- [scrypto-test API Reference — docs.rs](https://docs.rs/scrypto-test/latest/scrypto_test/)

- [Testing Multi-Blueprint Packages — Official Docs](https://docs.radixdlt.com/docs/learning-to-test-a-multi-blueprint-package)