Project: clover
Issue CLOV-1603: CloverOptimizedTestNGSelector does not add "clover-optimized" group to TestNG @Before and @After annotations
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: {code:xml|title=build.xml snippet} {code} 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 )|http://testng.org/javadoc/org/testng/IAnnotationTransformer2.html#transform%28org.testng.annotations.IConfigurationAnnotation,%20java.lang.Class,%20java.lang.reflect.Constructor,%20java.lang.reflect.Method%29], automatically adding the "clover-optimized" group to all non-tests.
Story points: 1