You need to sign in to do that
Don't have an account?
Manish Kumar 23
Deleting Class in Production getting Code coverage Error
Hi All,
When I am trying to Deleted Class from Production I am getting error
Average test coverage accross all apex classes and trigger is 58% at least 75% test coverage is required. Please see below snapshot
When I am trying to Deleted Class from Production I am getting error
Average test coverage accross all apex classes and trigger is 58% at least 75% test coverage is required. Please see below snapshot
Below are the steps:
1) From Force.com IDE, select the class that you want to delete (Look for .xml extension )
2) Open that .xml version of your class and change the Status tag to Deleted.
3) Right click and save the file.
4) Now select "SRC" folder and right click--->Select Force.com---> select Deploy to server
5) Log into your production org and follow the steps.
Note: if you have any test class for the class that you are deleting make sure you do the same like above and then select those 2 classes for final deployment.
Hope it helps.
Please choose as best answer
Thanks:)
This test class is associated with class while you are trying to delete the test class, salesforce running all tests and the coverage of the class is not fulfilled.
you have to replace the test class or may I know the reason to remove the test class?
So it would be easier to understand?
Thanks:)
We are in a process of cleaning up the unwanted class, trigger in SFDC and because of that I am performing this activity.
You can leave the trigger/class enabled but comment the entire code in the trigger/class (in sandbox) and deploy it.
Hopefully there would be a test class creating / updating / deleting (depends on action of trigger/class) records in a test class, so that would cover your trigger as 100%.
If not then you just need to write a small test class of 3-4 lines to create a record of the object and that's it.
You have a trigger/class in Production that does nothing and is 100% covered.
Commenting the code also helps, if you ever want to uncomment the code back.
If you deploy the fully commented code trigger and its test class (ie if test class is required), then during deployment, it will pick the version in the changeset.
(Its a workaround, but solves the problem of not required trigger).