Rust
Pengenalan Pinocchio

Pengenalan Pinocchio

This content is being translated and will be available here when ready.

Testing your Program

Thorough testing is essential before mainnet deployment to identify potential bugs and vulnerabilities.

Well-tested programs prevent financial losses, build user trust, and ensure applications behave correctly under various conditions.

Mollusk Tests

When setting up complex program states or requiring intricate onchain interactions proves difficult, Mollusk provides more granular control over the testing environment.

Mollusk is a Rust testing framework designed specifically for Solana programs that enables you to:

  • Test program logic in isolation without network overhead
  • Set up complex account states and program conditions easily
  • Run tests faster than full integration tests
  • Mock specific blockchain conditions and edge cases

We covered Mollusk testing thoroughly here.

To test your pinocchio program, just import your test.rs file with the test config flag in your lib.rs:

rust
#[cfg(test)]
pub mod tests;

Run your tests using:

 
cargo test-sbf
Daftar Isi
Lihat Sumber
Blueshift © 2025Commit: 0ec4e4d