I have the following multi-module Maven project in Eclipse.

<http://maven.40175.n5.nabble.com/file/n5841276/MavenStructure2.png> 

A parent POM and 9 child POMs. (9 child modules)

It's a Selenium framework using Testng.
I want to run my test sets using Maven's SuiteXmlFile approach.

My SuiteXmlFiles section in the parent POM is as below.

<suiteXmlFiles>                                        
    <suiteXmlFile>testng.xml</suiteXmlFile>
</suiteXmlFiles>


The module qa-rodick-test-estimates contains all the test scripts in
src/test/java
All the other modules contains framework code (no test classes in them)

The testng.xml file I want to run sits in
qa-rodick-test-estimates/testng.xml


When I run the Maven command: *mvn clean test -X -fn*

My test set runs correctly.
However Maven looks for a testng.xml file in the root of all the other child
modules and reports errors
when they are not found. An error message like below is shown for every
child module.

org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute
goal org.apache.maven.plugins:maven-surefire-plugin:2.18.1:test
(default-test) on project qa-core-framework-v2: Execution default-test of
goal org.apache.maven.plugins:maven-surefire-plugin:2.18.1:test failed:
There was an error in the forked process
org.apache.maven.surefire.testset.TestSetFailedException: Suite file
C:\Development\Projects\Rodick\qa-rodick-automation\qa-core-framework-v2\testng.xml
is not a valid file
        at
org.apache.maven.surefire.testng.TestNGXmlTestSuite.locateTestSets(TestNGXmlTestSuite.java:116)
        at
org.apache.maven.surefire.testng.TestNGProvider.invoke(TestNGProvider.java:83)
        at
org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:203)
        at
org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:155)
        at
org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:103)
        at
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:224)
        at
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
        at
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)


Hence the use of the -fn command option to not fail the build because of
these errors.

How do I tell maven not to look for a testng.xml file in the other child
modules?




--
View this message in context: 
http://maven.40175.n5.nabble.com/Maven-looks-for-a-testng-xml-file-in-all-child-modules-tp5841276.html
Sent from the Maven - Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to