allure-framework/allure-java

Allure doesn't support step description

evpl opened this issue · 1 comments

evpl commented

I see the option to add a description to the step in many places in the Allure code:

  1. io.qameta.allure.model.StepResult class getDescription(), setDescription(String), getDescriptionHtml(), setDescriptionHtml(String) methods.
  2. io.qameta.allure.Allure class description(String) method javadoc - Adds description to current test or step (or fixture) if any. and descriptionHtml(String) method javadoc - Adds descriptionHtml to current test or step (or fixture) if any..
  3. io.qameta.allure.Description javadoc - Annotation that allows to attach a description for a test or for a step..

But using the mechanisms described above, I don't see any step descriptions in the report.

Test example:

import io.qameta.allure.Allure;
import io.qameta.allure.AllureLifecycle;
import io.qameta.allure.Description;
import io.qameta.allure.Step;
import io.qameta.allure.model.Status;
import io.qameta.allure.model.StepResult;
import org.testng.annotations.Test;

import java.util.UUID;

public class ExampleTest {

    @Test
    void test() {
        final AllureLifecycle allureLifecycle = Allure.getLifecycle();

        /* Step 1 (description via StepResult)*/
        final String step1UUID = UUID.randomUUID().toString();
        allureLifecycle.startStep(
            step1UUID,
            new StepResult().setName("Step 1").setDescription("Step 1 description") // <-----
        );
        allureLifecycle.updateStep(step1UUID, step -> step.setStatus(Status.PASSED));
        allureLifecycle.stopStep(step1UUID);

        /* Step 2 (description via Allure.description(String) method) */
        final String step2UUID = UUID.randomUUID().toString();
        allureLifecycle.startStep(step2UUID, new StepResult().setName("Step 2"));
        Allure.description("Step 2 description"); // <-----
        allureLifecycle.updateStep(step2UUID, step -> step.setStatus(Status.PASSED));
        allureLifecycle.stopStep(step2UUID);

        /* Step 3 (description via @Description annotation) */
        step3Method(); // <-----
    }

    @Step("Step 3")
    @Description("Step 3 description")
    static void step3Method() {
    }
}

Actual behavior
I don't see any step description in the report. But I see that the description of the test has been added - Step 2 description
example
And there is no info about step descriptions in allure-maven-plugin\data\test-cases\id.json

"steps" : [ {
      "name" : "Step 1",
      "time" : {
        "start" : 1657979446187,
        "stop" : 1657979446188,
        "duration" : 1
      },
      "status" : "passed",
      "steps" : [ ],
      "attachments" : [ ],
      "parameters" : [ ],
      "shouldDisplayMessage" : false,
      "attachmentsCount" : 0,
      "hasContent" : false,
      "stepsCount" : 0
    }, {
      "name" : "Step 2",
      "time" : {
        "start" : 1657979446189,
        "stop" : 1657979446189,
        "duration" : 0
      },
      "status" : "passed",
      "steps" : [ ],
      "attachments" : [ ],
      "parameters" : [ ],
      "shouldDisplayMessage" : false,
      "attachmentsCount" : 0,
      "hasContent" : false,
      "stepsCount" : 0
    }, {
      "name" : "Step 3",
      "time" : {
        "start" : 1657979446204,
        "stop" : 1657979446204,
        "duration" : 0
      },
      "status" : "passed",
      "steps" : [ ],
      "attachments" : [ ],
      "parameters" : [ ],
      "shouldDisplayMessage" : false,
      "attachmentsCount" : 0,
      "hasContent" : false,
      "stepsCount" : 0
    } ]

And json contains fields with test description

"description" : "Step 2 description",
"descriptionHtml" : "<p>Step 2 description</p>\n"

Expected behavior
All steps in the report have a corresponding descriptions. Test has no description.

Environment:

Allure version 2.18.1
Test framework testng@7.4.0
Allure adaptor allure-testng@2.18.1
Generate report using allure-maven@2.11.2
evpl commented

baev commented 6 hours ago
actually, step descriptions were never supported at all

@baev pls review #799