Private BlockChain Implementation on Ethereum — QA strategy (Testing Techniques & Tools for Essential components) — RESTful webservices to define End points for Ethereum — Part 8

Your work is going to fill a large part of your life, and the only way to be truly satisfied is to do what you believe is great work. And the only way to do great work is to love what you do. If you haven’t found it yet, keep looking. Don’t settle. As with all matters of the heart, you’ll know when you find it. “ Steve Jobs.

This part is to explain how RESTful webservice is being used to exposed all the blockchain resources. Traditionally with Ethereum there is famous JavaScript API web3.js which provides interaction to Ethereum underlying features e.g. Registering contract, Deploying contract, invoking methods from deployed contract, calling methods to access state variables defined within contract, Accessing block related information etc. (Please refer following video on my channel through which you can understand how Web3.js works with test ethereum network running on local)

As we all know RESTful webservices are architectural pattern designed for sharing data over the network in the form of JSON, XML, Text etc over HTTP protocols by using HTTP methods like GET, POST, PUT, DELETE etc. As transferring data in JSON format has been widely accepted due to its light weight property & having support for almost in all programming language exists in today’s world (there may be some exception in older programming languages but those are very few.). Generally we also know these end points as Application Programming Interface which only returns data in the earlier mentioned format by executing functionality at server end.

In private blockchain implementation over ethereum also exposes RESTful end points by which all the functionalities related to Contracts, Nodes, Blocks, Messages, Accounts & key management etc.

Contracts — In smart contracts, these are general operations which can be done on contracts like

  1. Registering contracts
  2. Deploying Contracts
  3. Invoking Functions of contracts
  4. Accessing state variables on contracts
  5. Contract States
  6. Specific implementation to overcome smart contract used scripts (e.g. Solidity ABI has lots of limitations like embedded array elements can’t be accessed as ABI does not enough information to stored mapped array, Limitation to store contract fields data into relational database & there are many more such limitations)

Nodes — In blockchain, getting information about involved nodes in network is extremely important as this helps to ensure the behavior of network is as expected or not -

  1. Status of all node or specific node
  2. Status of involved domains (we can cover this later on as it is just to control the access of various network through which nodes spread across the globe will participate in blockchain network)
  3. Permissions on contracts
  4. Contract Catalogue
  5. Nonce based access to blockchain data

Blocks — by know hopefully we all should know what is block in blockchain so end points in this category help to interact with Blocks stored in blockchain like -

  • Latest Block
  • Collection of blocks from specific reference number
  • Block within specific domain
  • Block with Hash value

Messages — Messages are nothing but which actually turns out to be a transaction or collection of transactions supposed to be executed over the network so end points in this category help to interact with messages which have been processed by network -

  • Access message with hash
  • Access recent message from domain

Accounts — In ethereum platform, there are 2 types of accounts externally owned accounts & contract owned accounts so end points in this category help to interact with account for contract owned accounts -

  • Details of account at domain level
  • Activities done by account
  • Events of Account
  • Recent transaction of account

Key Management — End points defined in this category helps to create keys through which messages sent to network can be authenticated.

  • Creation of new key
  • Access keys/specific key
  • Delete key

Miscellaneous End Points -

All the above mentioned categories are related to interaction of smart contract within blockchain network however there are many more additional end points which helps to support all the above mentioned end points along with helping in maintaining & monitoring network.

Based on the need, all above mentioned operations has GET/POST/DELETE/PUT methods implementation which can be utilized to perform intended functionality. Being QA you just need know what exactly end point URI & what all parameters will it require to process. On successful completion, End point will provide you the JSON response (response can be in any form depending upon the implementation). Once you have response from end point, QA can verify it by using many tools available for testing webservices. I do love to write python script to do this verification however QA can write logic in any programming language like Java, C#, shell script, GO etc to do this verification. Only problem I observe every time that Error handling for all negative/boundary cases are not handled properly in most of the cases. That eventually results in many types of error messages which can’t even indicate the user where he has made the mistake in hitting end points especially for input parameters in POST/PUT request. This clause is not only for web service implementation on defining end points for blockchain type product but also for any other type of application. My recommendation for all the developers to define Error handling standards with product owner or technical architect before starting actual development. Once you starts development in agile then there is no bandwidth for any developer to define all these standards as priority becomes either to enhance existing feature or introduce new feature or fix the bug reported by customers.

There are plenty of tools available in market as open source through which testing of all these end points can be done in effective way. Based on the customer infrastructure & used technology stack, tools can be decided to provide effectiveness from QA standpoint -

1. POSTMAN

2. TestMaker

3. JMeter

4. vRest

5. KARATE DSL

6. SoapUI

7. HttpMaster Express

8. Rest — Assured

9. RestSharp

10. RestConsole

11. RoboHydra Server

12. Hippie-Swagger

13. WebInject

14. PyrestTest

15. AirBorne

16. UniRest

17. MockBin

18. Citrus Framework

I hope this would really help all the readers to understand this last but no least components of blockchain technology. Now in next 2 parts, I will try to collate all the components specific testing approach to come up with generic testing approach for blockchain based decentralized application for private network.

Keep learning & stay tuned for next part …….

Please start planting more & more trees to save this planet as we all are responsible for preserving the beauty of this planet in our solar space…….

BlockChain Evangelist & Enthusiast-Building Generic Automation Framework for BlockChain DApps for Ethereum at Startup

Looking for more of the latest headlines on LinkedIn?

Discover more stories

Originally published at https://www.linkedin.com on June 15, 2018.

BlockChain Evangelist & Enthusiast with 13 years of experience as Software Test Automation Architect - https://www.linkedin.com/in/abhishek-jain-31a72133/