1.pom.xml文件中引入依赖testng
2.引用@Test发现无法引用,然后直接import org.testng.annotations.Test也无法显示
导致无法引用的原因:
在pom.xml文件引用testng的时候,scope标签test限制了只能在test目录下使用,删除此标签即可。 <scope>test</scope>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>7.0.0</version>
</dependency>