Skip to content

Test Coverage in FDC3

Rob Moffat edited this page Jan 20, 2026 · 2 revisions

This page documents how test coverage is collected, aggregated, and reported across the FDC3 monorepo.

Overview

The FDC3 project uses a multi-layered approach to test coverage, combining different testing frameworks across its various modules. Coverage data from all modules is merged into a single report to provide a unified view of the project's test coverage.

Different modules in the FDC3 monorepo use different testing frameworks. See the FDC3 Project Structure section in the README for the complete list of modules and their testing/coverage approaches.

How Tests Are Run

Running All Tests

From the root of the repository:

npm run test

This command executes the test script in all workspace packages that have one defined.

Running Tests for Individual Packages

Each package can have its tests run independently:

# For fdc3-standard (Jest)
cd packages/fdc3-standard
npm run test

# For fdc3-agent-proxy (Cucumber)
cd packages/fdc3-agent-proxy
npm run test

# For fdc3-get-agent (Cucumber)
cd packages/fdc3-get-agent
npm run test

Coverage Collection

Coverage is collected using nyc/istanbul for each sub-module. The project uses istanbul-merge to combine coverage data from all tested modules into a single report. The merged coverage data is written to coverage/complete.json.

This is then reported on GitHub PRs like so:

Screenshot 2026-01-20 at 10 47 32

Cucumber Testing

Cucumber is used for behavior-driven development (BDD) testing in the fdc3-agent-proxy and fdc3-get-agent modules.

Feature Files

Feature files define test scenarios in Gherkin syntax:

Example from packages/fdc3-agent-proxy/test/features/broadcast.feature:

Feature: Broadcasting

  Background: Desktop Agent API
    Given schemas loaded
    Given User Channels one, two and three
    Given A Desktop Agent in "api"
    Given "instrumentContext" is a "fdc3.instrument" context

  Scenario: Broadcasting on a named app channel
    When I call "{api}" with "getOrCreateChannel" with parameter "channel-name"
    And I refer to "{result}" as "channel1"
    And I call "{channel1}" with "broadcast" with parameter "{instrumentContext}"
    Then messaging will have posts
      | payload.channelId | payload.context.type | matches_type     |
      | channel-name      | fdc3.instrument      | broadcastRequest |

The fdc3-testing Module

The packages/fdc3-testing module (@finos/fdc3-testing) provides a shared testing infrastructure...

See the fdc3-testing README for full documentation of the testing DSL, including:

  • Variable references using {variable} syntax
  • Core step definitions for calling methods and assertions
  • JSONPath matching for validating complex objects
  • Schema validation using the matches_type column
  • Usage instructions for adding tests to new packages

Related Resources