Author Topic: Blockchain tests in Javascript  (Read 954 times)

Dirk Diggler on: May 01, 2015, 10:33:13 PM

  • FIMK Staff
  • *****
  • Posts: 486
    • View Profile
    • Krypto Fin ry
For several new features we are currently making quite extensive changes to FIMK core.
Right now mainly for the private assets feature but some other big implementations are around the corner.

To make sure this all works properly tests are required that can simulate a working blockchain.
We've had the Java based Junit tests for some time now but the main recurring problem was all the code you'd have to write to make a simple test.

This had to be done easier. Writing tests should be quick and fun, only then will you write tests that touch all parts of the software. And having an easy to use testing tool allows for much faster development.

Through combining the new native Javascript support in Java 8 and the existing Junit work that was done by the NXT team I was able to come up with a super easy to use javascript -> java -> FIMK integration with which it's now very easy to write complex tests that touch all parts of FIMK and do it in a human friendly readable way.

Since we already had all the conversion scripts to work with internal FIMK units (so called NQT, QNT and the variable asset decimal places) available in mofowallet - and since mofowallet is javascript and our tests are now too - i was able to reuse all those scripts.

To get an idea what that looks like please check out these working FIMK tests written in javascript: BlockchainTest.js

Now that all this is working I'll try and formalize it so anyone could stick a javascript test in a folder and easily run his tests.
Hopefully soon we'll have more people writing tests which leads to a better code base and allows other developers to get started quicker with FIMK core development.
FIMK Developer | GPG fingerprint: CEF2 7C39 43BE 6800 504E  71BC 7E87 A7B0 AC34 E2D5 | | blog