junit: no tests found

后端 未结 11 906
情书的邮戳
情书的邮戳 2020-12-14 05:47

I have inherited a Java project and am new to Java development. I feel a good way for me to get comfortable with the code is to write some tests around it. I\'m writing my c

11条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-14 06:07

    I was getting this error, too:

    junit.framework.AssertionFailedError: No tests found in ...

    The reason was that I forgot to specify

    defaultConfig {
        ...
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    

    After syncing the project, it found the tests. So maybe it helps someone else.

提交回复
热议问题