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

Allure Codeception reference ​

These are the attributes and methods that you can use to integrate your Codeception tests with Allure Report.

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

  • Attributes API: add a PHP attribute to a test method or a whole class to add certain data to the test result. When using this approach, the data is guaranteed to be added regardless of how the test itself runs.

  • 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.

Metadata ​

Assign a test's description, links and other metadata.

Title ​

  • #[DisplayName(string $value)]
  • Allure::displayName(string $name)

Set the test's title.

php
use Codeception\Test\Unit;
use Qameta\Allure\Attribute\DisplayName;

class TestMyWebsite extends Unit
{
    #[DisplayName('Test Labels')]
    public function testLabels()
    {
        // ...
    }
}
php
use Codeception\Test\Unit;
use Qameta\Allure\Allure;

class TestMyWebsite extends Unit
{
    public function testLabels()
    {
        Allure::displayName('Test Labels');
        // ...
    }
}

Description ​

  • #[Description(string $value)]
  • Allure::description(string $description)

Set the test's description. Markdown formatting is allowed. Any HTML formatting, if present, will be stripped for security purposes.

php
use Codeception\Test\Unit;
use Qameta\Allure\Attribute\Description;

class TestMyWebsite extends Unit
{
    #[Description('This test attempts to create a label with specified title.')]
    public function testLabels()
    {
        // ...
    }
}
php
use Codeception\Test\Unit;
use Qameta\Allure\Allure;

class TestMyWebsite extends Unit
{
    public function testLabels()
    {
        Allure::description('This test attempts to log into the website using a login and a password.');
        // ...
    }
}

Owner ​

  • #[Owner(string $value)]
  • Allure::owner(string $value)

Set the test's owner.

php
use Codeception\Test\Unit;
use Qameta\Allure\Attribute\Owner;

class TestMyWebsite extends Unit
{
    #[Owner('John Doe')]
    public function testLabels()
    {
        // ...
    }
}
php
use Codeception\Test\Unit;
use Qameta\Allure\Allure;

class TestMyWebsite extends Unit
{
    public function testLabels()
    {
        Allure::owner('John Doe');
        // ...
    }
}

Tag ​

  • #[Tag(string $value)]
  • Allure::tag(string $value)

Set the test's tags.

php
use Codeception\Test\Unit;
use Qameta\Allure\Attribute\Tag;

class TestMyWebsite extends Unit
{
    #[Tag('UI'), Tag('Labels')]
    public function testLabels()
    {
        // ...
    }
}
php
use Codeception\Test\Unit;
use Qameta\Allure\Allure;

class TestMyWebsite extends Unit
{
    public function testLabels()
    {
        Allure::tag('UI');
        Allure::tag('Labels');
        // ...
    }
}

Severity ​

  • #[Severity(string $value)]
  • Allure::severity(Severity $value)

Set the test's severity.

For the Attributes API, use the constants from the Severity class. For the Runtime API, use the static methods on the Severity class to construct the values.

php
use Codeception\Test\Unit;
use Qameta\Allure\Attribute\Severity;

class TestMyWebsite extends Unit
{
    #[Severity(Severity::CRITICAL)]
    public function testLabels()
    {
        // ...
    }
}
php
use Codeception\Test\Unit;
use Qameta\Allure\Allure;
use Qameta\Allure\Model\Severity;

class TestMyWebsite extends Unit
{
    public function testLabels()
    {
        Allure::severity(Severity::critical());
        // ...
    }
}

Label ​

  • #[Label(string $name, ?string $value = null)]
  • Allure::label(string $name, string $value)

Set an arbitrary label for the test. This is the underlying implementation for a lot of Allure's other APIs.

You may also extend the Attributes API by defining your own attribute that will work as a #[Label] with a predefined $name.

php
use Codeception\Test\Unit;
use Qameta\Allure\Attribute\Label;

class TestMyWebsite extends Unit
{
    #[Label('MyCustomLabel', 'value')]
    public function testLabels()
    {
        // ...
    }
}
php
use Attribute;
use Codeception\Test\Unit;
use Qameta\Allure\Attribute\AbstractLabel;

#[Attribute(Attribute::TARGET_CLASS | Attribute::TARGET_METHOD | Attribute::IS_REPEATABLE)]
final class MyCustomLabel extends AbstractLabel
{
    public function __construct(string $value)
    {
        parent::__construct('MyCustomLabel', $value);
    }
}

class TestMyWebsite extends Unit
{
    #[MyCustomLabel('value')]
    public function testLabels()
    {
        // ...
    }
}
php
use Codeception\Test\Unit;
use Qameta\Allure\Allure;

class TestMyWebsite extends Unit
{
    public function testLabels()
    {
        Allure::label('MyCustomLabel', 'value');
        // ...
    }
}

ID ​

  • #[AllureId(string $value)]

Set the test's ID.

php
use Codeception\Test\Unit;
use Qameta\Allure\Attribute\AllureId;

class TestMyWebsite extends Unit
{
    #[AllureId('123')]
    public function testLabels()
    {
        // ...
    }
}

Link ​

  • #[Link(?string $name = null, ?string $url = null, string $type = Link::CUSTOM)]
  • #[Issue(?string $name = null, ?string $url = null)]
  • #[TmsLink(?string $name = null, ?string $url = null)]
  • Allure::link(string $url, ?string $name = null, ?LinkType $type = null)
  • Allure::issue(string $name, ?string $url = null)
  • Allure::tms(string $name, ?string $url = null)

Add a link related to the test.

Based on the type, Allure will try to load a corresponding link pattern to process the URL, as defined by the linkTemplates configuration option. If no pattern found for the given type, the URL is left unmodified.

When using the Runtime API, the type must be a value from the LinkType enumeration. When using the Attributes API, the type can be any string. Both APIs provide shorthands for the “issue” and “tms” link types.

The name will be used as the link's text. If it is omitted, the unprocessed URL will be used instead.

php
use Codeception\Test\Unit;
use Qameta\Allure\Attribute\Issue;
use Qameta\Allure\Attribute\Link;
use Qameta\Allure\Attribute\TmsLink;

class TestMyWebsite extends Unit
{
    #[Link('My Website', 'https://example.com/')]
    #[Issue('UI-123')]
    #[TmsLink('TMS-456')]
    public function testLabels()
    {
        // ...
    }
}
php
use Codeception\Test\Unit;
use Qameta\Allure\Allure;

class TestMyWebsite extends Unit
{
    public function testLabels()
    {
        Allure::link('https://example.com/', 'My Website');
        Allure::issue('UI-123');
        Allure::tms('TMS-456');
        // ...
    }
}

Behavior-based hierarchy ​

  • #[Epic(string $value)]
  • #[Feature(string $value)]
  • #[Story(string $value)]
  • Allure::epic(string $value)
  • Allure::feature(string $value)
  • Allure::story(string $value)

Assign names of epics, features or user stories for a test, as part of Allure's behavior-based hierarchy.

php
use Codeception\Test\Unit;
use Qameta\Allure\Attribute\Epic;
use Qameta\Allure\Attribute\Feature;
use Qameta\Allure\Attribute\Story;

class TestMyWebsite extends Unit
{
    #[Epic('Web interface')]
    #[Feature('Essential features')]
    #[Story('Labels')]
    public function testLabels()
    {
        // ...
    }
}
php
use Codeception\Test\Unit;
use Qameta\Allure\Allure;

class TestMyWebsite extends Unit
{
    public function testLabels()
    {
        Allure::epic('Web interface');
        Allure::feature('Essential features');
        Allure::story('Labels');
        // ...
    }
}

Suite-based hierarchy ​

  • #[ParentSuite(string $value)]
  • #[Suite(string $value)]
  • #[SubSuite(string $value)]
  • Allure::parentSuite(string $value)
  • Allure::suite(string $value)
  • Allure::subSuite(string $value)

Assign the name of the suite, as part of Allure's suite-based hierarchy.

php
use Codeception\Test\Unit;
use Qameta\Allure\Attribute\ParentSuite;
use Qameta\Allure\Attribute\SubSuite;
use Qameta\Allure\Attribute\Suite;

class TestMyWebsite extends Unit
{
    #[ParentSuite('Web interface')]
    #[Suite('Essential features')]
    #[SubSuite('Labels')]
    public function testLabels()
    {
        // ...
    }
}
php
use Codeception\Test\Unit;
use Qameta\Allure\Allure;

class TestMyWebsite extends Unit
{
    public function testLabels()
    {
        Allure::parentSuite('Web interface');
        Allure::suite('Essential features');
        Allure::subSuite('Labels');
        // ...
    }
}

Test steps ​

  • Allure::runStep(callable $callable, ?string $name = null)
  • Allure::addStep(string $name, ?Status $status = null)

Define test steps.

There are three ways of defining a step.

  • Method-based steps

    Write a test step in a public method and pass it to runStep() using the array syntax (i.e., [$obj, 'method']). The method should either accept no arguments or accept one argument of the type StepContextInterface. During the execution of a step, you can call runStep() again to create a sub-step.

    To change a step's title (defaults to just the word “step”), you can:

    • add the #[DisplayName] attribute to the method,
    • pass the optional name argument to runStep(),
    • use the name() method on the StepContextInterface object.
  • Lambda steps

    Write a test step in a lambda function and pass it to runStep(). If the lambda function returns a value, runStep() will return it without modification, and it will not affect the report. During the execution of a step, you can call runStep() again to create a sub-step.

    To change a step's title (defaults to just the word “step”), you can:

    • add the #[DisplayName] attribute to the lambda function,
    • pass the optional name argument to runStep(),
    • use the name() method on the StepContextInterface object.
  • No-op steps

    If you call addStep(), Allure will add to the report a no-op step. This allows for a log-style reporting within a test or within a larger step. A no-op step finishes immediately after it started and cannot have any sub-steps, or parameters.

    The optional second argument indicates the status that will be shown for the step in the report. Allowed values are: Status::passed() (the default), Status::failed(), Status::broken(), and Status::skipped().

During the execution of a method-based step or a lambda step, it is possible to describe the data the step works with, e.g., if you run it multiple times with different data. To do so, use the parameter() method of the StepContextInterface object.

php
use Codeception\Test\Unit;
use Qameta\Allure\Allure;
use Qameta\Allure\Attribute\DisplayName;
use Qameta\Allure\StepContextInterface;

class TestMyWebsite extends Unit
{
    public function testLabels()
    {
        Allure::runStep([$this, 'logIn']);
        Allure::runStep([$this, 'createLabel']);
        Allure::runStep([$this, 'checkThatLabelExists']);
    }

    #[DisplayName('Log in')]
    function logIn(StepContextInterface $context)
    {
        $context->parameter('Email', '[email protected]');
        $context->parameter('Password', 'qwerty');
        // ...
    }

    #[DisplayName('Create label')]
    function createLabel(StepContextInterface $context)
    {
        $context->parameter('Label name', 'My Label');
        // ...
    }

    #[DisplayName('Check that label exists')]
    function checkThatLabelExists(StepContextInterface $context)
    {
        $context->parameter('Label name', 'My Label');
        // ...
    }
}
php
use Codeception\Test\Unit;
use Qameta\Allure\Allure;
use Qameta\Allure\StepContextInterface;

class TestMyWebsite extends Unit
{
    public function testLabels()
    {
        Allure::runStep(function (StepContextInterface $context) {
            $context->parameter('Email', '[email protected]');
            $context->parameter('Password', 'qwerty');
            // ...
        }, 'Log in');

        Allure::runStep(function (StepContextInterface $context) {
            $context->parameter('Label name', 'My Label');
            // ...
        }, 'Create label');

        Allure::runStep(function (StepContextInterface $context) {
            $context->parameter('Label name', 'My Label');
            // ...
        }, 'Check that label exists');
    }
}
php
use Codeception\Test\Unit;
use Qameta\Allure\Allure;

class TestMyWebsite extends Unit
{
    public function testLabels()
    {
        // ...
        Allure::addStep('Log in');

        // ...
        Allure::addStep('Create label');

        // ...
        Allure::addStep('Check that label exists');
    }
}

Parametrized tests ​

  • Allure::parameter(string $name, ?string $value, bool $excluded = false, ?ParameterMode $mode = null)

Specify a name and value of a parameter that was used during this test. See Parametrized tests for more details.

Note that Allure Codeception does not automatically extract the parameters from the Codeception's DataProvider. In a test function that uses a data provider, pass the names and values to Allure::parameter() manually, as shown in the example below.

If the excluded argument is set to true, Allure will not use the parameter when comparing the current test result with previous one in the history.

The mode argument affects how the parameter will be displayed in the report. Available options are:

  • null — the parameter and its value will be shown in a table along with other parameters.
  • ParameterMode::masked() — the parameter will be shown in the table, but its value will be hidden. Use this mode for passwords, tokens and other sensitive parameters.
  • ParameterMode::hidden() — the parameter and its value will not be shown in the test report. Note, however, that it is still possible to extract the value from the allure_results directory if you publish it.

The parameters can be added not only to whole test results, but also to individual steps within them, see Test steps for more details.

php
use Codeception\Test\Unit;
use Qameta\Allure\Allure;

class TestMyWebsite extends Unit
{
    public function testAuthenticationWithUsername()
    {
        Allure::parameter('login', 'johndoe');
        Allure::parameter('password', 'qwerty');
        // ...
    }

    public function testAuthenticationWithEmail()
    {
        Allure::parameter('login', '[email protected]');
        Allure::parameter('password', 'qwerty');
        // ...
    }
}
php
use Codeception\Attribute\DataProvider;
use Codeception\Test\Unit;
use Qameta\Allure\Allure;

class ParametersProviderTest extends Unit
{
    protected function dataProvider()
    {
        return [
            ['login' => 'johndoe', 'password' => 'qwerty'],
            ['login' => '[email protected]', 'password' => 'qwerty'],
        ];
    }

    #[DataProvider('dataProvider')]
    public function testAuthenticationWithData($login, $password)
    {
        Allure::parameter('Login', $login);
        Allure::parameter('Password', $password);
        // ...
    }
}

Attachments ​

  • Allure::attachment(string $name, string $content, ?string $type = null, ?string $fileExtension = null)
  • Allure::attachmentFile(string $name, string $file, ?string $type = null, ?string $fileExtension = null)

Add an attachment to the test result under the given name.

TIP

You can use data produced by any function, not necessarily read from an actual file.

To create an attachment using the Runtime API, call Allure::attachment() or Allure::attachmentFile() at any point during your test. Pass either the content or the path from which the data will be read.

To ensure that the reader's web browser will display attachments correctly, it is recommended to specify each attachment's type. To do so, pass the media type of the content as type and, optionally, a filename extension as fileExtension. The media type affects how the data will be displayed in the test report, while the filename extension is appended to the filename when user wants to save the file.

php
use Codeception\Test\Unit;
use Qameta\Allure\Allure;

class TestMyWebsite extends Unit
{
    public function testLabels()
    {
        // ...
        Allure::attachment('data.txt', 'This is the file content.', 'text/plain');
        Allure::attachmentFile('data.txt', '/path/to/image.png', 'image/png');
    }
}
Pager
Previous pageConfiguration
Next pageGetting started
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.