Reading:
A Tester's Guide To Navigating The Wild West Of Web3 Testing
Share:
You Know Code, We Know Security!
With a combination of SAST, SCA, and QA, we help developers identify vulnerabilities in applications and remediate them rapidly. Get your free trial today!

A Tester's Guide To Navigating The Wild West Of Web3 Testing

Looking to get started with testing Web3 applications? Rafaela shares everything you need to get started

Web3 is the new era of the internet and is becoming an increasingly popular term. It represents the next step of the internet, claiming decentralized web infrastructure. You will see that the structure is based on a collection of dApps (decentralized applications) that use the Blockchain technology to create secure and transparent transactions.

Image showing the evolution of the web from 1.0 to 3.0. Web 1.0: 1990s-2000s Static read-only web pages. Web 2.0: 2000s-2020s Information-centric and interactive. 2020s User-centric, decentralized, private and secure

The difference is massive when you compare to the previous versions of the Web. Now the data is not owned by only one central entity, like Google, Twitter.Ā 

It is owned by you and only you decide who can have your information. Also, because of the Blockchain technology, it is far more secure than traditional web2.

Blockchain is the core and the base of any web3 app. It is really important to know the core and the structure of it to understand how web3 works. Letā€™s deep dive into the infrastructure of both web2 and web3.

Image describing infrastructure for web2 and web3. It starts with blockchain in the centre and the following items revolving around it: Consensus protocol, Immutable ledger, mining, p2p network and hash

Ā 

Firstly, letā€™s understand Blockchain, itā€™s made up of 5 key components:

  • Consensus Protocol: the mechanism used by the network of nodes in a blockchain to agree on a common ledger of transactions that are valid and immutable.
  • Immutable Ledger: it is a public database with the record of transactions in the Blockchain that cannot be changed, deleted or tampered with once they are recorded. This is made possible by the use of cryptographic hash functions and a distributed network of nodes that verify and validate the transactions.
  • Mining: (Not necessarily all Blockchains have this), it is a process of validating transactions and adding new blocks to the blockchain network. The process involves using computing power to solve complex mathematical puzzles, which requires a significant amount of energy and computational resources.
  • Hash: a hash is a fixed-length string of characters generated from a block of data using a cryptographic hashing algorithm. The hash function takes an input and produces a unique output, which is a fixed-size string of characters.
  • P2P Network (Peer-to-Peer Network): is a decentralized network architecture that allows individual computers or nodes to communicate and interact with each other directly without the need for a central server or authority.

These components together create a blockchain and are needed to verify the transaction and add a block to the Blockchain making it immutable (unable to be changed) and super secure. If you want to see what else you can study about Blockchain development, you can check out thisĀ roadmap.

Web2 has a Frontend, Backend and also a Database. All of these components are stored in the WebServer and only the WebServer has ownership and control of them.

Web3 has a Frontend still, which is the only component in the WebServer and the only component it has ownership and control of. TheĀ backendĀ is deployed to the Blockchain and controlled by the community in the Blockchain. So, the database and the contracts are all owned by the users, not one single entity.

System diagrams of Web2 and Web3. The Web2 diagram starts with a browser that connects to a front-end, which connects to a back-end which connects to a database. The Web3 diagram has a browser connecting to a front-end but the front-end then connects to a etherium blockchain. Inside the blockchain contains a ethereum virtual machine which contains smart contracts that feed into the virtual machine. Inside the virtual machine there are a collection of blocks.

Testing Web3 Applications

Because the structure is different, web3 applications are more singular to test. You need to focus on testingĀ smart contractsĀ and security. Some specific tests for security are required likeĀ Monkey Testing andĀ Static Analysis,Ā Common Threat Vectors and Source ofĀ Randomness AttacksĀ (This includes theĀ double spend problem). It is also important as it is in web2 to do someĀ penetration tests on your web3 App, and this is really critical as web3 Apps are all about security.

Another thing to keep in mind is the transaction speed, decentralized infrastructure and the complex business logic that you might come across when testing the dApp. To get familiar with the basic transactions you can use a wallet plugin likeĀ Metamask to perform the transactions in a local Blockchain using a tool likeĀ Ganache,

Remember you will still need to performĀ Unit,Ā Integration, Usability, Performance andĀ Functional Tests on web3 as you would on any other Web2 app.

There are many testing tools and frameworks that are available for testing web3 applications. These tools can help testers create test cases, generate test data, and automate test execution.Ā 

Some popular testing frameworks for web3 include:

  • Remix - A native IDE for Web3 Development.
  • Web3.js -Ā web3.js is a collection of libraries that allow you to interact with a local or remote ethereum node, really useful forĀ Unit Tests.
  • Hardhat - Ethereum Development tool, used for editing, compiling, debugging and deploying your smart contracts and dApps.
  • Waffle - test automation for Smart contracts.
  • Truffle - Compile, unit test, debug and deploy Smart contracts.
  • Brownie - Unit Test for Smart contracts.
  • Anvil - local Ethereum node, designed for development with Forge, akin to Ganache.
  • Synpress - E2E Tests for Web3 Applications.
  • Forge - Forge is a fast and flexible Ethereum testing framework, inspired by Dapp.
  • Etheno - Itā€™s a JSON RPC multiplexer, analysis tool wrapper, and test integration tool. It eliminates the complexity of setting up analysis tools like Echidna on large, multi-contract projects.

To check out other testing tools you can have a look atĀ Alchemy which has quite a good list of Web3 Test Frameworks for different Blockchains.

Types of Web3 Testing

Exploratory testing: This is going to be a similar process as any other web2 app. UseĀ heuristics and also the type of users that you have as a guide. Check if the wallet is working fine for both mobile and desktop platforms. If there is a wallet plugin and app just check if both are working fine. How was the process in general as an end user?Ā 

Functional testing: On top of the exploratory tests that you will need to perform on the web3 app, you will also need to do some functional tests on the smart contracts itself. First remember to do some Unit tests and check the deployment of the contracts, transactions,Ā gas fees are correct. Test the logic of the contracts and if they are performing as they should.Ā 

Check validation messages for example if the network is busy see what happens, or if you make multiple requests and it exceeds the balance of tokens in your wallet. Can you see the value was deducted from the wallet and the blockchain updated the block? What happens when you switch between networks and add accounts and import tokens?Ā 

Security testing is really important for web2 apps, but is absolutely crucial for web3 applications, as the blockchain is an immutable ledger. Once the bug is deployed then there is no rollback, basically the only way is forward. You need to focus on attacks that can happen, double spending transactions and keep up to date with the latest attacks. Penetration testing needs to be considered before going live and avoiding headaches in the future. Many attacks were recorded throughout the history of the blockchain already and all of them were extremely critical, once your app is considered vulnerable you will have lost the customer trust for good. Some examples of most recent and well known securities issues are:Ā Vega Protocol - Not sure if funds are safe after outage,Ā DAO Attack,Ā Assets stolen from Binance,Ā Hacker exploited a vulnerability in Parity multi-sig software wallet,Ā In 2014, Mt. Gox was hacked and thousands of Bitcoins were stolen

Performance testingĀ is used to test the scalability and speed of transactions on the network. It can be challenging since you might need to test the node transactions between different networks. For this one you can use any other tool that you use for web2 apps as well and the concept is the same, test transaction and response time.

Interoperability testing is a useful type of test when checking the compatibility of different web3 protocols and networks. For example if you want to swipe tokens between networks. As the blockchain ecosystem is vast, there are many different protocols and networks that developers can use. Interoperability testing helps ensure that the dApp or smart contract works seamlessly across different web3 protocols and networks.

Conclusion

Web3 testing is still a relatively new and small market, but this means you have time to prepare yourself. There are not too many tools and it is quite complex to develop and test such applications. You can give it a try using theĀ Metamask Test App or even run thisĀ workshop locally.

Everybody talks about AI nowadays and Web3 comes with the opposite idea. The idea to own your information. AI is nothing without your data and the way to prevent that is adopting web3 apps and technology. Web3 comes to revolutionize the way we use the internet and stop with the marketing and propaganda that is thrown up on us daily. It uses us as a product and we become a maneuver mass without even realizing.

You can find more resources about Web3 Tests on ourĀ Discord community or following people in the industry likeĀ Oleksandr Romanov,Ā Rhian LewisĀ orĀ myself.Ā 

Rafaela Azevedo's profile
Rafaela Azevedo

CEO & Founder | SDET Consultant

Current CEO and Co-Founder at The ChainAcademy, with the mission to bring more people to the Web3 community. SC Cleared Full Stack SDET with +16 years of Experience in QA, +14 years of Experience in Test Automation, and +9 years in Leadership, Delivering and Releasing Software on different platforms (Mobile, Desktop, Web). Became a STEM Ambassador , a STEM Women Member , and a Google Developer Expert making an impact and bringing more young people to the STEM area. Contributes to TestProject and instructor of Test Automation University (Contract Tests with Pact and Introduction to Blockchain Testing). Together with other Web3 and Blockchain Expert Testers created the Web3Tests Community on Discord and Twitter.



Comments
You Know Code, We Know Security!
With a combination of SAST, SCA, and QA, we help developers identify vulnerabilities in applications and remediate them rapidly. Get your free trial today!
A Guide to Using Cypress for API Interception in UI Test Automation
Automating Mobile Testing and Drastically Reducing Maintenance with AI
Ask Me Anything about Building a Test Automation Framework
Feature Spotlight - TestCompass: Modelling
Partner Peek - Xray - Make Tools Visible
Feature Spotlight: Using Checklist with Yattie
Teamwork Makes the Full-Stack Testing Dream Work
Thunderstruck by Serverless: a Tale of Learning and Testing Microservices - Conall Bennett
Technical Risk Analysis for AI Systems - Bill Matthews
With a combination of SAST, SCA, and QA, we help developers identify vulnerabilities in applications and remediate them rapidly. Get your free trial today!
Explore MoT
TestBash Brighton 2024
Thu, 12 Sep 2024, 9:00 AM
Weā€™re shaking things up and bringing TestBash back to Brighton on September 12th and 13th, 2024.
MoT Foundation Certificate in Test Automation
Unlock the essential skills to transition into Test Automation through interactive, community-driven learning, backed by industry expertise