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.
1 Answer
http://mysalesforcestuff.blogspot.com/2018/10/100-test-class-coverage-when-commenting.html http://carvingintheclouds.blogspot.com/2013/12/deploying-destructive-changes-using.html
- In sandbox, replace code in class that has no code coverage with few lines of dummy code
- In sandbox, create test class to cover few lines of dummy code
- Deploy class and test class from sandbox to production using 'Run specified Tests'
- 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();
}
}
@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.