What is Gherkin?
Gherkin is a human-readable language used for writing structured tests, which can be understood by both non-technical stakeholders and automated test frameworks. It uses a Given-When-Then syntax to describe the preconditions, actions, and expected outcomes of a test scenario.Example Scenario
Primary Uses
The Serverless Workflow CTK serves two primary purposes:Conformance Testing
Verify that implementations adhere to the Serverless Workflow specification
Behavior-Driven Development
Facilitate collaborative development using Gherkin scenarios
Benefits
For Runtime Implementers
- Validation: Ensure your runtime correctly implements the specification
- Regression Testing: Catch breaking changes early in development
- Documentation: Use test scenarios as implementation examples
- Confidence: Demonstrate spec compliance to users
For SDK Developers
- Verification: Validate workflow parsing and validation logic
- Compatibility: Ensure workflows work across different runtimes
- Quality: Maintain high standards for workflow definitions
For Workflow Authors
- Understanding: Learn DSL features through concrete examples
- Validation: Test workflow definitions against expected behavior
- Portability: Ensure workflows work across compliant runtimes
Test Structure
The CTK organizes tests using the Arrange-Act-Assert pattern:Arrange
Sets up the initial conditions for the test:Act
Performs the action being tested:Assert
Verifies the expected outcome:Getting Started
To start using the CTK:1. Clone the Repository
2. Review Available Features
Explore the test features in the/ctk/features directory:
3. Implement Step Definitions
Create step definitions in your preferred language and testing framework to execute the Gherkin scenarios against your implementation.4. Run the Tests
Execute the test suite using your chosen test runner.Test Coverage
The CTK covers all major aspects of the Serverless Workflow DSL:- Task execution (HTTP, gRPC, OpenAPI, AsyncAPI)
- Data flow and transformation
- Error handling and retries
- Event processing
- Control flow (conditional, parallel, iterative)
- Timeouts and cancellation
- Subflow execution
- Extension points
Contributing
The CTK is continuously evolving. Contributions are welcome:- Add Test Scenarios: Expand coverage for edge cases
- Improve Documentation: Clarify test intent and expectations
- Report Issues: Identify gaps or ambiguities in tests
- Share Implementations: Contribute step definitions for different languages
Resources
Conformance Testing Guide
Learn how to validate your implementation
BDD Guide
Use the CTK for Behavior-Driven Development
GitHub Repository
Access the complete test suite
Community Slack
Get help on #serverless-workflow