You can also write test cases in the Solidity contract. For this, there are standards you need to follow:
- The test contract file should be kept under the test folder.
- The Solidity contract filename must be prefixed with Test, for example, TestDepositContract.sol, which you can find with our project source code.
- The name of the test functions present in the contract must be prefixed with test. For example, we have the testDeposit() function defined in TestDepositContract.sol.
- For assertion functions, you need to import the Assert.sol contract file in your test contract. The syntax to import it is import "truffle/Assert.sol".
- To get the address of the deployed contract, you can import DeployedAddresses.sol, as ...