非常感谢任何人都可以帮助解决此错误。我试图通过批处理文件运行testng.xml以获取一些自动化测试用例,但是我收到如下的FAILDED CONFIGURATION错误消息,有什么建议吗?
由于
FAILED CONFIGURATION: @BeforeClass setUp
java.lang.NoClassDefFoundError: org/apache/log4j/PropertyConfigurator
at testCases.TestBase.setUp(TestBase.java:61)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocat
ionHelper.java:85)
at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:51
0)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:211)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:138)
at org.testng.internal.TestMethodWorker.invokeBeforeClassMethods(TestMet
hodWorker.java:170)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:104)
at org.testng.TestRunner.privateRun(TestRunner.java:774)
at org.testng.TestRunner.run(TestRunner.java:624)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:359)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:354)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:312)
at org.testng.SuiteRunner.run(SuiteRunner.java:261)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1215)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1140)
at org.testng.TestNG.run(TestNG.java:1048)
at org.testng.TestNG.privateMain(TestNG.java:1355)
at org.testng.TestNG.main(TestNG.java:1324)
Caused by: java.lang.ClassNotFoundException: org.apache.log4j.PropertyConfigurat
or
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 24 more
SKIPPED CONFIGURATION: @BeforeMethod beforeMethod
SKIPPED CONFIGURATION: @AfterMethod afterMethod
SKIPPED CONFIGURATION: @AfterClass tearDown
SKIPPED CONFIGURATION: @BeforeClass setUp
SKIPPED CONFIGURATION: @BeforeMethod beforeMethod
SKIPPED CONFIGURATION: @AfterMethod afterMethod
SKIPPED CONFIGURATION: @BeforeMethod beforeMethod
SKIPPED CONFIGURATION: @AfterMethod afterMethod
SKIPPED CONFIGURATION: @AfterClass tearDown
SKIPPED: testCreateCase
SKIPPED: testGoToCaseHomePage
java.lang.Throwable: Method UI_CaseHomePage.testGoToCaseHomePage()[pri:0, instan
ce:testCases.UI_WebElements.UI_CaseHomePage@18ef96] depends on not successfully
finished methods
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1033)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWork
er.java:125)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:108)
at org.testng.TestRunner.privateRun(TestRunner.java:774)
at org.testng.TestRunner.run(TestRunner.java:624)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:359)
答案 0 :(得分:1)
log4j或其相应的版本。只需添加它就可以了。