LetsFlow
  • Introduction
  • Tutorial
    • The basics
    • A handshake
    • A conversation
    • A proper introduction
    • Group meeting
    • Quote
  • Cookbook
  • ENGINE
    • Installation
    • Authentication
    • API
    • Services
      • Configuration
      • Messaging
        • ZeroMQ
        • AMQP 0-9-1
        • Webhook
      • Engine service
  • Integration
    • Frontend
      • React
      • Angular
      • Vue
      • Svelte
    • Backend
  • Reference
    • Scenario
      • Actor
      • Action
        • Update instruction
      • State
        • Transition
          • Log
        • Notify
      • Data function
    • Schema
    • Process
      • Current state
      • Previous log
      • Prediction
      • Events
        • Instantiate event
        • Action event
        • Timeout event
  • Libraries
    • Core library
    • JMESPath
    • Test suite
      • Given
      • When
      • Then
        • Assert state
        • Assert actor
        • Assert variable
        • Assert service
        • Assert event
      • Customize
  • Advanced topics
    • Deep integration
    • Decentralized workflows
    • Custom JMESPath functions
    • Custom YAML tags
Powered by GitBook
On this page
  • Installation
  • Gherkin
  • Example
  • Steps

Was this helpful?

  1. Libraries

Test suite

PreviousJMESPathNextGiven

Last updated 17 days ago

Was this helpful?

The LetsFlow test-suite allows you to validate LetsFlow scenarios (defined in YAML) through end-to-end tests using Cucumber. It ensures that:

  • Scenarios are correctly written and valid (schema-compliant).

  • The LetsFlow engine interprets and executes them as expected.

  • Tests simulate real-world actor inputs and decisions in a controlled way.

This helps scenario authors verify workflows behave correctly across different conditions without needing to deploy or manually test them.

Installation

yarn init
yarn add --dev @cucumber/cucumber @letsflow/testing

Copy the cucumber configuration from the test suite and create directories from the scenario and test files.

cp node_modules/@letsflow/testing/cucumber.example.yaml ./cucumber.yaml
mkdir scenarios features

Edit package.json and add the test:workflows script.

  "scripts": {
    "test:workflows": "cucumber-js --profile workflows"
  }

Run the tests

yarn test:workflows

Gherkin

Gherkin provides a human-readable way to describe the steps and outcomes of your workflows using the Given-When-Then structure.

Example

Feature: Run the example scenario
  Background:
    Given the process is created from the "example" scenario
    And "Alice" is the "client" actor 

  Scenario: Actor completes the process
    When "Alice" does "complete"
    Then the process has ended.

Scenarios can be loaded from YAML files in the scenarios directory. The tests are loaded from the .feature files in the features directory.

Steps

The test suite provides a number of Given, When , and Then steps that allow you to set up a new process, step through it, and assert the outcome.

Given steps in gherkin are used to describe the initial context of the system. In the LetsFlow test suite, the Given steps are used to define the processes and introduce the actors.

When steps are used to describe an action. This can be a actor interacting with the system, or it can be an event triggered by another system.

Then steps are used to describe an expected outcome or result. They perform an assertion.

Use npm, yarn, or pnpm to create a new project. Install and the LetsFlow test suite.

Workflow tests are written in , a simple language for describing behavior in a readable way.

cucumber
Gherkin
Given
When
Then
GitHub - letsflow/testing: Test suite for LetsFlow workflowsGitHub
Logo