Changeset View
Changeset View
Standalone View
Standalone View
doc/functional-tests.md
Show First 20 Lines • Show All 227 Lines • ▼ Show 20 Lines | |||||
Util tests can be run locally by running `test/util/bitcoin-util-test.py`. | Util tests can be run locally by running `test/util/bitcoin-util-test.py`. | ||||
Use the `-v` option for verbose output. | Use the `-v` option for verbose output. | ||||
# Writing functional tests | # Writing functional tests | ||||
#### Example test | #### Example test | ||||
The [example_test.py](example_test.py) is a heavily commented example of a test | The [example_test.py](/test/functional/example_test.py) is a heavily commented | ||||
case that uses both the RPC and P2P interfaces. If you are writing your first | example of a test case that uses both the RPC and P2P interfaces. If you are | ||||
test, copy that file and modify to fit your needs. | writing your first test, copy that file and modify to fit your needs. | ||||
#### Coverage | #### Coverage | ||||
Running `test_runner.py` with the `--coverage` argument tracks which RPCs are | Running `test_runner.py` with the `--coverage` argument tracks which RPCs are | ||||
called by the tests and prints a report of uncovered RPCs in the summary. This | called by the tests and prints a report of uncovered RPCs in the summary. This | ||||
can be used (along with the `--extended` argument) to find out which RPCs we | can be used (along with the `--extended` argument) to find out which RPCs we | ||||
don't have test cases for. | don't have test cases for. | ||||
▲ Show 20 Lines • Show All 70 Lines • ▼ Show 20 Lines | |||||
the Bitcoin Core node application logic. For custom behaviour, subclass the | the Bitcoin Core node application logic. For custom behaviour, subclass the | ||||
P2PInterface object and override the callback methods. | P2PInterface object and override the callback methods. | ||||
- Can be used to write tests where specific P2P protocol behavior is tested. | - Can be used to write tests where specific P2P protocol behavior is tested. | ||||
Examples tests are `p2p-acceptblock.py`, `p2p-compactblocks.py`. | Examples tests are `p2p-acceptblock.py`, `p2p-compactblocks.py`. | ||||
### test-framework modules | ### test-framework modules | ||||
#### [test_framework/authproxy.py](test_framework/authproxy.py) | #### [test_framework/authproxy.py](/test/functional/test_framework/authproxy.py) | ||||
Taken from the [python-bitcoinrpc repository](https://github.com/jgarzik/python-bitcoinrpc). | Taken from the [python-bitcoinrpc repository](https://github.com/jgarzik/python-bitcoinrpc). | ||||
#### [test_framework/test_framework.py](test_framework/test_framework.py) | #### [test_framework/test_framework.py](/test/functional/test_framework/test_framework.py) | ||||
Base class for functional tests. | Base class for functional tests. | ||||
#### [test_framework/util.py](test_framework/util.py) | #### [test_framework/util.py](/test/functional/test_framework/util.py) | ||||
Generally useful functions. | Generally useful functions. | ||||
#### [test_framework/mininode.py](test_framework/mininode.py) | #### [test_framework/mininode.py](/test/functional/test_framework/mininode.py) | ||||
Basic code to support P2P connectivity to a bitcoind. | Basic code to support P2P connectivity to a bitcoind. | ||||
#### [test_framework/script.py](test_framework/script.py) | #### [test_framework/script.py](/test/functional/test_framework/script.py) | ||||
Utilities for manipulating transaction scripts (originally from python-bitcoinlib) | Utilities for manipulating transaction scripts (originally from python-bitcoinlib) | ||||
#### [test_framework/key.py](test_framework/key.py) | #### [test_framework/key.py](/test/functional/test_framework/key.py) | ||||
Wrapper around OpenSSL EC_Key (originally from python-bitcoinlib) | Wrapper around OpenSSL EC_Key (originally from python-bitcoinlib) | ||||
#### [test_framework/bignum.py](test_framework/bignum.py) | #### [test_framework/bignum.py](/test/functional/test_framework/bignum.py) | ||||
Helpers for script.py | Helpers for script.py | ||||
#### [test_framework/blocktools.py](test_framework/blocktools.py) | #### [test_framework/blocktools.py](/test/functional/test_framework/blocktools.py) | ||||
Helper functions for creating blocks and transactions. | Helper functions for creating blocks and transactions. |