Test Your Contract
If you created a new project using a template, you can find at the bottom of the lib.rs simple test cases which verify the functionality of the contract. We can quickly test this code is functioning as expected:
- Pop
- cargo-contract
pop test
cargo contract test
To which you should see a successful test completion:
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
Learn more about the testing strategies for ink! contracts.
Run End-to-End (E2E) tests
E2E tests compile and deploy your contract to a running node.
Run E2E tests:
- Pop
- cargo-contract
pop test --e2e
For more details and examples (including testing against live state snapshots), see the E2E guide.