Recall that in the last issue we explained the introduction of automation testing related to PlatON, this time we will explain what testing work has been done in PlatON for smart contracts. First of all, we need to understand what a smart contract is. Essentially, a smart contract is a piece of program that automates the processing of traditional contracts in the form of computer instructions. Simply put, a smart contract is a piece of code that triggers the execution of a transaction between two parties on a blockchain asset, and this code is the smart contract. So here are a few questions to explain our smart contract testing at PlatON. This is the first part of the article.
Why do smart contract testing
PlatON testing is divided into two main parts.
- The first part is the economic model and chain characteristics validation
- The second part is smart contract validation and adaptation
In addition to ensuring that the PlatON chain’s economic model and business logic are working properly, it also needs to support a wide range of smart contracts on the chain, and therefore needs to be compatible with mainstream DAPPs on the chain.
Of course, the focus here is on PlatON’s ability to adapt to the methods, types and versions of smart contracts, and we verify this by writing corresponding test contracts.
Unlike a dedicated smart contract test, we require the business logic of the test contract itself to meet the logic required to verify PlatON’s chain adaptation.
What is the approach to smart contract testing
The PlatON testing team takes two approaches to testing smart contracts, chosen for different stages and scope of testing: the conventional industry mainstream testing approach is to use the
Truffle tool
- Easy to install
- Fast compile, deploy and call approach
- Low learning costs
Truffle’s features allow our testing team to use Truffle to make simple contract calls to verify the correct logic of a new contract after it has been tested, which is where the tool comes in handy.
We also choose to use Truffle if the changes in the release are simple and the value of automation is not high.
Smart contracts for automation
- High maintenance cost investment
- Saves time and manpower, and can be used as long as the code is well maintained
- Long upfront development cycle
Currently, PlatON’s testing team’s main smart contracts are automated, mainly because they can be tested in a short period of time during release iterations, maximizing the quality of the iterations and allowing for timely and comprehensive validation when development changes have a large impact so that problems can be identified and avoided.
The team only needs to add new test cases based on the features and additions of each release to continuously improve the level of test coverage, and to make it more accessible to more people, we also actively promote the combination of automated testing and continuous integration, which largely provides efficiency and quality in testing and development.
(To be continued)
Publisher:PlatONWorld,Please indicate the source for forwarding:https://platonworld.org/?p=5107