0

I have project in java and i am using Allure for generating a test report. I found this question and I need to rename my test using the below code:

AllureLifecycle lifecycle = Allure.getLifecycle();
//change test name to "CHANGED_NAME"
lifecycle.updateTestCase(testResult -> testResult.setName("CHANGED_NAME"));

I have imported the AllureLifecycle from below:

import io.qameta.allure.AllureLifecycle;

and using the below dependency:

<dependency>
  <groupId>io.qameta.allure</groupId>
  <artifactId>allure-java-commons</artifactId>
  <version>2.13.3</version>
</dependency>

But, in the line Allure.getLifecycle() it is complaining with Cannot resolve method 'getLifecycle' in 'Allure'.

How can fix the error?

Jeff
  • 7,767
  • 28
  • 85
  • 138
  • 1
    Did you also `import io.qameta.allure.Allure;` ? – Alex Shesterov Nov 04 '20 at 07:42
  • @AlexShesterov it fixes my problem. Thanks. But actually `lifecycle.updateTestCase(testResult -> testResult.setName("CHANGED_NAME"));` does not rename my test. Do you have an answer for this question: https://stackoverflow.com/questions/56550444/allure-testng-custom-test-method-names-while-using-dataprovider – Jeff Nov 04 '20 at 07:51

1 Answers1

0

You need to add import of io.qameta.allure.Allure class

Dmitry Baev
  • 2,270
  • 1
  • 14
  • 24