<p>The functional tests test the RPCs. The unit tests test the C++ code directly by calling the functions.</p>

<p>The functional test frameworks uses a version of <a href="https://github.com/jgarzik/python-bitcoinrpc" rel="noreferrer">python-bitcoinrpc</a> which can be found <a href="https://github.com/bitcoin/bitcoin/blob/master/test/functional/test_framework/authproxy.py" rel="noreferrer">here</a>. 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 <code>self.nodes[0].getblockchaininfo()</code>, it is actually calling the <code>getblockchaininfo</code> command on <code>node0</code>. You will see many lines like this throughout the functional tests.</p>

CC BY-SA 3.0
2018-04-14T06:12:59.043Z
2018-04-14T06:12:59.043Z
Ava Chow
<p>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?</p>

<p><strong>Background and more details</strong>
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.</p>

<p>I spotted that bitcoin functional tests are written in python scripts whereby test_runner.py 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.</p>

<p>Appreciate your help in spotting the code in python scripts in the framework that does it.</p>

<bitcoin-core-development><python><regtest><testing><functional-test>
How does bitcoin functional test framework work?
Happy ITWala
# How does bitcoin functional test framework work?

(Asked by: username_0 on 2018-04-14)

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 test\_runner.py 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.

**Tags:** bitcoin-core-development, python, regtest, testing, functional-test


---

## 1 answers

### Answer by username_1 on 2018-04-14. Score: 8 | Accepted answer

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](https://github.com/jgarzik/python-bitcoinrpc) which can be found [here](https://github.com/bitcoin/bitcoin/blob/master/test/functional/test_framework/authproxy.py). 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.


---

