Waffle smart contracts test reporting

Power up your Waffle tests for Ethereum smart contracts with Tesults reporting. This page explains how to get setup, it takes just a couple of minutes to start reporting results from Waffle. If you have any questions please reach out to the Tesults team.

If you are not using the Waffle test framework but are using JavaScript/Node.js view the Node.js docs instead for integrating with a lower-level library.

Installation

Tests in Waffle are written using Mocha.

Tesults provides a test reporter for Mocha and you can use it with Waffle. Install mocha-tesults-reporter:

npm install mocha-tesults-reporter --save

Configuration

Update the package.json file for your Waffle project to use the Tesults reporter for your test script:

package.json
module.exports = {
  ...
  "scripts": {
    "build": "waffle",
    "test": "NODE_ENV=test mocha --reporter mocha-tesults-reporter -- tesults-target=token"
    }
  }
  ...
}

The 'token' above should be replaced with your Tesults target token, which you received when creating a project or target, and can be regenerated from the configuration menu.

Then run your tests as usual:

npm test

Basic configuration complete

At this point Waffle will push results to Tesults after your tests complete. The target arg must be supplied as shown above otherwise reporting will be disabled.

Next steps

See the Tesults Mocha documentation for advanced configuration details. Whatever the mocha-tesults-reporter supports can be applied for use with Waffle including supplying build information and file uploads.

Result Interpretation

Result interpretation is supported by Waffle (using mocha-tesults-reporter). Install version 1.2.0 or newer. If you use result interpretation we recommend you add these minimum mapping values:

passed
pass
failed
fail

Consolidating parallel test runs

If you execute multiple test runs in parallel or serially for the same build or release and results are submitted to Tesults within each run, separately, you will find that multiple test runs are generated on Tesults. This is because the default behavior on Tesults is to treat each results submission as a separate test run. This behavior can be changed from the configuration menu. Click 'Results Consolidation By Build' from the Configure Project menu to enable and disable consolidation by target. Enabling consolidation will mean that multiple test runs submitted with the same build name will be consolidated into a single test run.

Dynamically created test cases

If you dynamically create test cases, such as test cases with variable values, we recommend that the test suite and test case names themselves be static. Provide the variable data information in the test case description or other custom fields but try to keep the test suite and test name static. If you change your test suite or test name on every test run you will not benefit from a range of features Tesults has to offer including test case failure assignment and historical results analysis. You need not make your tests any less dynamic, variable values can still be reported within test case details.

Proxy servers

Does your corporate/office network run behind a proxy server? Contact us and we will supply you with a custom API Library for this case. Without this results will fail to upload to Tesults.

Have questions or need help? Contact us