1

I started researching testing and I had this question. The list contains all the classes that I managed to create during the training. Can only the necessary ones be left here and how to do it?

enter image description here

3
  • 1
    The obvious: delete the unused classes.
    – Phil W
    Commented Mar 18, 2021 at 13:27
  • Remove from organization? I need them! Commented Mar 18, 2021 at 13:55
  • 1
    Then add unit tests that provide coverage.
    – Phil W
    Commented Mar 18, 2021 at 14:09

1 Answer 1

1

In Salesforce you can't achieve this as of now. In the list of 'Overall Code Coverage' it shows all the Apex classes available excluding your test classes. Normally you are writing a test class for particular Apex class simply because to test your own code.

https://developer.salesforce.com/forums/?id=9060G000000XfhgQAC

From the test class you are running, there could be situations which covers other classes in your organization as well. It is simply because of the test data you are specifying in your org. That is why it is showing two classes in your case as 100%. Overall coverage is something which is showing the total line coverage from that test class against entire number of apex class code lines in your org .

So in the list of 'Overall Code Coverage', you can not remove the classes you don't want. But if you know the exact class you want to get the coverage you can see the test coverage as a percentage in this list. If you double click on the class name inside this list, that Apex class will open in the developer console and it will show the covered lines in blue color. The lines which have not been covered get highlighted in red color.

Not the answer you're looking for? Browse other questions tagged .