Search code examples
allure

Allure @Step annotation does not work


I just connected Allure report to my TestNG tests and Maven build. All works fine and reports are supercool. Just one thing - @Step annotation doesn't work. Steps are not appearing in report. I followed the examples.


Solution

  • In order to make @Step, @Parameter and @Attachment annotations work you need to correctly enable AspectJ load-time weaving. Basically this is as simple as passing path to aspectjweaver.jar as -javaagent JVM argument.

    Here’s how it can be done in Maven Surefire Plugin: https://github.com/allure-examples/allure-junit-example/blob/master/pom.xml#L63

    You must have a aspectjweaver dependency in your pom too (like in the given example), so that this library will be downloaded automatically by Maven. Otherwise the annotations still won't work. Or maybe the tests will not even start, I'm not sure...

    To run from the IDE you can specify the same option to the JVM (not the testclass) in the IDE runner window. Replacing the ${settings.localRepository} property with the real path of course. Since that's a maven property and the IDE doesn't know anything about it.