Blockchain Tests Workshop at The National Software Testing Conference

Hello guys, here are the slides from the workshop on Blockchain Tests that I gave earlier this week, as well as some responses to the issues that were addressed during the session. I can say as my first presential workshop after pandemic, it was a great experience with a full room 😃


Unfortunately, there is no recording of it, but you may clone the repo and follow the coding instructions to build the test class and methods, then compare to version 2 of the project, which has the most recent version.

What is the Required() function in Solidity?

The require Solidity function guarantees validity of conditions that cannot be detected before execution. It checks inputs, contract state variables and return values from calls to external contracts.

Where the Address type comes from ?

The address type comes in two flavours, which are largely identical:

  • address: Holds a 20 byte value (size of an Ethereum address).
  • address payable: Same as address, but with the additional members transfer and send.

The idea behind this distinction is that address payable is an address you can send Ether to, while a plain address cannot be sent Ether.

Type conversions

Implicit conversions from address payable to address are allowed, whereas conversions from address to address payable must be explicit via payable(<address>).

Explicit conversions to and from address are allowed for uint160, integer literals, bytes20 and contract types.

Other tools that you can use to test Blockchain applications

  • Ethereum Tester,
  • Hyperledger Composer
  • Exonum test kit
  • Embark
  • Populus
  • BitcoinJ
  • Binance

Resources

Configuration to tests with device (netbeans) – Calabash Android (Cucumber)

Acess the folder plataform-tools of Android Sdk and execute:
./adb start-server

Verify if the device was connected on pc, list of device and emulator:
./adb devices

Ps. 1 : Case give some error telling that the device wasn’t connected, verify if the USB Debugging Mode are enable on device (Settings> Developer Options > USB Debugging)

Fonts: http://stackoverflow.com/questions/7394868/netbeans-android-compile-test-on-real-device-unix-osx

Ps. 2 :If the your environment be configurate to run with emulator on Eclipse is necessary adjust the configurations of execution, it is written on the link: http://www.donnfelker.com/running-your-android-app-on-a-device/

*Execute the Apk on Device:
– If you have an emulator and a device connected in the same time, execute:
calabash-android to run apkfile.apk ADB_DEVICE_ARG=SERIAL (Serial captured of the device’s list, previously)

– Execute the console irb of apk
Same way on emulator, execute:
calabash-android console apkfile.apk

* Don’t forget of do the start of server on shell:
start_test_server_in_background

Contributed by Lieuthier, Eduardo