Neo-fairy-test is a set of tools designed to improve the testing and debugging experience of Neo N3 smart contracts. The solution is maintained by Neo blockchain developer Hecate2 and packaged as a plugin for NeoCLI. This allows developers to test transactions and smart contracts against actual network status.
Fee operations
The test environment delivers a significantly different experience than Neo Express, which offers easy-to-deploy private networking. Instead, neo-fairy-test allows developers to send ‘fairy transactions’ or deploy ‘fairy contracts’ to their own customized version of public networks, such as MainNet or TestNet.
These operations are executed and stored in memory on the local node rather than published in MainNet blocks. This feature enables thorough testing in real on-chain environments, without having to redeploy and configure code, pay gas fees, or make unintended changes to the global state.
Debugging
Another advantage of the tool is its ability to facilitate complete testing and debugging. The DumpNef plugin allows developers to take advantage of features such as setting debug information, breakpoints, and calling contracts via the debug API. This capability returns a detailed execution trace, making the debugging process more efficient.
The FairyEngine also allows fine-grained control over system time and random numbers. Controlling these usually dynamic values ββis especially useful for developers working with time-bound smart contracts or debugging code that has been made non-deterministic by randomness.
References
In addition to the practical tools, a comprehensive guide to debugging Neo N3 is included. It uses Visual Studio to demonstrate how to detect contract exceptions down to the Neo source code level. The guide provides information on many core Neo concepts to aid the developer, including elements such as remote nodes, transactions, blocks, verification, dBFT consensus, and more.
Finally, a Python client is also available, which can be used to simplify interaction with a Neo node running the Fairy plugin. The documentation shows how to use the client to invoke fairy contracts, clone snapshots, and perform debugging. It also includes example use cases, such as executing an NFT loan, that illustrate the tool’s capabilities and applications.
Get started with neo-fairy test via the link below:
https://github.com/Hecate2/neo-fairy-test/