In this lecture, we run through testing in Solidity and carry out a variety of tests on the game that we have been creating in previous courses in this learning path.
Meaning if you want to test where people started to interact with your smart contract, like we in our game, we have this high score list and you want to test. What happens if we have already 10 people in our high score list and suddenly an 11th person is going to go into the high score list with a new high score? Then you have to start from scratch. You cannot just take your high score list that is already deployed. All right. The last thing on this page, what I want to talk about is the speed and reliability considerations, and you can run Truffle tests against any network you want to. That means anything that you have in your Truffle configuration defined as a network you can use to run your tests against. Now if you choose to run it against a real blockchain then you have for every command, every interaction with your smart contract, every writing interaction, you have to wait until the transaction is mined, and that can take a very long time. If you remember back how we deployed our smart contracts when we set our ganache to 10 seconds. Let me just re-deploy this here. We're going to-- Where is it? Here, then it's still running from the previous lecture where we said we're going to deploy it with 15 seconds. Block mining time, it was a little bit too fast. Let me close this 15 seconds. Block mining time, I didn't save it. Well, that explains something. So, then every time you run a test, every time you start to interact with your your blockchain, you need to wait. You need to wait until the transaction is mined. And if you have a lot of tests and if you run these tests with your teams and if you run these tests all the time you can make changes, it can become very very cumbersome.
Tom is a CTO, senior back-end developer, and systems architect with over twenty years of hands-on development experience in a variety of languages and systems. He has a CS master's degree and has been working with Ethereum and blockchain technologies since 2016.