Allure reporter, Gradle and JUnit5

Have been playing with JUnit5, Gradle and Allure reporting framework this weekend. A rather "fresh" JUnit5 GA release, some functionality not fully supported in Gradle / IntelliJ, and latest beta from Allure. This sounds so much like me - I want to get it working!

Found lots of configuration samples on web, so won't duplicate info here - most of them are correct. Well, there are some outdated info, especially in Allure config parts, but it's not so difficult to sort out what you need.

The only thing missing in my case was what to look for in configs when your allure-results folder is always generated in PROJECT_ROOT directory instead of PROJECT_ROOT/build. If allure-results is somewhere else - fails allureReport and allureServe. So either you get that folder where it is expected by default configs, or try to reconfigure a lot more. As I'm working with beta - I'd prefer to use as much defaults as possible at the beginning. The only thing which helped - adding this to build.gradle file:

tasks.withType(JavaExec) {
    if (it.name == 'junitPlatformTest') {
        systemProperty 'allure.results.directory', 'build/allure-results'
    }
}

Using Gradle v4+, Allure v2.5.0, Allure-Junit5 v2.0-BETA21.

Now waiting for next Gradle release; according to their plans - config file should become much simpler for JUnit5.

Guess I need to investigate more this situation when I have more time and no other interesting things to do: according to source code Allure is really trying to write results to PROJECT_ROOT/build. Why that code in my case returns only PROJECT_ROOT - yet another interesting question.

Comments

Popular posts from this blog

Migrate Protractor E2E tests to async / await

Protractor, Jasmine and promises for non-browser functions