maven - mvn testng can't run test suite while Idea can -
i have testng suite looking this
<?xml version="1.0" encoding="utf-8"?> <!doctype suite system "http://testng.org/testng-1.0.dtd"> <suite name="blahserversuite"> <test name="creating customer test"> <classes> <class name="com.node.service.scripts.server.customertest" /> </classes> </test> </suite>
it runs when run ide. when trying execute console "mvn test" have following error:
[testngclassfinder] warning: can't link , determine methods of class com.node.service.scripts.server.customertest
my pom looks this:
<?xml version="1.0" encoding="utf-8"?> <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> <build> <plugins> <plugin> <groupid>org.apache.maven.plugins</groupid> <artifactid>maven-surefire-plugin</artifactid> <version>2.19.1</version> <configuration> <suitexmlfiles> <suitexmlfile>src/testnode/java/com/testnode/service/scripts/server/serversuite.xml</suitexmlfile> </suitexmlfiles> </configuration> </plugin> </plugins> </build> <groupid>groupid</groupid> <artifactid>testnode</artifactid> <version>1.0-snapshot</version> <dependencies> ....
the project consists several modules. though pom file located in modul2(as tests), still need set full path suite file in pom, otherwise mvn doesn't see test suite @ all. might case here , way should look?
it might case, you're using non-standard location test sources. might still work in ide, if implicitly added them in settings. so, try use src/test
instead, or try add src/testnode
test sources. can build-helper-maven-plugin
example. so:
<plugin> <groupid>org.codehaus.mojo</groupid> <artifactid>build-helper-maven-plugin</artifactid> <executions> <execution> <phase>generate-sources</phase> <goals> <goal>add-test-source</goal> </goals> <configuration> <sources> <source>src/testnode</source> </sources> </configuration> </execution> </executions> </plugin>
Comments
Post a Comment