views:

43

answers:

1

I have a project that has two different modules each with its own set of testng tests. I have separate run config's with code coverage enabled for each. I need to run both to gather coverage statistics and was wondering if there was a way to consolidate the coverage data in to a single session.

Is it possible to create a run configuration in IntelliJ that executes the two different testng.xml's?

A: 

I don't know specifically about IDEA but TestNG allows you to include XML files:

<suite name="My suite">
  <suite-files>
   <suite-file path="./suite1-1.xml" />
   <suite-file path="./suite1-2.xml" />
  </suite-files>
</suite>

Also, you can run the main TestNG class on multiple XML files, so if you can specify such a command line in an IDEA launch configuration, this should solve your problem:

java org.testng.TestNG suite1-1.xml suite1-2.xml
Cedric Beust
I tried that but the second suite of tests never executes. Only the first (e.g. suite1-1.xml). The same occurs when I use "packages".
TERACytE
Looks like you have to specify a specific module for the testng configuration to work. Mine are in two different modules.
TERACytE
There was a bug in the Eclipse plug-in which I just fixed, can you update and try again?
Cedric Beust
You need to create a new dummy module with dependencies on both of your modules and then use the method suggested by Cedric (make sure to specify this dummy module as classpath for the TestNG Run/Debug configuration).
CrazyCoder