I was able to implement a non-static setup method with @BeforeAll
annotation.
It seems to be working correctly as only gets call once.
I am bit confuse as the doc
You simply need to annotate your test class (that contains the @BeforeAll
method) with the snippet below and you'll be good to go.
@TestInstance(Lifecycle.PER_CLASS)
If you want use non-static @BeforeAll
and @AfterAll
methods you should change test instance lifecycle to per_class
.
Look there: 2.10. Test Instance Lifecycle