function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Emmanuel RajakumarEmmanuel Rajakumar 

test fails when deploy

Hi, 

Appreciate any help. We can't deploy our Apex class and trigger as some of the existing Apex test are failing. I believe it is required to run test on all classes. Any way around this? The failed test consists of both managed scripts and custom scripts created on our first implementation of Salesforce by a vendor. How can I find out if there's any impact if we remove these scripts?
AnjunaAnjuna
Hi Emmanuel,
See the below screenshot.
User-added image
By selecting Run Specified Test , you can specify the testclasses that needs to run during validation. Add the test classes of apex classes and triggers in your new change set and validate it. It will not run existing test classes in production org. After successful validation go for quick Deployment. Hope this will work for you.
Maciej BucholcMaciej Bucholc
You need to remember tough, that when you running specified test, each class must have at leat 75% coverage.
If you remove test classes your coverage will drop.
Emmanuel RajakumarEmmanuel Rajakumar
Hi Anjuna,

How do we get the screenshot above?
 
AnjunaAnjuna
Hi Emmanuel,
When you deploy your changeset, there is one buton to validate the changeset. It will redirect you to the above page where you can specify the test option.
Maciej BucholcMaciej Bucholc
For example when you're deploying Change Set, Salesforce will show you that window.
Emmanuel RajakumarEmmanuel Rajakumar
User-added image

When I clicked validate deployment, it auto launch the validation without having the window form(as your screenshot) for me to choose. Can I find in the browser directly? Or is this the validate button you mean?
AnjunaAnjuna
You can find the validate button in browser . Try to deploy changeset directly through browser without using IDE and let me know if there are any issues.
Vinuthh SVinuthh S
Hi Emmanuel

Use the Run Specified Tests option in the production, give the Test class name in the Box and run only the particular test class and deploy it.

Thanks 
Vinuthh S