<p>If you are learning C++ from scratch you may struggle to start writing unit tests to begin with even if you identify a particular unit test that is missing. So that is one challenge.</p>
<p>In terms of discovering a missing unit test to write there are various ways to do this. It is worth monitoring the <a href="https://github.com/bitcoin/bitcoin/issues?q=is%3Aopen%20is%3Aissue%20label%3A%22good%20first%20issue%22" rel="nofollow noreferrer">good first issues</a> on the GitHub repo though I think that would be relying on a PR author deliberately not writing a unit test and leaving it as a good first issue.</p>
<p>Alternatively you could check out the unit test coverage on Marco Falke's <a href="https://marcofalke.github.io/btc_cov/test_bitcoin.coverage/index.html" rel="nofollow noreferrer">site</a> to see what files have low unit test coverage.</p>
<p>A useful case study is Fabian Jahr's first <a href="https://github.com/bitcoin/bitcoin/pull/16445" rel="nofollow noreferrer">contribution</a> to Core which was a simple code change that meant MacOS users skipped a functional test that was flaky on MacOS. He did a couple of excellent talks at Bitcoin Edge Dev++ 2019 on the Bitcoin Core <a href="https://diyhpl.us/wiki/transcripts/scalingbitcoin/tel-aviv-2019/edgedevplusplus/bitcoin-core-functional-test-framework/" rel="nofollow noreferrer">functional test framework</a> and on <a href="https://diyhpl.us/wiki/transcripts/scalingbitcoin/tel-aviv-2019/edgedevplusplus/debugging-bitcoin/" rel="nofollow noreferrer">debugging</a> Bitcoin Core.</p>
<p>Probably the most productive use of your time though would be to attend the weekly <a href="https://bitcoincore.reviews/" rel="nofollow noreferrer">Bitcoin Core PR review club</a> set up by John Newbery. Every week a different PR is chosen and during that you can ask about the tests written for a particular PR and whether there are any unit tests that are missing. You can attend on IRC at ##bitcoin-core-pr-reviews and you can ask whatever you want. New contributors are generally the primary target audience.</p>

CC BY-SA 4.0
2020-09-09T11:57:22.023Z
2020-09-11T12:39:07.273Z
2020-09-11T12:39:07.273Z
Michael Folkson
<p>Jumping straight to writing unit test can be hard, I suggest You check the official github page for how to contribute to the bitcoin core:</p>

<p><a href="https://github.com/bitcoin/bitcoin/blob/master/CONTRIBUTING.md" rel="nofollow noreferrer">https://github.com/bitcoin/bitcoin/blob/master/CONTRIBUTING.md</a></p>

<p>If I wanted to contribute I would personally start by trying to solve some of the problems on their issues page because it is fresh, there is a lot of work, some can be easy and help is always needed:</p>

<p><a href="https://github.com/bitcoin/bitcoin/issues" rel="nofollow noreferrer">https://github.com/bitcoin/bitcoin/issues</a></p>

CC BY-SA 4.0
2019-09-15T18:33:17.697Z
2019-09-15T18:51:53.283Z
2019-09-15T18:51:53.283Z
Saxtheowl
<p>I'm considering writing unit tests to Bitcoin core as a first step to C++ development and Bitcoin contribution. Anyone have any suggestions about the journey I'm about to begin and possible files that are needing tests?</p>

<bitcoin-core-development><c++><testing><contribution><unit-test>
Is writing unit tests a good way to start contributing to Bitcoin core?
João Grilo Bitcoinheiro
# Is writing unit tests a good way to start contributing to Bitcoin core?

(Asked by: username_0 on 2019-09-15)

I'm considering writing unit tests to Bitcoin core as a first step to C++ development and Bitcoin contribution. Anyone have any suggestions about the journey I'm about to begin and possible files that are needing tests?

**Tags:** bitcoin-core-development, c++, testing, contribution, unit-test


---

## 2 answers

### Answer by username_1 on 2020-09-09. Score: 1

If you are learning C++ from scratch you may struggle to start writing unit tests to begin with even if you identify a particular unit test that is missing. So that is one challenge.

In terms of discovering a missing unit test to write there are various ways to do this. It is worth monitoring the [good first issues](https://github.com/bitcoin/bitcoin/issues?q=is%3Aopen%20is%3Aissue%20label%3A%22good%20first%20issue%22) on the GitHub repo though I think that would be relying on a PR author deliberately not writing a unit test and leaving it as a good first issue.

Alternatively you could check out the unit test coverage on Marco Falke's [site](https://marcofalke.github.io/btc_cov/test_bitcoin.coverage/index.html) to see what files have low unit test coverage.

A useful case study is Fabian Jahr's first [contribution](https://github.com/bitcoin/bitcoin/pull/16445) to Core which was a simple code change that meant MacOS users skipped a functional test that was flaky on MacOS. He did a couple of excellent talks at Bitcoin Edge Dev++ 2019 on the Bitcoin Core [functional test framework](https://diyhpl.us/wiki/transcripts/scalingbitcoin/tel-aviv-2019/edgedevplusplus/bitcoin-core-functional-test-framework/) and on [debugging](https://diyhpl.us/wiki/transcripts/scalingbitcoin/tel-aviv-2019/edgedevplusplus/debugging-bitcoin/) Bitcoin Core.

Probably the most productive use of your time though would be to attend the weekly [Bitcoin Core PR review club](https://bitcoincore.reviews/) set up by John Newbery. Every week a different PR is chosen and during that you can ask about the tests written for a particular PR and whether there are any unit tests that are missing. You can attend on IRC at ##bitcoin-core-pr-reviews and you can ask whatever you want. New contributors are generally the primary target audience.


---

### Answer by username_2 on 2019-09-15. Score: 1

Jumping straight to writing unit test can be hard, I suggest You check the official github page for how to contribute to the bitcoin core:

<https://github.com/bitcoin/bitcoin/blob/master/CONTRIBUTING.md>

If I wanted to contribute I would personally start by trying to solve some of the problems on their issues page because it is fresh, there is a lot of work, some can be easy and help is always needed:

<https://github.com/bitcoin/bitcoin/issues>


---

