1

Do we have an option to call another trigger methods in a test class.I have a trigger been written by a developer and i couldnot find the test class written but it shows a code coverage of 46% .enter image description here

enter image description here

Any help very much appreciated.

4
  • 1
    Open the trigger in the developer console and there is a drop down showing you what the class's coverage is and where it's got it from.
    – Girbot
    Feb 26, 2016 at 7:07
  • @Girbot:Thanks for your response.Is it the code coverage drop down your talking out.PFA screen shot or else Can u help me out with screenshot. Feb 26, 2016 at 7:14
  • Yes I was referring to the screenshot you have added. I would guess it doesn't have a specific test class for it as all those classes get 46%.
    – Girbot
    Feb 26, 2016 at 7:19
  • @Girbot:Thanks.My concern is without the test class ,how is it showing the code coverage and how did their move the class into production.I facing an issue with many triggers.I need to deploy a code which was a minute change in aline but unable to do so.Any help very much appreciated. Feb 26, 2016 at 7:25

1 Answer 1

0

All triggers are active when a test class runs. So if an unrelated test updates an Account as part of its test setup, the Account update trigger will run and gain code coverage. This gives the impression that the Account update trigger is being tested but in reality just some of its code is being run but the outcomes of that code are likely not being verified (i.e. no specific asserts).

If I was you I would add an explicit test for that Account trigger that includes asserts for the expected results.

The trigger could have been moved into production as long as it had at least 1% coverage and the overall code set had at least 75% coverage i.e. the low coverage for one class or trigger can be made up for by high coverage in another class or trigger. (46% for the overall code set would not be enough.)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .