+ Start a Discussion
Dave Scott (UK)Dave Scott (UK) 

Need help deploying Apex Class

Hi folks,

Please help!?

I'm not a developer and never deployed anything from Sandbox to Production and i've just joined a new company and they have an Apex Class (not written by me) that I need to make some very minor changes to (just need to add three lines of code to a Class that is already 688 lines long).

I've succesfully added the three lines of code to the Apex Class in Sandbox and the class now seems to do what it's suppose to do and works without any issues.

The problem I have now is Deploying it and this is where I'd like some help.

Here's what i've done so far:
1. Refreshed Sandbox, Logged into Sandbox, edited the Apex Class, Saved it, tested functionality - all ok
2. In Sandbox Setup, select Apex Test Execution and run the test on the original Test Class which has NOT been edited and it passes Test 1 & 2
3. Create new Outbound Change Set and add the Apex Class that i've made changes to but add no dependancies as no changes have been made to them.
4. Upload the Change Set
5. Log in to production org, locate the change set under Inbound Change Sets, select Deploy and select to run specified tests choosing the same test used when using the 'Apex Test Execution'
6. Deployment fails saying it only covers 63% of the code.

Why is this when running test in Sandox seems to be fine?

I also tried modifying the test class in sandbox and again run the 'Apex Test Execution' function under setup and all is fine, however when I try to upload both the updated test class and the updated Apex class, I'm still getting the same error.

Please help me understand how I can get this Apex Class deployed into production.

As I mentioned I'm not a developer so would appreciate step by step directions if possible of where I might be going wrong.

Many thanks,

harshad kokateharshad kokate
Try with option "deploy with specific test class "
find any test class which is having good enough test coverage select that test class and deploy with it .


you need to improve the oevrall coverage which means take 2 3 clasees from prod make their coverage more than 80-85 and try deployment with all those test classes .