CloverOptimizedTestNGSelector does not add "clover-optimized" group to TestNG @Before and @After annotations

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: Medium
    • 4.0.3
    • Affects Version/s: 4.0.2
    • Component/s: Test Optimization
    • None
    • Environment:

      Clover 4.0.2
      Ant 1.8
      Java 1.8
      TestNG 6.8.7

      In order for Clover to optimize a TestNG test suite, we have to use the CloverOptimizedTestNGSelector listener, and restrict TestNG to only run the "clover-optimized" group, as in:

      build.xml snippet
      <testng groups="clover-optimized" listeners="com.atlassian.clover.ant.tasks.testng.CloverOptimizedTestNGSelector" >
      
          <!-- ... -->
      
      </testng>
      

      The problem with this is that TestNG's @Before and @After annotations (@BeforeMethod, @AfterClass, etc) will not be run, because they are not part of the "clover-optimized" group.

      I have a workaround, which is to qualify all such annotations with alwaysRun=true, but this is pretty ugly.

      A possible solution is for CloverOptimizedTestNGSelector to implement IAnnotationTransformer2 and override transform( IConfigurationAnnotation, Class, Constructor, Method ), automatically adding the "clover-optimized" group to all non-tests.

            Assignee:
            Marek Parfianowicz
            Reporter:
            Mitchell Archibald
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: