- Install Allure CLI
-
If you haven’t already installed the Allure CLI, you need to do so. You can install it using Node.js or manually:
-
Using Node.js:
npm install -g allure-commandline --save-dev
This installs Allure globally and adds it to your PATH.
-
Manual Installation:
- Download the Allure CLI from the official Allure website.
- Extract the downloaded file and add the
bin
folder to your system PATH.
-
-
To verify the installation, run:
allure --version
If it outputs the Allure version, the installation is successful.
-
- Verify Allure Results Directory
-
Ensure the
./allure-results
directory exists in your project. This directory is where Playwright or your test runner stores the results for Allure to generate a report. -
If the directory doesn’t exist, ensure you’re generating test results in the Allure format by configuring your test runner (e.g., Playwright).
-
- Run the Allure Command Again
- After ensuring the Allure CLI is installed and the results directory exists, run:
allure generate ./allure-results --clean
- If everything is set up correctly, this will generate the Allure report.
- After ensuring the Allure CLI is installed and the results directory exists, run:
- Serve the Allure Report
- To view the generated report, run:
allure open
- This will open the report in your default browser.
- To view the generated report, run:
-
Allure Command Not Found:
- If
allure
is still not recognized, ensure the CLI is added to your PATH environment variable. Restart your terminal or system after making changes to the PATH.
- If
-
No Results in Allure Directory:
- Ensure your test framework is configured to generate Allure results. For Playwright, add the following dependency and configuration:
In your test configuration (
npm install allure-playwright
playwright.config.js
):import { defineConfig } from '@playwright/test'; import allure from 'allure-playwright'; export default defineConfig({ reporter: [ ['line'], ['allure-playwright'], ], });
- Ensure your test framework is configured to generate Allure results. For Playwright, add the following dependency and configuration:
To add Allure CLI (or any other program) to the PATH environment variable in Windows, follow these steps:
1. Locate the Allure Installation Directory
If you installed Allure using
npm
, the path to the executable is usually something like:Look for the
allure
file in this directory.If you downloaded Allure manually:
bin
folder inside the extracted directory is what needs to be added to PATH.2. Add Allure to the PATH
Option 1: Using Environment Variables Settings
Open System Properties:
Win + S
and search for Environment Variables.Access Environment Variables:
Edit the PATH Variable:
Path
variable and select it.Add Allure Path:
allure
executable (e.g.,C:\Users\<YourUsername>\AppData\Roaming\npm
orC:\Path\To\Allure\bin
).Apply Changes:
Option 2: Using Command Prompt
Open a new Command Prompt as Administrator.
Run the following command (replace
<path_to_allure>
with the actual path):For example:
Restart the terminal for the changes to take effect.
3. Verify Allure is in PATH
allure
executable.4. Test Allure
This should resolve the issue.