dexX7 / OmniJ

Bitcoin and Mastercoin Integration Testing using Spock

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

bitcoin-spock

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 bitcoind running in RegTest mode.

Omni RegTest Tests

Test Bitcoin and Omni Core RPC calls against an instance of mastercored running in RegTest mode.

Omni Consensus Tests

Use the getallbalancesforid_MP RPC 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.

Installing pre-requisites

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.

Running the tests manually

  1. Check out this project using Git

    $ git clone https://github.com/msgilligan/bitcoin-spock.git
  2. 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
  3. Open a shell and set the current working directory

    cd bitcoin-spock
  4. 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 consensusTest Gradle target with regTest for the Omni RegTests or with regTestBTC for the Bitcoin RegTests.

Running the tests from Jenkins

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 bitcoind in copied-artifacts/src directory.

test-msc-integ-regtest.sh

Runs Omni Core RPC regtest test against a built executable of mastercored in copied-artifacts/src directory.

test-msc-consensus-mainnet.sh

Runs consensus tests against a built executable of mastercored in copied-artifacts/src directory.

Note
Read the scripts carefully to make sure you understand how they work.

Sample Test

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)
}

Supporting Libraries API Documentation

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).

Additional Documentation

The adoc directory of this project contains some additional documents that might be of interest:

About

Bitcoin and Mastercoin Integration Testing using Spock

License:Apache License 2.0


Languages

Language:Groovy 69.8%Language:Java 27.9%Language:Shell 2.3%