Skip to main content

externalSerenityBDDReporter

A StageCrewMember that produces Serenity BDD-standard JSON reports to be parsed by Serenity BDD CLI Reporter to produce HTML reports and living documentation.

Registering Serenity BDD Reporter programmatically

import { ArtifactArchiver, configure } from '@serenity-js/core';
import { SerenityBDDReporter } from '@serenity-js/serenity-bdd';

configure({
crew: [
ArtifactArchiver.fromJSON({
outputDirectory: './target/site/serenity'
}),
SerenityBDDReporter.fromJSON({
specDirectory: './features' // optional configuration
})
],
})

Using Serenity BDD Reporter with Playwright Test

// playwright.config.ts
import { devices } from '@playwright/test';
import type { PlaywrightTestConfig } from '@serenity-js/playwright-test';

const config: PlaywrightTestConfig = {

reporter: [
[ 'line' ],
[ 'html', { open: 'never' } ],
[ '@serenity-js/playwright-test', {
crew: [
'@serenity-js/serenity-bdd',
[ '@serenity-js/core:ArtifactArchiver', { outputDirectory: 'target/site/serenity' } ],
]
}]
],
}

Using Serenity BDD Reporter with WebdriverIO

// wdio.conf.ts
import { WebdriverIOConfig } from '@serenity-js/webdriverio';

export const config: WebdriverIOConfig = {

framework: '@serenity-js/webdriverio',

serenity: {
crew: [
'@serenity-js/serenity-bdd',
[ '@serenity-js/core:ArtifactArchiver', { outputDirectory: 'target/site/serenity' } ],
],
// other Serenity/JS config
},
// other Protractor config
}

Using Serenity BDD Reporter with Protractor

// protractor.conf.js
exports.config = {
framework: 'custom',
frameworkPath: require.resolve('@serenity-js/protractor/adapter'),

serenity: {
crew: [
'@serenity-js/serenity-bdd',
[ '@serenity-js/core:ArtifactArchiver', { outputDirectory: 'target/site/serenity' } ],
],
// other Serenity/JS config
},

// other Protractor config
}

Configuring Serenity BDD Reporter

To override Serenity BDD Reporter default configuration, provide a SerenityBDDReporterConfig as the second element of the SerenityBDDReporterConfig array using your test runner-specific configuration mechanism.

For example, to change the default location of the requirements hierarchy root directory, specify the specDirectory property:

    crew: [
[ '@serenity-js/serenity-bdd', { specDirectory: './features' } ],
// ...
],

Learn more:

Implements

Index

Constructors

externalconstructor

Methods

staticexternalfromJSON

externalassignedTo

  • @inheritDoc

    Parameters

    Returns StageCrewMember

externalnotifyOf

  • @inheritDoc

    Parameters

    Returns void