githubEdit

Test

To learn how to test your ink! smart contract, from unit tests to e2e testing workflows, go checkout the ink! testing documentationarrow-up-right.

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

If you pass a single positional value and it isn't a directory, Pop treats it as a test filter and runs in the current directory:

pop test my_test_name

JSON mode

Use global --json for structured test results:

pop --json test

pop --json test --e2e is not supported. Run E2E tests without --json.

Pop checks for an ink dependency. If it finds one, it runs contract tests. If it doesn't, Pop runs cargo test for non-contract projects and then checks whether the project is a chain.

To run end-to-end (e2e) tests, for which you need a blockchain running:

 pop test --e2e

If you want to run you e2e tests on your own local chain specify the directory path using:

 pop test --e2e --node ../my-chain

Need help?

Ask on Polkadot Stack Exchangearrow-up-right (tag it poparrow-up-right) or drop by our Telegramarrow-up-right. We're here to help!

Last updated