Skip to main content

Fixtures

Fixtures in Autometa are classes decorated with @Fixture. Fixtures can be defined in the App, where they will be automatically injected for each running scenario.

Fixtures can also reference each other in their constructors, which will also be injected.

Assume we have two fixtures, HttpClient, and MyApiClient, where HTTPClient handles basic HTTP calls and MyApiClient is a wrapper over HTTPClient that defines the API Services endpoints.

import { Fixture } from "@autometa/cucumber-runner";
@Fixture
export class HTTPClient {
async get(url: string, queryString: unknown) {}
async post(url: string, body: unknown) {}
async put(url: string, body: unknown) {}
async del(url: string, body: unknown) {}
}