我已经在eclipse和一个类文件中导入了现有的自动化框架,它在类内部具有以下代码-
// ~ Inner Classes --------------------------------------------------------
/** Arranges methods by classname and method name */
private class TestSorter implements Comparator<IInvokedMethod> {
// ~ Methods
// -------------------------------------------------------------
/** Arranges methods by classname and method name */
@SuppressWarnings("unchecked")
@Override
public int compare(IInvokedMethod o1, IInvokedMethod o2) {
int r = o1.getTestMethod().getTestClass().getName().compareTo(o2.getTestMethod().getTestClass().getName());
if (r == 0) {
r = o1.getTestMethod().compareTo(o2.getTestMethod());
}
return r;
}
}
但是显示以下TestNG
相关的编译错误-The method compareTo(ITestNGMethod) is undefined for the type ITestNGMethod
我团队中的其他人看不到此问题,但我知道。有人可以帮忙了解这里可能出什么问题以及如何解决吗?
从某种程度上删除TestNG库后,解决问题的方法-右键单击项目->属性->库。
可能是添加的库和已安装的TestNG插件之间的TestNG版本不匹配的问题。