如何在testng.xml中添加侦听器类?

如何在testng.xml中添加侦听器类?,testng,Testng,当我试图在testng.xml中添加listeners类时,我得到了如下所示的错误消息,如果您能给我一个线索,我将非常感激。万分感谢! 错误消息: The content of element type "suite" must match "(groups?,(listeners|packages|test|parameter|method-selectors|suite-files)*)". testng.xml 侦听器类: import java.io.IOException; 导入

当我试图在testng.xml中添加listeners类时,我得到了如下所示的错误消息,如果您能给我一个线索,我将非常感激。万分感谢! 错误消息:

The content of element type "suite" must match "(groups?,(listeners|packages|test|parameter|method-selectors|suite-files)*)".
testng.xml


侦听器类:

import java.io.IOException;
导入org.testng.ITestContext;
导入org.testng.ITestListener;
导入org.testng.ITestResult;
导入resources.DriverBase;
公共类侦听器实现ITestListener{
DriverBase db=新的DriverBase();
公共void onTestFailure(ITestResult结果){
//TODO自动生成的方法存根
试一试{
db.getScreenshot();
}捕获(IOE异常){
//TODO自动生成的捕捉块
e、 printStackTrace();
}
}
}

您的testng xml文件中有一个输入错误。您将
侦听器
as
侦听器

请换



非常感谢您!我甚至没有看到它,我猜在我复制和粘贴的时候它不知怎么搞砸了。