Skip to main content

Autometa

Autometa is a toolkit of libraries to supercharge automation testing in Cucumber, built to work with Jest and in future Vitest.

Primarily Autometa is centered around it's cucumber runner, however it also maintains a number of standalone libraries that might be useful in various projects:

  • Builder Pattern - Automatically generate Builder pattern classes from a DTO class using decorators
  • Status Codes - Object containing HTTP status codes and standard text
  • Overloaded - Easily handle variadic arguments in overloaded or pattern based functions and methods

Cucumber Runner

Autometa's Cucumber Runner brings gherkin to Jest. Inspired by Jest Cucumber Autometa supports 3 styles of writing tests, which can be mix and match

  • Nested function callbacks
    • This option strongly resembles both Jests describe -> it pattern and jest-cucumbers nested structure
  • Global steps
    • This option more closely resembles cucumberjs, using globally defined steps that are assembled into scenarios at runtime
    • Global steps can be used as shared steps when using nested callbacks, so common steps are defined globally while test specific steps are defined only where they're needed
  • Gherkin Only
    • Very similar to cucumberjs, executing .feature files with globally defined steps, bypassing the need to create intermediary testfiles.

Features

Automatic inference for Step Definition arguments

Leverages Typescripts type system to automatically infer Cucumber Expression arguments from its string literal

// Given I have 5 cats
Given("I have {int} {word}", (count, animal) => {
// -- inferred as 'number' ---^ |
// ----- inferred as 'string' ------┘
});

Dependency Injection

Dependency Injection wires together your complex behaviors simply.

src/http/client.ts
import { Fixture } from "@autometa/runner";

@Fixture
export class HttpClient {
async get(...args) {}
async post(...args) {}
async put(...args) {}
async delete(...args) {}
}

Custom Cucumber Expressions

Improved support for custom Cucumber Expressions.

See Cucumber Expressions section.

Fuzzy Search for Missing Step Definitions

Easily identify typos in step definitions using fuzzy search error reporting.

Flexible

Write your tests like jest-cucumber, or by executing gherkin .feature files using Jest transformations.