Search code examples
junit5serenity-bdd

Is Serenity compatible with Junit 5?


I have been working on a Spring boot project and started testing it using Serenity but I can't seem to use it with Junit 5.Can someone please help me? Thanks in advance.


Solution

  • Well, the day after I posted the question, there was an update that became available which makes Serenity compatible with Junit 5.Just add the following dependency:

    <dependency>
      <groupId>io.github.fabianlinz</groupId>
      <artifactId>serenity-junit5</artifactId>
      <version>1.2.1</version>
    </dependency>
    

    To run a JUnit5 test with Serenity BDD, simply add the annotation @net.serenitybdd.junit5.SerenityTest (instead of @org.junit.runner.RunWith(net.serenitybdd.junit.runners.SerenityRunner.class) for JUnit4)

    For more details refer to: https://github.com/fabianlinz/serenity-junit5