Getting started

Install Restlyn, generate your first step maps and tests, and understand the starter project layout.

Welcome to Restlyn, the Gherkin-powered test generation framework for REST API and contract testing.


✨ Why Restlyn?

  • ✅ Write tests using simple Gherkin .feature files
  • ✅ Auto-generate Mocha-based test code
  • ✅ Supports schema validation, token handling, retries
  • ✅ HTML reports, with optional PDF export using Puppeteer

📦 Installation

npm install -g restlyn

You can also install locally and use npx restlyn ...


Start the local demo API

In a separate terminal, from the same project directory:

restlyn mock

For a local package installation, use npx --no-install restlyn mock instead. The included mock API listens on port 4000. If you are also previewing this Jekyll site locally on port 4000, restart Jekyll with bundle exec jekyll serve --port 4001 and browse the docs on port 4001 first. Do not stop another service without checking what owns the port.

The following example uses the mock’s synthetic login credentials user@example.com / secret. Stop the mock with Ctrl+C after testing.

🧪 Quick Example

features/login.feature

Feature: Login API

  Scenario: Valid login
    Given base URL is "http://127.0.0.1:4000"
    When I POST "/login" with:
      | email    | user@example.com |
      | password | secret         |
    Then response status should be 200
    And response body should contain key "token"

Then run:

restlyn steps --file login.feature
restlyn tests
restlyn verify --report

📂 Folder Structure

my-project/
├── features/             # Your Gherkin feature files
├── generated/
│   ├── stepmaps/         # Auto-generated .stepMap.json files
│   └── tests/            # Auto-generated test files
├── schemas/              # Optional JSON schemas for contract testing
└── .restlynrc            # Optional config file

Migrated from the Restlyn documentation, with reviewed example and configuration corrections. Original Restlyn documentation.