Recently updated from TestNG 6.9.10 to 6.11. After that, I noticed that our TestNG Invoker class has an obsolete method: "addListener".
String filePath = System.getProperty("user.dir") + "\\testng.xml";
TestListenerAdapter tla = new TestListenerAdapter();
TestNG testng = new TestNG();
File file = new File(filePath);
if (file.exists() && !file.isDirectory()) {
System.out.println("testng.xml file found at " + filePath);
List<String> suites = Lists.newArrayList();
suites.add(filePath);
testng.setTestSuites(suites);
testng.addListener(tla); <-- Deprecated
testng.run();
} else {
System.exit(0);
}
I cannot find documentation on how this should work now. TestNG has not updated the documentation on its website. Could anyone define a new method or procedure?
The assembly shows the following:
[INFO] /C:/Users/jsmith/workspace/myproj/src/main/java/mypackage/TestngInvoker.java: C:\Users\jsmith\workspace\myproj\src\main\java\mypackage\TestngInvoker.java uses or overrides a deprecated API.
[INFO] /C:/Users/jsmith/workspace/myproj/src/main/java/mypackage/TestngInvoker.java: Recompile with -Xlint:deprecation for details.
source
share