我已经从市场安装了 testNG。我正在研究使用 Selenium 和 Java 进行软件测试。我希望用这个基本代码打印出来,但它显示错误。
package TestNGAnnotation;
import org.testng.annotations.Test;
public class TestClass {
@Test
public void sampletest1() {
System.out.println("this is testNG annotation ");
}
}
以下是错误。我没有在我的脚本或库中看到错误。我有什么遗漏的吗?
[RemoteTestNG] detected TestNG version 7.10.1
Exception in thread "main" java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory
at org.testng.log4testng.Logger.lambda$getLogger$0(Logger.java:30)
at java.base/java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1708)
at org.testng.log4testng.Logger.getLogger(Logger.java:30)
at org.testng.TestNG.<clinit>(TestNG.java:111)
at org.testng.remote.support.RemoteTestNGFactory7_9.createRemoteTestNG(RemoteTestNGFactory7_9.java:16)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:67)
Caused by: java.lang.ClassNotFoundException: org.slf4j.LoggerFactory
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:526)
... 6 more