简体   繁体   中英

Running test from different modules using a testng suite in maven multi module project?

I want to run unit test present in different modules of my maven project from a testng suite that contains specific test classes. One method that i have tried is to make another module and add dependencies of the different modules that i require test from as a test-jar but this method requires me to add all the dependencies that the modules i have added for test dependencies.

project is structure like

Project 
|
|- Module A
   |- src
   |- suitefiles
   |- pom.xml
|- Module B
   |- src
   |- suitefiles
   |- pom.xml
|-pom.xml(Parent pom)

I have tried to add a third module like

Project 
|
|- Module A
   |- src
   |- suitefiles
   |- pom.xml
|- Module B
   |- src
   |- suitefiles
   |- pom.xml
|- Module C
   |- src
   |- suitefiles
   |- pom.xml <-(A and B as dependencies here)
|-pom.xml(Parent pom)

I want to omit making a separate module every time to run combine test from 2 modules. Is there a simpler way?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM