Overview: I'm running integration automation tests using TestNG and Maven. Under the src/test/resources directory I have different XML suites that contain TestNG Tests. When running these tests directly from the TestNG Xml Suite file, it runs absolutely fine...no issues. I'm using IntelliJ.
I'm trying to run specified ones through the command line using the Maven Surefire Plugin and the following maven command:
mvn surefire:test
Here is a relevant sample of my pom.xml file:
<dependencies>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.9.10</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19.1</version>
<configuration>
<suiteXmlFiles>
<suiteXmlFile>src/test/resources/testsuites/SurefireTest.xml</suiteXmlFile>
</suiteXmlFiles>
</configuration>
</plugin>
</plugins>
</build>
Everything here is free from human error...the path is correct and dependencies resolve and everything. It is picking up the suite file, but seems that it cannot resolve the tests inside the xml file. Again, they work by manually running, just not with Maven Surefire...that being said, we know the paths are working right.
Here is a snippet of the Suite XML File:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://ift.tt/19x2mI9" >
<suite name="Surefire Test Suite" preserve-order="true">
<test name="Surefire Test">
<classes>
<class name="com.path.to.test.class.SurefireTest"/>
</classes>
</test>
</suite>
When we run mvn surefire:test command here is a snippet of the Maven Failure Stacktrace:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.19.1:test (default-cli) on project client-experience-ui-automation: Execution default-cli of goal org.apache.maven.plugins:maven-surefir
e-plugin:2.19.1:test failed: There was an error in the forked process
[ERROR] org.testng.TestNGException:
[ERROR] Cannot find class in classpath: com.path.to.test.class.SurefireTest
Please help??? :)
Thanks in advanced!
Aucun commentaire:
Enregistrer un commentaire