You need to sign in to do that
Don't have an account?
Do I need tests for tests ?
Quick query - I have 80% code coverage on my apex class yet my overall coverage is 70% as it is including my test method....do I need unit tests for my test methods ?
Test classes need to be marked private.
I've seen test classes marked as less than 100% if you have non-test private methods inside the test class that do not get called by any of the test methods. For example, you created a private method to insert some data to support your tests.
All Answers
Jdog,
If you flag the test method using the 'testmethod' parameter, it should not be counted as code which needs to be covered.
Your test method declaration should look like the following:
public static void testmethod myTestMethod()
{
//add tests here
}
Try updating your method to include the 'testmethod' parameter and see if this works for you.
Hi m_Roark,
I have declared my test methods as below;
@istest
private class PanelMaintanenceExtensionTest {
static testMethod void massRemoveTest() {
// Unit Tests
}
}
I have got my total test method coverage to 80% and I can deploy to production fine however the Eclipse IDE still gives me a message
! Code Coverage Results
- (tick)PanelMaintenanceExtension (ApexClass) - 74 Lines not tested, 90% Covered
- ! PanelMaintenanceExtensionTest (ApexClass) - 55 Lines not tested, 0% Covered
Should I be concerned about this ? Am I declaring my test methods incorrectly ?
Thanks
You are declaring your class as 'private'. I believe test classes have to be declared 'public' in order to be accessible by the testing framework.
Try changing your code as below.
@istest public class PanelMaintanenceExtensionTest { public static testMethod void massRemoveTest() { // Unit Tests } }
Test classes need to be marked private.
I've seen test classes marked as less than 100% if you have non-test private methods inside the test class that do not get called by any of the test methods. For example, you created a private method to insert some data to support your tests.