Java – steps in the alloure2 listener output console

I'm using allure2 and TestNG I want to write my own listener and print @ steps. In the console output

I saw the interface "steplifecycle listener" in charm, but I can't implement this listener in TestNG Do you have any pointers?

@Override
public void beforeStepStart(final StepResult result) {
    System.out.format("Starting step: %s",result.getName());

}


@Override
public void afterStepStop(final StepResult result) {
    System.out.format("Completed step: %s",result.getName());

}

Solution

Allure 2 listeners are managed by SPI mechanism Therefore, to make it work, you need to perform the following steps:

>Implement the steplifecyclelistener interface and override the required methods. > Create the meta inf / services folder in the resource root directory of the project. > In the above folder, create a new file according to the full name of this interface. > Add the full path of the implementation class to this file

You can find examples in the following items: https://github.com/sskorol/allure2-testng-report/blob/master/src/test/resources/META-INF/services/io.qameta.allure.listener.StepLifecycleListener

For SPI: http://docs.oracle.com/javase/tutorial/sound/SPI-intro.html More information about

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>