Focus mode

Smart Contract development on Solana using Rust

Testing with Anchor

Why is testing needed?

  • Understand and validate the behaviors of your smart contract. Code has a habit of performing not exactly how we intended. Through testing, we can get a better understanding of how our smart contract will function once deployed. 
  • Investing in testing saves time later in debugging. Unfortunately, testing won't fix every bug in your smart contract code but it is helpful to you to determine the cause of your bugs. 
  • Confidence that any new code added still functions the way the smart contract is intended to and does not introduce any breaking changes. 

There are two main types of tests that are important when working with smart contracts: 

Unit Tests : These tests verify a certain single component in your smart contract is performing correctly. This could be a certain function or event that you have created. 

Integration Tests: These tests verify that the interaction between multiple components inside your smart contract is performing correctly. These components can be internal or external for example when calling another smart contract or getting information from an oracle.

Resources:

https://www.anchor-lang.com/docs/high-level-overview 

https://betterprogramming.pub/the-top-blockchain-developer-frameworks-for-2021-89afa5e7bd04 

https://www.web3.university/article/20-blockchain-development-tools

https://www.leewayhertz.com/how-to-build-dapp-solana/ 

left-disk

Programs to Accelerate Your Progress in a Software Career

Join our 4-8 month intensive Patika+ bootcamps, start with the fundamentals and gain comprehensive knowledge to kickstart your software career!

right-cube

Comments

You need to enroll in the course to be able to comment!