Uploaded image for project: 'Gradle'
  1. Gradle
  2. GRADLE-3189

TestNGListenerAdapterFactory equality is flawed -- makes testing unusably slow




      So I'm not fully familiar with the gradle source so a lot of this was from inspection, so take some of the details with a grain of salt. Also not a gradle expert so I may have just screwed up the basic invocation.

      But basically, I have about 700 testng unit tests and tens of thousands of classes that I want to run with gradle. I also have a TestListener that I would like to attach. So from the docs, that looks like:

      task testng(type: Test) {
      useTestNG() {
      listeners << 'testing.SingletonEnforcer'
      suites file('testng/unit/config/unit.xml')

      testClassesDir = sourceSets.testng.output.classesDir
      classpath = sourceSets.testng.runtimeClasspath
      workingDir 'testng/unit/config'

      However, if I do this and have both listeners and suites and declared above, it seems like I never get to actually running my testng tests – I let it run overnight with no luck. So I fired up JProfiler and checked out where all the time was going and [it seems to be]([1]https://www.dropbox.com/s/j25lsab01ni...) in TestNGListenerAdapterFactory. Specifically the [invoke method]([2]https://code-review.gradle.org/browse...) at the bottom of the class which is using reflection to call... something... I don't know enough about the codebase to know what it's wrapping but my best guess is that it's wrapping every class in the codebase? Or maybe my class is interacting poorly with gradle's testng and now is wrapping itself over and over again? Is there any hints someone could give as to what I could even begin doing to debug this? I'm thinking I may compile my own gradle with some more debugging information to find out what classes it's wrapping tomorrow but figured I'd post for right now and see if anyone has any ideas. Here's a picture of the linked HTML output just for ease of access: [3]

      P.S. The jprofiler was run with method sampling so I may have just been "unlucky" but 233 seconds of unlucky seems a little extreme to me
      [1] https://www.dropbox.com/s/j25lsab01nirqgv/Hot_Spots.html?dl=0
      [2] https://code-review.gradle.org/browse/Gradle/subprojects/plugins/src/main/groovy/org/gradle/api/internal/tasks/testing/testng/TestNGListenerAdapterFactory.java?hb=true#to67
      [3] https://d2r1vs3d9006ap.cloudfront.net/s3_images/1109800/Selection_005.png?1413512337




            eskatos Paul Merlin
            forums Gradle Forums
            5 Vote for this issue
            4 Start watching this issue