Integration testing for Bitcoin and Omni Protocol using the Spock Framework.
There are currently three test suites contained in this project.
- Bitcoin RegTest Tests
-
Test Bitcoin RPC calls against an instance of
bitcoindrunning in RegTest mode. - Omni RegTest Tests
-
Test Bitcoin and Omni Core RPC calls against an instance of
mastercoredrunning in RegTest mode. - Omni Consensus Tests
-
Use the
getallbalancesforid_MPRPC to get balances for multiple Omni Protocol currencies and compare them against balance information from several well-known public Omni Protocol servers with consensus-checking Web APIs.
|
Note
|
Omni Core was formerly known as Master Core and the binary is still named mastercored, though that should change in a future release. The Omni Protocol was formerly Master Protocol.
|
The only prerequisite for running these tests is an installed Java Runtime Environment. Either an Oracle or OpenJDK VM will work. Java 7 or later is recommended.
All other dependencies are automatically downloaded and cached by the test startup script.
-
Check out this project using Git
$ git clone https://github.com/msgilligan/bitcoin-spock.git
-
Start Omni Core (or bitcoind) on MainNet listening on the standard RPC port on
localhost. The tests are configured to use the following username and password:rpcuser=bitcoinrpc rpcpassword=pass
-
Open a shell and set the current working directory
cd bitcoin-spock
-
Run the tests with the provided Gradle wrapper scripts. For Unix/Mac:
./gradlew consensusTest
or for Windows:
./gradlew.bat consensusTest
The above examples are for the Consensus Test, to run the other test suites replace the
consensusTestGradle target withregTestfor the Omni RegTests or withregTestBTCfor the Bitcoin RegTests.
To run the test from Jenkins we are using the following (UNIX) shell scripts:
- test-btc-integ-regtest.sh
-
Runs BTC RPC RegTest tests against a built executable of
bitcoindincopied-artifacts/srcdirectory. - test-msc-integ-regtest.sh
-
Runs Omni Core RPC regtest test against a built executable of
mastercoredincopied-artifacts/srcdirectory. - test-msc-consensus-mainnet.sh
-
Runs consensus tests against a built executable of
mastercoredincopied-artifacts/srcdirectory.
|
Note
|
Read the scripts carefully to make sure you understand how they work. |
Should "Send an amount to a newly created address"() {
when: "we create a new address and send testAmount to it"
def destinationAddress = getNewAddress()
sendToAddress(destinationAddress, testAmount, "comment", "comment-to")
generateBlocks(1)
then: "the new address has a balance of testAmount"
testAmount == getReceivedByAddress(destinationAddress)
}This project includes a variety of supporting classes necessary to implement the functional/integration tests. For an quick overview of these classes look at their API documentation (GroovyDoc).
The adoc directory of this project contains some additional documents that might be of interest: