未为类型ITestNGMethod定义方法compareTo(ITestNGMethod)

我有一个现有的自动化框架,该框架是我在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

我团队中的其他人看不到此问题,但我知道。有人可以帮忙了解这里可能出什么问题以及如何解决此问题吗?

hanjunwei88122188 回答:未为类型ITestNGMethod定义方法compareTo(ITestNGMethod)

从-右键单击项目->属性->库中,以某种方式解决了该问题。

添加的库和已安装的TestNG插件之间的TestNG版本可能不匹配。

本文链接:https://www.f2er.com/2806844.html

大家都在问