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
mharikian1.3892229047844834E12mharikian1.3892229047844834E12 

Code Coverage on class only shows 1 test covering the class when I have 5 unit tests against it

I have two class:
OpportunityLineItemTriggers
OpportunityLineItemTriggers_Test

In the developer console, I run the test class of which there are 5 and all of them check out as green. Yet the code coverage remains very low on the class. When I open up the OpportunityLineItemTriggers class and select Code Coverage, it's only showing that it ran one test, and it's the last one in the list.

Has anyone else run into this problem, and if so, how can I get the Code Coverage to be cumulative across all of the tests in the test class?
Best Answer chosen by mharikian1.3892229047844834E12
mharikian1.3892229047844834E12mharikian1.3892229047844834E12
No I can't. There are over 1500 lines of code between those classes, and there are other triggers and classes such as Opportunities, Accounts, Contacts which also run. What I'm wondering is why only the last running test is showing up as the one that covers the class when I have 5 test methods. I ran the unit tests again, and each time the Code Coverage showed only one test method running against the class, I commented out that test method and ran the unit tests again. There ended up being two test methods which I had to comment out, and then when I ran the unit tests again, the remaining 3 showed up in the Code Coverage drop down. 

I'll have to look at the two I commented out to see how they are affecting the other unit tests and why they are not showing up as cumulative.

Thanks for the reply.

All Answers

sandeep sankhlasandeep sankhla
Hey,

Can you share your trigger and testcode which you haev and it is not covering ?
 
mharikian1.3892229047844834E12mharikian1.3892229047844834E12
No I can't. There are over 1500 lines of code between those classes, and there are other triggers and classes such as Opportunities, Accounts, Contacts which also run. What I'm wondering is why only the last running test is showing up as the one that covers the class when I have 5 test methods. I ran the unit tests again, and each time the Code Coverage showed only one test method running against the class, I commented out that test method and ran the unit tests again. There ended up being two test methods which I had to comment out, and then when I ran the unit tests again, the remaining 3 showed up in the Code Coverage drop down. 

I'll have to look at the two I commented out to see how they are affecting the other unit tests and why they are not showing up as cumulative.

Thanks for the reply.
This was selected as the best answer