The basics

Running your first workflow

Create a project

yarn create letsflow-starter

This will install the necessary libraries to run and test processes with LetsFlow.

My first scenario

The scenario describes the process we're automating. We can write a scenario in either JSON or YAML.

Create file basics.yml (or basics.json) in the scenarios directory.

A scenario has states. A new process will always start in the "initial" state. We define that if we perform the "complete" action, the process will transition to the "(done)" state.

basics.yml
states:
  initial:
    on: complete
    goto: (done)

A state with a name in parenthesis, like "(done)", is an end state. There are no transitions from an end state. End states can be used in a gotostatement without defining them explicitly.

Running a test

The scenario can be tested by writing a BDD test in the Gherkin language. Gherkin uses a set of special keywords to give structure and meaning so the test can be executed.

The LetsFlow test suite comes with a predefined set of statements that can be used to test running a scenario.

Create file basics.feature in the features directory.

basics.feature
Feature: Run a simple process that is completed in one step

  Background:
    Given the process is created from the "basics" scenario
    And "Joe" is the actor

  Scenario:
    When "Joe" does "complete"
    Then the process ended

Run the test from the command line

yarn test features/basics.feature

Congratulations!

You've successfully created and tested your first workflow.

Last updated