我在Eclipse中安装了TestNG(版本:6.14.3)(Photon - 4.8)在Mac Mojave上(10.14.2)。我确认已成功安装TestNG
之后我创建了新的Java项目并添加了TestNg ……
你需要在你的eclipse中安装testng然后你就能看到testng及其注释。
请参考以下链接进行安装: http://testng.org/doc/download.html 如果您已从给定的URL安装它,那么您需要在pom.xml中添加testng的maven依赖项以使用其方法。
您可以使用以下方法添加它:
<dependency> <groupId>org.testng</groupId> <artifactId>testng</artifactId> <version>6.14.3</version> <scope>test</scope> </dependency>
如果要在外部添加依赖项,则需要下载testng jar,然后需要在项目中添加它。 你可以从下载jar: https://mvnrepository.com/artifact/org.testng/testng