How does bitcoin functional test framework work?


Could someone explain how and where in the code the bitcoin test framework calls map to C++ bitcoin core code or RPC calls such that regression suite tests the bitcoin core functionality?

Background and more details I am writing a blockchain application and was thinking of how I can do regression while I keep developing. I wanted to leverage the design used by bitcoin (or any other blockchain application). I would expect that framework would call either C++ classes in bitcoin core directly or use RPC from python scripts such that features are tested.

I spotted that bitcoin functional tests are written in python scripts whereby calls a bunch of scripts testing specific features But I cannot spot in the bitcoin framework as to where it eventually calls actual bitcoin core c++ code or RPC.

Appreciate your help in spotting the code in python scripts in the framework that does it.

Happy ITWala

Posted 2018-04-14T05:32:56.633

Reputation: 153



The functional tests test the RPCs. The unit tests test the C++ code directly by calling the functions.

The functional test frameworks uses a version of python-bitcoinrpc which can be found here. This library allows the test framework to call RPC commands as if they were python functions; authproxy handles the conversion to HTTP POST requests for the RPC server. So when you see lines like self.nodes[0].getblockchaininfo(), it is actually calling the getblockchaininfo command on node0. You will see many lines like this throughout the functional tests.

Andrew Chow

Posted 2018-04-14T05:32:56.633

Reputation: 50 267