When trying to delete a class together with its test class, I will receive a code coverage error (0% out of 75%) for both classes, the normal as well as the test class. How to reproduce:
- Assume I have:
Then I will go ahead and follow e.g. https://help.salesforce.com/articleView?id=000328218&mode=1&type=1 using a git/jenkins/ant combination, doing following:
Setting the tag in both -meta.xml from "active" to "deleted". Save it, push both -meta.xml file changes and get it validated.
Falidation unfortunately throws as mentioned above:
Code coverage issue, class: NiceCustomClass -- Test coverage of selected Apex Class is 0%, at least 75% test coverage is required
Code coverage issue, class: NiceCustomClassTest -- Test coverage of selected Apex Class is 0%, at least 75% test coverage is required
Is there any sequence we need to follow when deleting the class and test class combination? I would not assume because if first normal class is deleted, test class will fail as it will not find methods used in test class.
Other way round it would fail because of course there would be a 0% test coverage of course.
Also I wonder why it tries to cover code for test class itself as well.
EDIT ADD: I run the validation of those changes against a Sandbox first.