multipleCucumberHTMLreporter

Metadata

Everything you need to know about metadata in Multiple Cucumber HTML Reporter.

Multiple Cucumber HTML Reporter can display the browser, version, platform, and device type that each feature was executed on.

Metadata can be shown in the Features overview table and within each scenario's detail view.

Default metadata

When no metadata is provided, the reporter automatically fills in the local platform name and version, current machine username, device hostname, Node.js version, reporter version, hostname, and CPU architecture. If only partial metadata is provided (e.g., browser details only), the missing standard fields are still populated automatically.

Adding Metadata

There are three ways to add metadata to the report:

MethodBest for
Inline metadata objectAll features run in the same environment
Per-feature metadata mapFeatures run across different browsers or platforms
metadataFilePathCI/CD pipelines or dynamic environments where metadata is written at runtime

Option 1: Same metadata for all features

Pass a single metadata object to apply identical metadata to every feature in the report.

await generate({
  metadata: {
    browser: {
      name: 'chrome',
      version: '60'
    },
    device: 'Local test machine',
    platform: {
      name: 'ubuntu',
      version: '16.04'
    }
  }
});

Any values you provide take precedence over automatic defaults.

When to use this option?

Use this option only when all features were executed on the same browser, platform, or app.


If your test scenarios run in different environments, you can define metadata per feature file name. The metadata object keys must match the feature file names (without the directory path).

const metadata: Record<string, Metadata> = {
  'saucedemo.feature': {  
    browser: {
      name: 'chrome',
      version: '148',
    },
  },
  'restful-booker.feature': { 
    browser: {
      name: 'api',
      version: '',
    },
  },
};

await generate({
  // other options
  metadata,
});

Note

The highlighted keys are the actual feature file names. Each key maps to its own Metadata object.


Option 3: Metadata from a JSON file

Use metadataFilePath to load metadata from an external JSON file. This is particularly useful in CI/CD pipelines where your test runner writes metadata at runtime — for example, the browser version resolved by a Selenium Grid, or the device name assigned by a device farm.

await generate({
  jsonDir: './.run/reports/json/',
  reportPath: './.run/html-report/',
  metadataFilePath: './.run/reports/json/metadata.json',
});

The JSON file must follow either the Metadata shape (to apply to all features) or a Record<string, Metadata> shape (per-feature), exactly as you would pass them inline.

Per-feature metadata.json:

{
  "sauce-demo-login-chrome.feature": {
    "device": "Local Test Machine",
    "browser": {
      "name": "chrome",
      "version": "latest"
    }
  },
  "saucedemo-chrome.feature": {
    "device": "Local Test Machine",
    "browser": {
      "name": "chrome",
      "version": "latest"
    }
  }
}

Common metadata.json (same for all features):

{
  "browser": {
    "name": "chrome",
    "version": "136"
  },
  "platform": {
    "name": "linux",
    "version": "22.04"
  },
  "device": "GitHub Actions Runner"
}

Important

metadataFilePath takes precedence over the inline metadata option. When both are set, the file is used and the inline value is ignored.

Placing the file inside jsonDir

You can safely place the metadata JSON file inside your jsonDir. The reporter automatically excludes it from the Cucumber JSON collection pass, so it will not be treated as a test result file.


Supported Metadata Values

To ensure the correct icons are displayed in the report, use the following predefined values for the relevant fields.

browser.name

  • internet explorer
  • edge
  • chrome
  • firefox
  • safari
  • api

platform.name

  • windows
  • osx
  • linux
  • ubuntu
  • android
  • ios

Custom Metadata

If you need to display information beyond the standard browser and platform fields, you can use Custom Metadata.

Configuration (Deprecated)

Deprecated

The Array<{ name: string, value: string }> metadata type and the customMetadata property are deprecated and will be removed in the next major version.

Use Metadata or Record<string, Metadata> instead.

Set customMetadata: true in your options:

report.generate({
  customMetadata: true,
  metadata: [
    { name: "Environment v.", value: "12.3" },
    { name: "Plugin v.", value: "32.1" },
    { name: "Variable set", value: "Foo" },
  ],
});

Caution

Custom metadata overrides regular metadata completely. Avoid using more than 10 metadata variables, as it can cause layout issues.

Last updated on

On this page