Functional Tests
Functional tests live in test/functional/. They start local regtest nodes and
exercise node behavior through RPC and P2P interfaces.
This page is for contributors writing or running functional tests. It is not the general testing overview; see Testing.
Running Tests
From the Tidecoin Core repository after building:
build/test/functional/test_runner.pyRun a single test:
build/test/functional/test_runner.py wallet_pqhd_policy.pyRun several tests:
build/test/functional/test_runner.py wallet_pqhd_policy.py auxpow_mining.pyControl parallelism:
build/test/functional/test_runner.py --jobs=1Tidecoin-Specific Tests
| Area | Tests |
|---|---|
| PQHD wallet policy | wallet_pqhd_policy.py, wallet_pqhd_seed_lifecycle.py |
| PQ script assets | feature_pq_script_assets.py |
| AuxPoW | auxpow_mining.py, auxpow_invalidpow.py, auxpow_zerohash.py |
| P2P v2 transport | p2p_v2_transport.py, p2p_v2_encrypted.py |
Writing a Test
- Start from
test/functional/example_test.pyor a nearby test. - Name the file by area, such as
wallet_...,rpc_...,p2p_..., orfeature_.... - Use a module docstring that explains what the test covers.
- Keep
self.num_nodesas small as possible. - Prefer named RPC arguments when a call has many parameters.
- Use
self.log.info(...)to explain test phases in the log. - Add the test to the runner metadata when required by the framework.
Regtest Activation Notes
Tidecoin regtest activates AuxPoW-related rules from genesis. Tests can still create non-AuxPoW blocks where the helper supports it, but test authors should be explicit about whether they are testing pre-AuxPoW or post-AuxPoW behavior.
Do not assume Bitcoin subsidy values, ECDSA key behavior, or Bitcoin descriptor semantics in Tidecoin tests.
Debugging
| Need | Tool |
|---|---|
| Keep datadirs | --nocleanup |
| Reduce noise | --jobs=1 |
| Inspect RPC coverage | --coverage |
| See all options | build/test/functional/test_runner.py -h |
| Profile on Linux | functional test --perf support |
See also: Testing, Fuzzing, PQ Test Vectors.
Last updated on