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
ag415ag415 

Test class testing wrong trigger

Hello,

I am trying to run a test class to test a new trigger I've written that deals with the contacts object. I already have a separate trigger written which deals with accounts, and I have a separate test class for that trigger which I already ran in the past. However, I noticed that whenver I run my contact trigger test class, it seems to be testing the wrong trigger? Every time I run it, the only trigger that shows up in the "overall code coverage" window is the old accounts trigger. I even went as far as backing up the accounts trigger and the accounts trigger test class and then deleting them from my sandbox altogether, and even now, despite this, every time I try to run the contacts trigger test class it still shows the name of the old accounts trigger in the overall code coverage window, with no mention of the contact trigger at all. Is this some kind of bug in the developer console?
ag415ag415
Just an update, it appears that it IS testing the contacts trigger, but for whatever odd reason, the developer console is renaming my contact trigger to the account trigger's name. Very bizarre. Has anyone else experienced this issue?
logontokartiklogontokartik
Hmm. Very interesting, can you post a screenshot of what exactly you are seeing. Also can you verify the debug logs to see if your trigger is being fired? In the test class please make sure you have asserts after you insert data as well. 
ag415ag415
Here are some screenshots illustrating the problem:

Developer console window showing incorrect name of trigger
Figure 1 - Developer console showing incorrect name of trigger

Detail view of trigger in Salesforce
Figure 2 - Detail view of trigger in Salesforce showing same results as reported in developer console, except with the correct trigger name