Uploaded image for project: 'Clover'
  1. Clover
  2. CLOV-1603

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

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Medium
    • 4.0.3
    • 4.0.2
    • Test Optimization
    • None
    • Clover 4.0.2
      Ant 1.8
      Java 1.8
      TestNG 6.8.7

    Description

      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.

      Attachments

        Activity

          People

            mparfianowicz Marek Parfianowicz
            0f30c17ea152 Mitchell Archibald
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: