allure-framework / allure-java

Allure integrations for Java test frameworks
Apache License 2.0
341 stars 218 forks source link

🐞: Allure step annotation causes all method parameter values are being added to the allure result json file. #1055

Closed tbarabanov closed 1 week ago

tbarabanov commented 1 week ago

What happened?

allure @Step annotation causes all method args are being added to the allure result json file

consider a case

public class DaTests {

    @Test
    public void doTest() {
        doTestStep(List.of("a", "b", "c"));
    }

    @Step("some description here")
    void doTestStep(List<String> values) {
    }

}

allure result contains all Step method args

"steps": [
    {
      "name": "some description here",
      "status": "passed",
      "stage": "finished",
      "steps": [],
      "attachments": [],
      "parameters": [
        {
          "name": "values",
          "value": "[a, b, c]"
        }
      ],
      "start": 1718895390012,
      "stop": 1718895390013
    }
  ]

I believe this should't happen. Described behaviour causes huge allure result files in our ci runner.

What Allure Integration are you using?

allure-java-commons, allure-junit5

What version of Allure Integration you are using?

2.22.3

What version of Allure Report you are using?

2.22.3

Code of Conduct

baev commented 1 week ago

You can use LifecycleListener to post-process test results and remove unnecessary data. The other option is to wrap step parameters into a POJO and override the toString() method.