Docs
Submit an issue
Smart Contracts
Smart Contracts
  • WELCOME
    • Smart Contracts
    • Installing Pop CLI
    • How to contribute
  • GUIDES
    • Get tokens on Pop (Testnet)
    • Set up your development environment
    • Create a new contract
    • Build your contract
    • Run your unit tests
    • Deploy your contract locally
      • Deploy locally on a Solochain
      • Deploy locally on Pop
    • Call your contract
    • Running E2E tests
    • Deploy on Pop
    • Securely Sign Transactions from CLI
    • Getting Started with ink! v6
  • TUTORIALS
    • Your first ink! smart contract
    • Mint a PSP22 token on Pop
  • POP CLI
    • welcome
    • install
    • new
    • build
    • call
    • up
    • test
    • clean
Powered by GitBook
On this page

Was this helpful?

Edit on GitHub
  1. GUIDES

Run your unit tests

PreviousBuild your contractNextDeploy your contract locally

Last updated 1 month ago

Was this helpful?

⚠️ Note: This guide supports ink! v5 by default. For experimenting with ink! v6, please refer to our .

To run your ink! smart contract's unit tests, make sure you're in the directory of your contract and run the following command:

pop test contract

You should get output like the following:

┌   Pop CLI : Building a contract
│
 [==] Checking clippy linting rules
   Compiling proc-macro2 v1.0.79
   ....
   Compiling flipper v0.1.0 (/Users/pop/src/pop-cli/flipper)
    Finished test [unoptimized + debuginfo] target(s) in 8.06s
     Running unittests lib.rs (target/debug/deps/flipper-ff1505839f6873de)

running 2 tests
test flipper::tests::it_works ... ok
test flipper::tests::default_works ... ok

test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

   Doc-tests flipper

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

└  Unit testing complete

Further Reading Material

Technical Support

Create a question and tag it with ""

Share the StackExchange question in our

migration guide
https://use.ink/basics/contract-testing/off-chain#unit-tests
Polkadot Stack Exchange
pop
Pop Support Telegram channel