0

I have two classes on production org that is like a default class (supersort and TrialCustomerPortalHomePageController), but does not have code coverage at all. So because of that I'm not able to even do a destructive deploy to delete these classes. I've tried to use Visual Studio Code and Workbench. This is the error that I'm seeing in VSCode: INVALID_OPERATION : testLevel of NoTestRun cannot be used in production organizations.

4
  • When you delete a class, a unit tests are run for all of the remaining classes, and there should be sufficient amount of coverage for those, which remain
    – kurunve
    Commented Aug 4, 2020 at 11:58
  • I only have these two classes in production.
    – user86980
    Commented Aug 4, 2020 at 12:06
  • Read the answer on this post here: salesforce.stackexchange.com/questions/291695/… You will need to deploy destructive changes
    – nbrown
    Commented Aug 4, 2020 at 13:19
  • Change the apex classes to test classes by adding the @isTest annotation to the top and deploy that to production. Then you should be able to delete using workbench since there is no test coverage requirement with test classes.
    – Zach
    Commented Aug 6, 2020 at 20:16

1 Answer 1

-1

http://mysalesforcestuff.blogspot.com/2018/10/100-test-class-coverage-when-commenting.html http://carvingintheclouds.blogspot.com/2013/12/deploying-destructive-changes-using.html

  1. In sandbox, replace code in class that has no code coverage with few lines of dummy code
  2. In sandbox, create test class to cover few lines of dummy code
  3. Deploy class and test class from sandbox to production using 'Run specified Tests'
  4. Deploy destructive changes to sandbox and production using Workbench (use 'Run Specified Tests')

My class:

public class ClassWithNoCoverage{
    public static String ClassWithNoCoverageMethod(){
       String myString = 'Hello World';
       return myString;
    }
}

My test class:

@isTest
private class ClassWithNoCoverageTest{
    static testMethod void testCommented(){
        Test.StartTest();
        system.assertEquals('Hello World',ClassWithNoCoverage.ClassWithNoCoverageMethod());   
        Test.StopTest();
    }
}

You must log in to answer this question.

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