junit: no tests found

后端 未结 11 897
情书的邮戳
情书的邮戳 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 05:57

    I had the same issue, in Intellij IDEA, for Java framework. I was doing all right:

    • the class inherited from TestCase
    • I've imported junit.framework.TestCase
    • I've add the decoration @Test

    But I did one thing wrong: the name of the method didn't start with "test", in fact was:

    @Test
    public void getSomethingTest(){
    

    and when I changed it into:

    @Test
    public void testGetSomethingTest(){
    

    I've resolved: the executor was finally able to recognize this method as a test method. I've changed nothing else.

提交回复
热议问题