lundi 3 juillet 2017

maven surefire address testng file of other dependency or provide a single point of testng entrance

Pre: I develop a testautomation framework with the main engine of testng. Whenever a subproject implementing my framework i need to define

<plugin>
     <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
         <version>2.17</version>
                <configuration>
                <suiteXmlFiles>
   <suiteXmlFile>${basedir}/src/test/resources/testng.xml</suiteXmlFile>
        </suiteXmlFiles>
    </configuration>
</plugin>

and therefore i have to put a file in the subproject this xml file with the code below to find my @TestFactory annotated class in the framework project found in the classpath

<test name="factory">
    <packages>
        <package name="mypackage.of.included.framework.testng.*" />
    </packages>
</test>

when i want testng to find my testfactory to build up the tests.

All i want is having the subproject to define the dependency without having this copy paste of the file.

So the question is: How can i easily define it in maven. Can i do it via this testng file addressed in a dependency project , or do i have to have some kind of TestNGRunner?

The testng definition finds its Class in the classpath while maven surfire seems to need the file in its own project. Is that right or how can this be done?

Aucun commentaire:

Enregistrer un commentaire