ppcoin/ppcoin — pull request #76 by sigmike (2014-10-05 07:39:46+00:00)
Title: Added functional tests

While working on NuBits I added functional tests. I ported the system to Peercoin to test the duplicate stake block rejection.

The system uses [Docker](https://www.docker.com/) to create lightweight virtual machines running nodes connected to each other on an isolated blockchain. And it uses [Cucumber](http://cukes.info/) to write tests in plain English.

A test (or "feature") looks like that:
https://github.com/sigmike/peercoin/blob/65cc0468398271805bc3764f710d3144210fa230/src/test/features/revert_duplicate.feature

Each scenario step calls a Ruby block that manipulates the containers.
Here's an example of a simple step definition:
https://github.com/sigmike/peercoin/blob/65cc0468398271805bc3764f710d3144210fa230/src/test/features/step_definitions/common.rb#L87-L89

Some tests (like sending a duplicate block) required new RPC commands. I've added them inside an #ifdef TESTING conditional:
https://github.com/sigmike/peercoin/commit/65cc0468398271805bc3764f710d3144210fa230#diff-c10c2955226a46a341b05d00f59525b1R284
I've also made other minor changes that only affect the code if TESTING is defined.

I've described how to set everything up here:
https://github.com/sigmike/peercoin/blob/65cc0468398271805bc3764f710d3144210fa230/src/test/containers/README.md