@BeforeAll Method as non-static

后端 未结 2 704
谎友^
谎友^ 2021-02-13 15:31

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

2条回答
  •  清歌不尽
    2021-02-13 15:41

    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)
    

提交回复
热议问题