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 Behat ​

Allure Behat latest version

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

Allure Report Behat Example

Setting up ​

1. Prepare your project ​

  1. Install the Allure Report command-line tool, if it is not yet installed in your operating system. Note that Allure Report requires Java, see the installation instructions.

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

    bash
    cd /home/user/myproject
  3. Add the Allure Behat repository to your project's composer.json, for example:

    json
    {
      "repositories": [
        {
          "url": "https://github.com/allure-framework/allure-behat.git",
          "type": "vcs"
        }
      ]
    }
  4. Add allure-framework/allure-behat to your project's development dependencies:

    bash
    php composer.phar require allure-framework/allure-behat:dev-master --dev
  5. In behat.yml, add the Allure extension and enable the allure formatter:

    yaml
    default:
      formatters:
        pretty: true
        allure: true
    
      extensions:
        Allure\Behat\AllureFormatterExtension: {}
  6. Change the extension's configuration options if necessary.

2. Run tests ​

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

bash
vendor/bin/behat

This will save necessary data into allure-results or other directory, according to the output_path setting. 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, convert the test results into an HTML report. This can be done by one of two commands:

  • allure generate processes the test results and saves an HTML report into the allure-report directory. To view the report, use the allure open command.

    Use this command if you need to save the report for future reference or for sharing it with colleagues.

  • allure serve creates the same report as allure generate but puts it into a temporary directory and starts a local web server configured to show this directory's contents. The command then automatically opens the main page of the report in a web browser.

    Use this command if you need to view the report for yourself and do not need to save it.

Writing tests ​

The Allure Behat adapter extends the standard reporting features of Behat 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 issue links, TMS links and severity levels.
  • Test Organization: Structure your tests based on their user-stories for better readability and organization.
  • Step Division: Break down steps into smaller sub-steps for easier understanding and maintenance.
  • Attachments: Automatically capture screenshots and other files during test execution.
  • Environment Details: Include comprehensive environment information to accompany the test report.

Specify metadata ​

Specify issue links, TMS links and severity level for your test via Gherkin tags. See the reference for more details.

gherkin
Feature: Labels

  @issue:https://issues.example.org/AUTH-123
  @tms:https://tms.example.org/TMS-456
  @severity:critical
  Scenario: Create new label for authorized user
    When I open labels page
    And I create label with title "hello"
    Then I should see label with title "hello"

Organize tests ​

Group tests based on their user stories by adding arbitrary Gherking tags.

gherkin
@UI @Labels
Feature: Labels

  Scenario: Create new label for authorized user
    When I open labels page
    And I create label with title "hello"
    Then I should see label with title "hello"

Divide a step into sub-steps ​

Split a Gherkin step into smaller sub-steps. See the reference for more details.

php
use Behat\Behat\Context\Context;
use Yandex\Allure\Adapter\Support\StepSupport;

class MyContext implements Context
{
    use StepSupport;

    /**
     * @When I go to the registration form
     */
    public function goToRegistrationForm()
    {
        $this->executeStep('Step 1', [$this, 'step1']);
        $this->executeStep('Step 2', [$this, 'step2']);
    }

    public function step1()
    {
        $this->executeStep('Step 1.1', function () {
            // ...
        });

        $this->executeStep('Step 1.2', function () {
            // ...
        });
    }

    public function step2()
    {
        $this->executeStep('Step 2.1', function () {
            // ...
        });

        $this->executeStep('Step 2.2', function () {
            // ...
        });
    }
}

Attach screenshots and other files ​

You can attach any sorts of files to your Allure report. For example, a popular way to make a report easier to understand is to attach a screenshot of the user interface at a certain point. See the reference for more details.

php
use Behat\Behat\Context\Context;
use Yandex\Allure\Adapter\Support\AttachmentSupport;

class MyContext implements Context
{
    use AttachmentSupport;

    /**
     * @When I go to the registration form
     */
    public function profileShouldBeCreated()
    {
        $this->addAttachment('/path/to/image.png', 'Screenshot', 'image/png');
    }
}

Select tests via a test plan file ​

DANGER

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

Environment information ​

For the main page of the report, you can collect various information about the environment in which the tests were executed.

For example, it is a good idea to use this to remember the OS version and PHP version. This may help the future reader investigate bugs that are reproducible only in some environments.

Allure Report Environments Widget

To provide environment information, put a file named environment.properties into the allure-results directory after running the tests. See the example in Environment file.

Note that this feature should be used for properties that do not change for all tests in the report. If you have properties that can be different for different tests, consider using Parametrized tests.

Pager
Previous pageFrameworks
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.