Why does Intellij IDEA suddenly not recognize tests in test folder anymore?

后端 未结 13 2167
深忆病人
深忆病人 2021-02-01 02:26

I\'m using JUnit since I started this project and everything works just fine. I have a couple of hundreds tests, and of course, here and there I start them all. Right click on r

13条回答
  •  梦谈多话
    2021-02-01 02:43

    In my case, we are moving from JUnit 4 to JUnit 5 and I mixed the @Test of them.

    In short:

    • if you use @RunWith() of JUnit 4, you must use @org.junit.Test to annotate test methods.
    • if you use @ExtendWith() of JUnit 5, you must use @org.junit.jupiter.api.Test instead.

    When I change the import, my class can be run as test class again.

提交回复
热议问题