Unit Test Conventions for Code Coverage

The normal convention for naming the unit test is to name it same as the class which we are going to test and append it by the word ‘Test’ to it.

For example:

Model Class:
class Abc {


}

Test Class:
Class AbcTest {


}

In the test class, if we can have a property testing class that points to the class, we are testing, it will be helpful in code coverage. AbcTest might be intended to test only the class Abc but internally it can call many other classes and their methods which may not be necessary for getting the code coverage numbers. Hence the better way to do is

Test Class:
class AbcTest {
testingClass = ‘Abc’;


}