Details
-
Bug
-
Resolution: Fixed
-
Medium
-
4.0.2
-
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.