eclipse - Getting java.lang.reflect.InvocationTargetException; nested exception is java.lang.reflect.InvocationTargetException: null -
maven not able identify testng.xml
file. getting exception follows:
caused by: org.apache.maven.surefire.testset.testsetfailedexception:
suite file
d:\selenium-workspace\web-automation\src\main\resources\regressionsuite.xml
not valid file
pom.xml
<project xmlns="http://maven.apache.org/pom/4.0.0" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://maven.apache.org/pom/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelversion>4.0.0</modelversion> <groupid>com.mycompany.automation</groupid> <artifactid>web-automation</artifactid> <version>0.0.1-snapshot</version> <name>mycompany.web.automation project</name> <description>mycompany.web.automation project</description> <dependencies> <dependency> <groupid>org.apache.maven.plugins</groupid> <artifactid>maven-resources-plugin</artifactid> <version>2.6</version> </dependency> <!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java --> <dependency> <groupid>org.seleniumhq.selenium</groupid> <artifactid>selenium-java</artifactid> <version>2.53.0</version> </dependency> <!-- https://mvnrepository.com/artifact/org.testng/testng --> <dependency> <groupid>org.testng</groupid> <artifactid>testng</artifactid> <version>6.9.10</version> </dependency> </dependencies> <properties> <suitexmlfile>src/main/resources/regressionsuite.xml</suitexmlfile> <skiptests>false</skiptests> </properties> <build> <plugins> <plugin> <groupid>org.apache.maven.plugins</groupid> <artifactid>maven-surefire-plugin</artifactid> <version>2.12.4</version> <configuration> <suitexmlfiles> <suitexmlfile>${suitexmlfile}</suitexmlfile> </suitexmlfiles> </configuration> </plugin> </plugins> </build> </project>
regression.xml
<?xml version="1.0" encoding="utf-8"?> <!doctype suite system "http://testng.org/testng-1.0.dtd"> <suite name="suite" parallel="false"> <test name="test"> <parameter name="username" value="user@example.com"></parameter> <parameter name="password" value="password123"></parameter> <classes> <class name="com.test1.test.testclassone"/> </classes> </test> <!-- test --> </suite> <!-- suite -->
output
t e s t s
org.apache.maven.surefire.util.surefirereflectionexception: java.lang.reflect.invocationtargetexception; nested exception java.lang.reflect.invocationtargetexception: null java.lang.reflect.invocationtargetexception @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:62) @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43) @ java.lang.reflect.method.invoke(method.java:498) @ org.apache.maven.surefire.util.reflectionutils.invokemethodwitharray(reflectionutils.java:189) @ org.apache.maven.surefire.booter.providerfactory$providerproxy.invoke(providerfactory.java:165) @ org.apache.maven.surefire.booter.providerfactory.invokeprovider(providerfactory.java:85) @ org.apache.maven.surefire.booter.forkedbooter.runsuitesinprocess(forkedbooter.java:115) @ org.apache.maven.surefire.booter.forkedbooter.main(forkedbooter.java:75) caused by: org.apache.maven.surefire.testset.testsetfailedexception: suite file d:\selenium-workspace\web-automation\src\main\resources\regressionsuite.xml not valid file @ org.apache.maven.surefire.testng.testngxmltestsuite.locatetestsets(testngxmltestsuite.java:124) @ org.apache.maven.surefire.testng.testngprovider.invoke(testngprovider.java:89) ... 9 more
results :
tests run: 0, failures: 0, errors: 0, skipped: 0
Comments
Post a Comment