Blockchain Testing Tools
Before we look at some testing tools, let’s make sure that we are all on the same page with what blockchain is.
What is Blockchain?
Most folks know blockchain as the protocol that underpins Bitcoin, but it’s much more than that. You can essentially think of it as an “appends only” digital ledger—similar to a shared spreadsheet record.
It’s basically a data structure which exists in many different places at once and which is very difficult to make amendments to because you can’t ever delete from it. You can only add to it.
This is a cool feature because it exchanges its central power structure model for a decentralized network of independent record keepers.
This approach minimizes the possibility of an unauthorized person being able to manipulate records. In turn, this makes the record more secure, giving users more confidence in the digital data that is in the blockchain.
How Do You Test Blockchain Applications?
Rhian and I agree that it’s really not much different from any other application you would test. The same logic and critical thinking you already use for testing non-blockchain projects still apply.
Of course, the individuals working on blockchain applications need to possess amazing mathematical and cryptographic skills, but when it comes down to it most of the work that’s being done is just normal development work with normal testing criteria.
Many of the testing techniques you already know, like testing at the boundary, performance testing, compliance and especially security testing, apply to blockchain. Sometimes its just a matter of getting familiar with some of the common blockchain testing tools that are already out there.
Blockchain Testing Tools
During my interview with her, Rhian mentioned that in terms of hands-on testing, there are some pretty good tools and frameworks being developed that can help with both development and testing.
I went looking for some of these blockchain testing tools, and this is what I found:
Ethereum is the best-known blockchain (other than Bitcoin), and it has some great frameworks for developing applications, many of which have libraries baked in to make testing fairly easy.
Simply put, Ethereum Tester provides tools for testing Ethereum-based applications.
Truffle bills itself as the most popular Ethereum development framework, and based on its 4,288 stars on GitHub it, clearly is popular.
Ganache (formally Testrpc)
Before you release your blockchain application to production, it’s important that you test it locally.
Ganache is the most-used library for testing Ethereum contracts locally. It works by spinning up a kind of mock blockchain that gives you access to accounts you can use for testing.
Rhian doesn’t feel that it conveys the same latency you get on a live system, doesn’t really replicate real-world scenarios for the time things take and so on. But it’s enough to let you compile a contract, deploy it, determine its cost, and debug it locally.
Manticore is a symbolic execution tool for analysis of binaries and smart contracts. Manticore enables human-assisted analysis and the automatic detection of vulnerabilities.
Hyperledger Composer is an open-source development tool that contains many functions to help build blockchain applications. Some of those features also help with testing. More specifically, it supports three types of testing: interactive testing, automated unit testing and automated system testing.
It has a command-line interface that provides commands allowing you to easily run interactive “smoke tests” to ensure the deployment was successful. This also makes it easy to execute tests in a CI/D system.
System tests can also be created using Docker Compose and Mocha/Chai. You can start a runtime and deploy your business network definition, then programmatically create assets, submit transactions and inspect the state of asset registries.
Testkit for Exonum Blockchain is a framework that allows you to test the operation of the whole service. Specifically, it allows you to test transaction execution and APIs in the synchronous environment (without consensus algorithm) and in the same system process.
Embark is another popular framework for building, testing and deploying your app. It’s a framework that allows you to easily develop and deploy decentralized applications (DApps).
Corda Testing Tools
Corda is a blockchain-inspired, open-source distributed ledger platform. It has a built-in testing feature to help with:
BitcoinJ is a library for working with the Bitcoin protocol. It allows you to interact with Bitcoin and connect directly to the Bitcoin network. And by using the functions in this library, we can send and receive Bitcoins in real time.
For testing, BitcoinJ provides a TestUtils class that can do things like manufacture fake transaction objects and so on.
For ideas on how to take advantage of TestUtils, take a look at the test suite for BitcoinJ itself.
Testers get Started with Blockchain
Many of these testing activities are currently being done by developers doing their own testing. This is awesome, but as blockchain gains popularity, testers will need to start getting involved as well.
It’s simply a matter of making a small leap of faith into a technology that is completely different than what you may have tested in the past.
I’m hoping this article will give you enough information to start your own blockchain testing investigation, and set you on your way to being comfortable with this technology.
Rhian Lewis an awesome resource, so be sure to follow her on Twitter.
Rumor also has it that she may be developing an online tester course on Ethereum…so stay tuned!