+ Start a Discussion

Apex class with no test class


I am trying to deploy some code from a sandbox to production but I'm getting the error message that my companys code coverage is 74%.

When I check one of the apex classes in my change set - it has the code coverage of 44% but it doesn't have any test class associated with it.
Is it possible to increase this code coverage for the apex class without creating a test class (this deployment has been the only one to return the error)? Can I add something into the class so that I could increase the coverage to 55% - does commenting count or using system.debug?

Tarun SuriTarun Suri
Hi RadDude89,
There is no other way to deploy a class without test class. Here are the Best Practices to get code coverage more than 75%

The reason your code is 44% covred is because of other test claesses. If there are existing test class that test a method or function on the same object, it is possible that you can get some amout of coverge. But unless you have a test class for each and every apex code it may not be fully covred.