Why test? - cogeorg/teaching GitHub Wiki
Once you deployed your contract to a running node, you can not mutate it anymore. If you find a bug in your contract, the only possibility you have is to disable the contract, fix the bug, and deploy another instance of the contract. To mitigate this risk, it is important that you test your contract before deploying it to the production environment.
In terms of testing strategy, you can use several testing environments before final deployment of your solution. You can use truffle develop and Ganache because they are faster and use some specific features to optimize testing. You can use geth to create a private network to check your solution on the same node implementation as one one used in production. You can also use a test network liky Ropsten or Rinkeby as an acceptance environment. Here, you will have the possibility to share the address with testers in any of these testing environments.
You can test the features of your contract by using a dedicated testing framework. Truffle bundles such a testing framework and provides two ways to test your contract. Either JavaScript, to test you smart contract from a client's point of view, or solidity to test your smart contract within the blockchain by simulating another contract interacting with yours. Testing your contract with solidity is quite new and not the most documented option. This is why we will focus on JavaScript testing.
There are other JavaScript testing and deployment frameworks like Embark or Dapp. There is also a Python testing framework called Populus, but it seems inactive. However, if you are more comfortable testing in Python, you can write your own testing suite quite easily using Web3.py.
The main goal of a testing strategy is to increase your level of confidence in the quality of your solution and to avoid big production issues that might compromise your credibility while harming users.