<p>I would separate out the unit tests and the integration tests.</p>

<p>If the function needs to go out to the internet or wait for the blockchain, I make them integration tests which I can run less frequently like every five minutes. The functions that are fast I like to run every 10 seconds.</p>

<p>Linking the errors to sensible time stamped logs like pm2 and key-metrics allows you to see what has been going on while you were sleeping.</p>

CC BY-SA 3.0
2016-06-10T06:38:12.163Z
2016-06-10T06:38:12.163Z
Will-In-China
<p>So I have multiple instances of bitcoind in regtest mode. 1 instance is for the app wallet and one stimulates a wallet of a possible user. </p>

<p>I want to perform various functional and integration tests of the app.</p>

<p>Basic example, if user sends bitcoin from his wallet is that bitcoin correctly received by the app. </p>

<p>The problem though is that there is a time delay before that receiving node notices the transaction (even when both instances are on same machine). This screws up my tests, I tried putting in a sleep(10) function in my test code and that increases the success, but sometimes they still fail and I cant have my automated tests taking so long. (plus its seems very inelegant).</p>

<p>I'm wondering how others deal with this.</p>

<bitcoind><json-rpc><regtest><testing><website-integration>
Automated Testing using bitcoind in regtest mode, problems due to race condition
Cyrus
# Automated Testing using bitcoind in regtest mode, problems due to race condition

(Asked by: username_0 on 2016-06-10)

So I have multiple instances of bitcoind in regtest mode. 1 instance is for the app wallet and one stimulates a wallet of a possible user.

I want to perform various functional and integration tests of the app.

Basic example, if user sends bitcoin from his wallet is that bitcoin correctly received by the app.

The problem though is that there is a time delay before that receiving node notices the transaction (even when both instances are on same machine). This screws up my tests, I tried putting in a sleep(10) function in my test code and that increases the success, but sometimes they still fail and I cant have my automated tests taking so long. (plus its seems very inelegant).

I'm wondering how others deal with this.

**Tags:** bitcoind, json-rpc, regtest, testing, website-integration


---

## 1 answers

### Answer by username_1 on 2016-06-10. Score: 1 | Accepted answer

I would separate out the unit tests and the integration tests.

If the function needs to go out to the internet or wait for the blockchain, I make them integration tests which I can run less frequently like every five minutes. The functions that are fast I like to run every 10 seconds.

Linking the errors to sensible time stamped logs like pm2 and key-metrics allows you to see what has been going on while you were sleeping.


---

