CookuRicoo Levi
CookuRicoo Levi

Reputation: 13

Adding Allure @step annotation without specific method

I would like to create Allure step for specific code line and not per method, is it possible?I know that there is an Allure class with some helper methods but I can't figure out how to create a step.

Upvotes: 1

Views: 2445

Answers (1)

Ashish Deshmukh
Ashish Deshmukh

Reputation: 448

You can do this by creating a separate class with Step method and call it everytime you want to add step info. For example:

import ru.yandex.qatools.allure.annotations.Step;

    public final class LogUtil {

        private LogUtil() {
        }

        @Step("{0}")
        public static void log(final String message){
            //intentionally empty
        }
    }

Above class contains the method for creating a step in allure. Now whenever you want to add step info in a test all you need to do is call this method like below:

LogUtil.log("Step information text");

You can find the detailed explanation here

Upvotes: 4

Related Questions