Use this file to discover all available pages before exploring further.
Behavior-Driven Development (BDD) is an agile software development process that encourages collaboration among developers, testers, and business stakeholders. BDD focuses on defining the behavior of a system through examples in a shared language, which in this case is Gherkin.By using the CTK for BDD, teams can effectively collaborate on workflow development, ensuring that everyone has a shared understanding of the system’s expected behavior.
Collaborate with stakeholders to write Gherkin scenarios that describe the expected behavior:
Feature: Order Processing Workflow As an e-commerce system I want to process customer orders So that products can be shipped and customers charged Scenario: Successful order processing Given a workflow for processing orders And an order with items in stock When the workflow is executed Then the payment should be processed And the inventory should be updated And the shipping should be scheduled And the customer should receive confirmation
Execute the scenarios and validate that the system behaves as expected:
npm test# Output:# Feature: Order Processing Workflow# Scenario: Successful order processing# ✓ Given a workflow for processing orders# ✓ And an order with items in stock# ✓ When the workflow is executed# ✓ Then the payment should be processed# ✓ And the inventory should be updated# ✓ And the shipping should be scheduled# ✓ And the customer should receive confirmation
Feature: <Feature Name> As a <role> I want <feature> So that <benefit> Scenario: <Scenario Name> Given <preconditions> When <action> Then <expected outcome> And <additional outcomes>
Describe what the system should do, not how it does it:
Scenario: Handle insufficient inventory Given an order for items with insufficient stock When the workflow is executed Then the customer should be notified of unavailability And the order should be cancelled And no payment should be processed
Feature: Payment Processing Background: Given a workflow for processing payments And a valid payment gateway is configured Scenario: Successful payment Given a customer with valid credit card When the payment is processed Then the payment should succeed Scenario: Failed payment Given a customer with invalid credit card When the payment is processed Then the payment should fail And the customer should be notified
Scenario Outline: Validate order amounts Given an order with total <amount> When the workflow validates the order Then the validation should <result> Examples: | amount | result | | 0 | fail | | 10 | pass | | 1000 | pass | | -5 | fail |
Then the workflow should complete with output:"""yaml<EXPECTED_OUTPUT>"""And the workflow output should have properties 'result.status', 'result.id'And the workflow output should have a 'result.status' property with value:"""yamlsuccess"""And the workflow output should have a 'items' property containing 5 items
Feature: Error Handling with Retries As a workflow developer I want workflows to retry failed tasks So that transient errors don't cause workflow failure Scenario: Retry on HTTP timeout Given a workflow with definition: """ document: dsl: 1.0.0 namespace: examples name: retry-example version: 1.0.0 do: - callService: call: http with: method: get uri: https://api.example.com/data timeout: after: PT30S retry: when: status: timeout: true limit: attempt: count: 3 backoff: constant: duration: PT5S """ When the workflow is executed Then the workflow should complete And callService should complete Scenario: Exhaust retries and fault Given a workflow with definition: """ document: dsl: 1.0.0 namespace: examples name: retry-exhaust version: 1.0.0 do: - callService: call: http with: method: get uri: https://api.example.com/failing-endpoint retry: limit: attempt: count: 2 """ When the workflow is executed Then the workflow should fault And callService should fault