测试 Class 在 Eclipse 中无法识别

Test Class unrecognized in Eclipse

我有这个class,但是eclipse不把它识别为测试class,所以我不能运行把它当作Junit测试,我用的是TestNG受 JUnit 和 NUnit 启发的测试框架,但引入了一些新功能,使其更强大、更易于使用,

import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;


public class ApplicationServiceImplTest {

    @Mock
    ApplicationDao dao;

    @InjectMocks
    ApplicationMutatorServiceImpl applicationMutatorServiceImpl;

    @BeforeClass
    public void setUp(){
        MockitoAnnotations.initMocks(this);
    }

    @Test
    public void testSave() throws Exception {

        Application application = new Application();
        applicationMutatorServiceImpl.save(application);
        System.out.println (application);

    }
}

在我的 pom.xml

 <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>${junit.version}</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-all</artifactId>
            <version>${mockito.version}</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.testng</groupId>
            <artifactId>testng</artifactId>
            <version>${testng.version}</version>
            <scope>test</scope>
        </dependency>

检查你是否安装了TestNG插件。 http://singinginthesunlight.blogspot.in/2016/02/testng-for-dummies.html

否则你可以 运行 通过 Maven