简体   繁体   中英

XML won't load class TestNG Java

Getting below error when trying to run my xml. Looks like its having trouble loading the class but I have the correct class path.

org.testng.TestNGException: java.lang.NullPointerException at org.testng.TestNG.initializeSuitesAndJarFile(TestNG.java:340) at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:109)

Caused by: java.lang.NullPointerException at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:307) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) at org.testng.internal.ClassHelper.forName(ClassHelper.java:96)

The class path for the class I want to run is src/test/java/com/homepage/company/AboutUsTest.java and my xml looks as follows:

<?xml version="1.0" encoding="UTF-8"?>

<suite name = "AboutUs-Test" verbose = "1" parallel = "false">

<test name = "AboutUs" preserve-order="true">
<groups></groups>

<classes>
<class> name = "com.homepage.company.AboutUsTest"</class>
</classes>

</test>
</suite>

Any suggestions?

我认为应该是这样的:

<class name = "com.homepage.company.AboutUsTest"/>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM