虽然 运行 来自 ALM 的 LeanFT 脚本使用 TestNG 框架抛出 No SuchMethod Error 对此有任何输入吗?

While Running LeanFT Scripts from ALM using TestNG framework throwing No SuchMethod Error any inputs on this?

FAILED CONFIGURATION: @BeforeClass baseBeforeClass(org.testng.TestRunner@74fe5c40)
java.lang.NoSuchMethodError: com.hp.lft.report.ReportingProvider.getInstance()Lcom/hp/lft/report/ReportingProvider;
    at com.hp.lft.unittesting.UnitTestBase.initReporter(UnitTestBase.java:314)
    at com.hp.lft.unittesting.TestNgUnitTestBase.classSetup(TestNgUnitTestBase.java:38)
    at unittesting.UnitTestClassBase.baseBeforeClass(UnitTestClassBase.java:30)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:108)
    at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:523)
    at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:224)
    at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:146)
    at org.testng.internal.TestMethodWorker.invokeBeforeClassMethods(TestMethodWorker.java:166)
    <... internal TestNG methods ...>
    at org.testng.TestNG.main(TestNG.java:1411)


FAILED CONFIGURATION: @AfterClass baseAfterClass(org.testng.TestRunner@74fe5c40)
java.lang.NoSuchMethodError: com.hp.lft.report.ReportingProvider.getInstance()Lcom/hp/lft/report/ReportingProvider;
    at com.hp.lft.unittesting.UnitTestBase.closeReportLevels(UnitTestBase.java:176)
    at com.hp.lft.unittesting.TestNgUnitTestBase.classTearDown(TestNgUnitTestBase.java:77)
    at unittesting.UnitTestClassBase.baseAfterClass(UnitTestClassBase.java:49)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:108)
    at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:523)
    at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:224)
    at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:146)
    at org.testng.internal.TestMethodWorker.invokeAfterClassMethods(TestMethodWorker.java:212)
    <... internal TestNG methods ...>
    at org.testng.TestNG.main(TestNG.java:1411)

通过将正确的 jars 放入 CLASSPATH 解决了问题,主要问题是我使用的 jars 是旧 jar,因为它们内部没有 TestNG 注释方法。

解决方案:如果出现这种情况,请检查您的罐子是否具有这些方法,如果没有使用具有这些方法的罐子。