Update: 10th May: Salesforce have confirmed this is an issue and appears to be resolved in Summer'13.
Confirmed Platform Bug Reproduced I spent a good portion of the weekend trying to get coverage for a WSDL2Apex class myself. Eventually whittled it down to a bug in the platform. The bug currently resides around tests that only invoke methods on "inner classes".
This is the standard pattern for classes generated by WSDL2Apex of course. The bug extends to the point that not only is code coverage not captured, it excludes the whole class from being required for code coverage, which explains the package upload behaviour. I reproduced it in the following...
public class TestA
{
public TestA() { }
public class TestB
{
public Integer doSomething()
{
Integer x = 1;
Integer y = x;
return y;
}
}
}
@IsTest
private with sharing class TestATest
{
private static testmethod void testMe()
{
// Uncomment the line below to work around the lack of code coverage bug
// TestA testAObj = new TestA();
TestA.TestB testBObj = new TestA.TestB();
System.assertEquals(1, testBObj.doSomething());
}
}
Workaround is to edit your generated class and put in a constructor and then invoke this from each of your test methods. If your concerned developers will attempt to use it (not that it would be much good, you can put an Test.isTesting() assert in it). Once we see a for fix this (I've raised case 09233301), this workaround can be left in or removed.
I'll update this answer when I get a response and/or the bug listed publicly. Note we have tests that do cover WSDL2Apex classes from the past, so this to me confirms this was at one point needed and is a regression. I did ponder if it was related to just WSDL2Apex generated classes only at first, which was starting to make sense, since they are none functional and system generated, shame...
Pattern for Generating 100% Coverage on WSDL2Apex Generated Classes. This is something I plan to blog about next weekend, but if your interested in taking a look at an approach I've used (irrespective of this issue) you can take a look at this. I'll update this answer when I do.
Best Answer
If your
Wrapper class
only contains variable declaration and not any apex methods, then developer console will not show your class underOverall Code Coverage
section. And such classes without methods doesn't require code coverage.