@BeforeAll Method as non-static

后端 未结 2 712
谎友^
谎友^ 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:50

    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

提交回复
热议问题