webdriverio/webdriverio

[馃悰 Bug]: wdio/allure marks tests as "broken" when tests really failed - webdriverio - typescript - allure

Open

#14628 opened on Jul 9, 2025

View on GitHub
聽(12 comments)聽(0 reactions)聽(0 assignees)JavaScript聽(6,029 stars)聽(1,793 forks)batch import
Bug 馃悰help wanted

Description

Have you read the Contributing Guidelines on issues?

WebdriverIO Version

latest

Node.js Version

latest

Mode

WDIO Testrunner

Which capabilities are you using?

OS: Windows 11
Browser: Chrome
Version: 10.0.22631
wdio/allure version: "@wdio/allure-reporter": "^9.12.6",
"allure-commandline": "^2.29.0",
"allure-js-commons": "^3.1.0",

What happened?

Describe the bug When a test fails, Allure incorrectly marks it as "broken" instead of "failed", even though the failure is clearly defined and expected (e.g., using expect.fail(...)). This misclassification affects the reliability of test reports by misrepresenting test outcomes.

We have implemented a custom function (reportFail) using allure-js-commons to report test failures, attach relevant logs and screenshots, and optionally close the test with an error. Even though the test step appears as "FAILED", the entire test ends up being reported as "BROKEN", which is misleading.

Additionally, we have another function (reportWarning) intended to mark a test as "broken" when a warning occurs. However, we have no reliable way to mark the whole test as "BROKEN" via this method either, since the status appears only at the step level.

To Reproduce Steps to reproduce the behavior:

Create a test using WebdriverIO and TypeScript. In the test, call the custom reportFail function as shown below: export async function reportFail(step: number, title: string, description: string, reportFailCloseTest: boolean = false): Promise { log.error(Step ${step} - Error - ${title}: ${description}); addAttachment(Step ${step} - Error - ${title}, : ${description}, "text/plain"); await captureAndAttachScreenshot(); addStep(Step ${step} - Error - ${title}: ${description}, {}, Status.FAILED); if (reportFailCloseTest) { expect.fail(${title}: ${description}); } } Run the test and observe the Allure report:

The step is correctly marked as FAILED. But the test itself is marked as BROKEN, which is incorrect. For warnings, we use another function like this:

export async function reportWarning(step: number, title: string, description: string): Promise { log.warn(Step ${step} - Warning: ${description} - ${title}); addAttachment(${step} - Step Warning, : ${description} - ${title}, "text/plain"); await captureAndAttachScreenshot(); addStep(Step ${step} - Warning: ${title}: ${description}, {}, Status.BROKEN); } However, this also does not set the entire test as broken, only the step.

Expected behavior

If a test fails due to a call to expect.fail(...), it should be reported in Allure as FAILED, not BROKEN. If a test has a known, non-critical issue (e.g., a warning), we want to explicitly mark the test as BROKEN via the reportWarning function. We need the ability to manually control the final test status (FAILED, BROKEN, PASSED) via our test logic.

Additional context We are using WebdriverIO, TypeScript, and allure-js-commons. We've created custom utilities to standardize test step reporting for errors and warnings, with screenshot attachments and clear status handling.

We consider it a bug that:

Tests that fail explicitly are reported as BROKEN instead of FAILED. There鈥檚 no clean way to programmatically control or override the final test status (FAILED/BROKEN/PASSED) via the Allure API/Documentation/WebdriverIO/Allure. This issue affects the accuracy of our test reporting and makes it harder to automate quality thresholds based on true test failure states.

What is your expected behavior?

Expected behavior: Webdriverio with allure should add a custom commands to mark the test as "failed", "broken", "passed".

How to reproduce the bug.

Use this function to report an error: export async function reportFail(step: number, title: string, description: string, reportFailCloseTest: boolean = false): Promise { log.error(Step ${step} - Error - ${title}: ${description}); addAttachment(Step ${step} - Error - ${title}, : ${description}, "text/plain"); await captureAndAttachScreenshot(); addStep(Step ${step} - Error - ${title}: ${description}, {}, Status.FAILED); if (reportFailCloseTest) { expect.fail(${title}: ${description}); } } 2. Fail the test. 3. Check the behavior: report as broken, not as failed.

Relevant log output

No output problems.

Code of Conduct

  • I agree to follow this project's Code of Conduct

Is there an existing issue for this?

  • I have searched the existing issues

Contributor guide