Nagesh,
This is not an issue with TestNG, but it looks like a problem with the Maven surefire plugin code.
I tried to simulate the problem using Maven sure-fire plugin v 2.15 and realised that TestNGReporter in Maven surefire plugin is basically counting skipped methods even though they are configuration methods [ See
here ] whereas the TestNG reporters count only Test methods when reporting skipped methods [ atleast that's what I think :) ]
So if you would like to fix this, then you would need to do one of the following :
Option 1:
Send a Pull Request to the Maven surefire plugin code
Option 2 :
This is more of a hack than a solution.
Add a dependency to the Maven surefire plugin version that you are working with. For e.g., I was using surefire plugin version 2.15, so I added a dependency as below :
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-testng</artifactId>
<version>2.15</version>
</dependency>
Now resort to classpath overriding for the class org.apache.maven.surefire.testng.TestNGReporter [ i.e., create the same package in your test project and copy paste the entire
class code into it ] and alter the method
TestNGReporter.onSkipped() to something like below :
public void onTestSkipped( ITestResult result ){
ReportEntry report = new SimpleReportEntry( getSource( result ), getUserFriendlyTestName( result ) );
if (!result.getMethod().isTest()) {
return;
}
reporter.testSkipped( report );
}
This will now start making surefire plugin to count only test methods which are skipped and will not count configuration methods that were getting skipped.
That should solve the problem that you are experiencing.