Lan Aaroon Jabasundar
Lan Aaroon Jabasundar

Reputation: 11

Allure Test Report - Steps showing the display name as ClassName.HooksMethodName()

I have cucumber framework with Cucumber hooks setup for Test Steps but the Test method name is displayed on the Ui instead of the step nameReport Snipet

    @AfterStep
    public static void afterStep() {
        Allure.getLifecycle().startStep("custom-id", new StepResult().setName("API Details"));
        logApiDetails();
        Allure.getLifecycle().stopStep("custom-id");
    }

Expecting only the Step name to be shown rather than the HookClassName and Method Name

Upvotes: 1

Views: 83

Answers (1)

Dmitry Baev
Dmitry Baev

Reputation: 2743

Cucumber JVM has not yet added support for named hooks.

However, since Allure logs @AfterStep hooks as the steps in the report, you can modify the hook names by using Allure Runtime API:

@AfterStep
public static void afterStep() {
    Allure.getLifecycle().updateStep(step -> step.setName("API Details"));
    logApiDetails();
}

Upvotes: 0

Related Questions