Skip to content
Allure report logoAllure Report
Main Navigation ModulesDocumentationStart

English

Español

English

Español

Appearance

Sidebar Navigation

Introduction

Install & Upgrade

Install for Windows

Install for macOS

Install for Linux

Install for Node.js

Upgrade Allure

Getting started

How to view a report

Improving readability of your test reports

Improving navigation in your test report

Features

Test steps

Attachments

Test statuses

Sorting and filtering

Defect categories

Visual analytics

Test stability analysis

History and retries

Timeline

Export to CSV

Export metrics

Guides

JUnit 5 parametrization

JUnit 5 & Selenide: screenshots and attachments

JUnit 5 & Selenium: screenshots and attachments

Setting up JUnit 5 with GitHub Actions

Pytest parameterization

Pytest & Selenium: screenshots and attachments

Pytest & Playwright: screenshots and attachments

Pytest & Playwright: videos

Playwright parameterization

How it works

Overview

Test result file

Container file

Categories file

Environment file

Executor file

History files

Integrations

Azure DevOps

Bamboo

GitHub Actions

Jenkins

JetBrains IDEs

TeamCity

Visual Studio Code

Frameworks

Behat

Getting started

Configuration

Reference

Behave

Getting started

Configuration

Reference

Codeception

Getting started

Configuration

Reference

CodeceptJS

Getting started

Configuration

Reference

Cucumber.js

Getting started

Configuration

Reference

Cucumber-JVM

Getting started

Configuration

Reference

Cucumber.rb

Getting started

Configuration

Reference

Cypress

Getting started

Configuration

Reference

Jasmine

Getting started

Configuration

Reference

JBehave

Getting started

Configuration

Reference

Jest

Getting started

Configuration

Reference

JUnit 4

Getting started

Configuration

Reference

JUnit 5

Getting started

Configuration

Reference

Mocha

Getting started

Configuration

Reference

Newman

Getting started

Configuration

Reference

NUnit

Getting started

Configuration

Reference

PHPUnit

Getting started

Configuration

Reference

Playwright

Getting started

Configuration

Reference

pytest

Getting started

Configuration

Reference

Pytest-BDD

Getting started

Configuration

Reference

Reqnroll

Getting started

Configuration

Reference

REST Assured

Getting started

Configuration

Robot Framework

Getting started

Configuration

Reference

RSpec

Getting started

Configuration

Reference

SpecFlow

Getting started

Configuration

Reference

Spock

Getting started

Configuration

Reference

TestNG

Getting started

Configuration

Reference

Vitest

Getting started

Configuration

Reference

WebdriverIO

Getting started

Configuration

Reference

xUnit.net

Getting started

Configuration

Reference

On this page

Getting started with Allure CodeceptJS ​

Allure CodeceptJS npm latest version

Generate beautiful HTML reports using Allure Report and your CodeceptJS tests.

Allure Report CodeceptJS Example

INFO

Check out the example projects at github.com/allure-examples to see Allure CodeceptJS in action.

Setting up ​

1. Prepare your project ​

  1. Make sure Node.js is installed.

    Allure CodeceptJS is tested against Node.js 18 and higher. Older versions may work, but we can't guarantee that.

  2. Open a terminal and go to the project directory. For example:

    bash
    cd /home/user/myproject
  3. Make sure Allure Report is installed. If it's not, follow the installation instructions. Note that Allure Report requires Java.

  4. Install the Allure CodeceptJS adapter.

    bash
    npm install --save-dev codeceptjs allure-codeceptjs
    bash
    yarn add --dev codeceptjs allure-codeceptjs allure-js-commons
    bash
    pnpm install --dev codeceptjs allure-codeceptjs
  5. In your codecept.conf.js file, enable the allure plugin.

    js
    exports.config = {
      tests: "tests/**.test.js",
      plugins: {
        allure: {
          enabled: true,
          require: "allure-codeceptjs",
        },
      },
    };

2. Run tests ​

Run your CodeceptJS tests the same way as your would run them usually. For example:

bash
npx codeceptjs run
bash
yarn run codeceptjs run
bash
pnpx codeceptjs run

This will save necessary data into allure-results or other directory, according to the configuration. If the directory already exists, the new files will be added to the existing ones, so that a future report will be based on them all.

3. Generate a report ​

Finally, run Allure to convert the test results into an HTML report. This will automatically open your browser to view the report.

bash
allure serve allure-results

If necessary, replace allure-results with the path to the directory specified in the configuration.

There are some options that can affect how the report is generated. Run allure --help for the full list of options.

Writing tests ​

The Allure CodeceptJS adapter extends the standard reporting features of CodeceptJS by providing additional capabilities for crafting more informative and structured tests. This section highlights key enhancements that can be utilized:

  • Metadata Annotation: Enhance test reports with descriptions, links, and other metadata.
  • Test Organization: Structure your tests into clear hierarchies for better readability and organization organize tests.
  • Step Division: Break down tests into smaller test steps for easier understanding and maintenance.
  • Parametrized Tests: Clearly describe the parameters for parametrized tests to specify different scenarios.
  • Set labels globally: Use environment variables to set metadata and other labels.
  • Attachments: Automatically capture screenshots and other files during test execution.
  • Environment Details: Include comprehensive environment information to accompany the test report.

In most cases, Allure CodeceptJS provides two different ways to use a feature: the Runtime API and the Tags API.

  • Runtime API: use Allure's functions to add certain data to the test result during its execution. This approach allows for constructing the data dynamically.

    Note that it is recommended to call the Allure's functions as close to the beginning of the test as possible. This way, the data will be added even if the test fails early.

  • Tags API: use the tag() method to assign various data to a particular scenario.

    Most of the tags require values. You can use either a colon or an equal sign to separate the value from the name, e.g., @allure.label.epic:WebInterface is identical to @allure.label.epic=WebInterface.

    When using this approach, the data is guaranteed to be added to the test result regardless of how the test itself runs.

Add Metadata ​

Allure allows you to enrich your reports with a variety of metadata. This additional information provides context and details for each test, enhancing the report's usefulness. Refer to the metadata reference section for an exhaustive list of what can be added.

js
const allure = require("allure-js-commons");

Feature("Test My Website");

Scenario("Test Authentication", async () => {
  await allure.owner("John Doe");
  await allure.severity("critical");
  await allure.tags("Web interface", "Authentication");
  // ...
});
js
Feature("Test My Website");

Scenario("Test Authentication", async () => {
  // ...
})
  .tag("@allure.label.owner:JohnDoe")
  .tag("@allure.label.severity:critical");
  .tag("Web interface")
  .tag("Authentication")

Organize tests ​

As described in Improving navigation in your test report, Allure supports multiple ways to organize tests into hierarchical structures.

To specify a test's location in the behavior-based hierarchy:

js
const allure = require("allure-js-commons");

Feature("Test My Website");

Scenario("Test Authentication", async () => {
  await allure.epic("Web interface");
  await allure.feature("Essential features");
  await allure.story("Authentication");
  // ...
});
js
Feature("Test My Website");

Scenario("Test Authentication", async () => {
  // ...
})
  .tag("@allure.label.epic:WebInterface")
  .tag("@allure.label.feature:EssentialFeatures")
  .tag("@allure.label.story:Authentication");

To specify a test's location in the suite-based hierarchy:

js
const allure = require("allure-js-commons");

Feature("Test My Website");

Scenario("Test Authentication", async () => {
  await allure.parentSuite("Tests for web interface");
  await allure.suite("Tests for essential features");
  await allure.subSuite("Tests for authentication");
  // ...
});
js
Feature("Test My Website");

Scenario("Test Authentication", async () => {
  // ...
})
  .tag("@allure.label.parentSuite:TestsForWebInterface")
  .tag("@allure.label.suite:TestsForEssentialFeatures")
  .tag("@allure.label.subSuite:TestsForAuthentication");

Divide a test into steps ​

To create steps and sub-steps, you can use the step() function, see the reference.

js
const allure = require("allure-js-commons");
const { Status } = require("allure-js-commons");

Feature("Test My Website");

Scenario("Test Authentication", async () => {
  await allure.step("Step 1", async () => {
    await allure.step("Sub-step 1", async (ctx) => {
      await ctx.parameter("foo", "1");
      // ...
    });
    await allure.step("Sub-step 2", async (ctx) => {
      await ctx.parameter("foo", "2");
      // ...
    });
  });
  await allure.logStep("Step 2", Status.SKIPPED);
});

Describe parametrized tests ​

If you use the parametrized tests pattern, call the allure.parameter() function to add the parameters to the test report, see the reference.

js
const allure = require("allure-js-commons");

Feature("Test My Website");

let accounts = new DataTable(["login", "password"]);
accounts.add(["johndoe", "qwerty"]);
accounts.add(["admin", "qwerty"]);

Data(accounts).Scenario("Test Authentication", async ({ current }) => {
  await allure.parameter("Login", current.login);
  await allure.parameter("Password", current.password);
  // ...
});

Set labels globally ​

Any labels, including custom ones, can be set via the environment variables in your operating system. Here's an example (assuming you use the npm package manager):

bash
export ALLURE_LABEL_epic=WebInterface
npx codeceptjs run
powershell
$Env:ALLURE_LABEL_epic = "WebInterface"
npx codeceptjs run

Attach screenshots and other files ​

In Allure reports, you have the ability to attach various types of files, which can greatly enhance the comprehensibility of the report. A common practice is to attach screenshots that capture the state of the user interface at specific moments during test execution.

For detailed instructions on how to implement attachments, refer to the attachments section in the Allure CodeceptJS reference.

js
const allure = require("allure-js-commons");
const { ContentType } = require("allure-js-commons");

Feature("Test My Website");

Scenario("Test Authentication", async () => {
  // ...

  await allure.attachment("Text file", "This is the file content.", ContentType.TEXT);

  await allure.attachmentPath("Screenshot", "/path/to/image.png", {
    contentType: ContentType.PNG,
    fileExtension: "png",
  });
});

Select tests via a test plan file ​

DANGER

Test plan is currently not supported by the Allure CodeceptJS adapter.

Environment information ​

For the main page of the report, you can collect various information about the environment in which the tests were executed. To do so, edit the environmentInfo object in the configuration.

For example, it is a good idea to use this to remember the OS version and Node.js version retrieved from the os and process objects. This may help the future reader investigate bugs that are reproducible only in some environments.

Allure Report Environments Widget

js
const { setCommonPlugins } = require("@codeceptjs/configure");
const os = require("node:os");

setCommonPlugins();

/** @type {CodeceptJS.MainConfig} */
exports.config = {
  tests: "tests/**/*.js",
  plugins: {
    allure: {
      enabled: true,
      require: "allure-codeceptjs",
      environmentInfo: {
        os_platform: os.platform(),
        os_release: os.release(),
        os_version: os.version(),
        node_version: process.version,
      },
    },
  },
};

Note that if your launch includes multiple CodeceptJS runs (see How it works), Allure CodeceptJS will only save the environment information from the latest run.

Pager
Previous pageReference
Next pageConfiguration
Powered by

Join our newsletter

Allure TestOps
  • Overview
  • Why choose us
  • Cloud
  • Self-hosted
  • Success Stories
Company
  • Documentation
  • Blog
  • About us
  • Contact
  • Events
© 2025 Qameta Software Inc. All rights reserved.