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
Med Usa1Med Usa1 

A test class for a trigger

Hello,

 

I would like to know when a trigger is deployed, is the test class already used ? Or it's only used during the deployment ?

As I have a pb with a deployed trigger and its test class to deploy another trigger, I was thinking I could inactivate the test class already deployed by Eclipse ? Can you confirm me if my idea is correct ?

Thank you.

 

steve456steve456

When you write a test class ......It doesnt mean you test class is only for that particular trigger

 

Test class checks for code coverage of  all triggers on that object

 

 

Med Usa1Med Usa1

So can I desactivate this test class to deploy my trigger ? Or it's dangerous ?

steve456steve456

To deploy a trigger

 

Deploy both trigger and test class into production

 

 

Med Usa1Med Usa1

Yes I know but :

I have 2 triggers and 2 test classes on opportunity : one is already deployed and another is to deploy.

 

The trigger to deploy has an error during the deployment due to the test class of the first trigger already deployed.

So I was thinking to desactivate the test class of the trigger already deployed to try to deploy the new trigger.

 

Thank you.

craigmhcraigmh

Yeah, any Apex Trigger/Class has to have at least 75% code coverage by active test methods when you deploy from your sandbox instance to your production instance.

Med Usa1Med Usa1

So can I desactivate the test class already deployed to deploy my new trigger ?