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
benwrigleybenwrigley 

Force.com IDE and coverage warnings

Hi All,

 

Apologies if this has already been covered over and over but I cannot figure it out! I'm trying to be really good about code coverage and even when I think I've got 100% the IDE still complains.

 

I have a few triggers and a few classes and each one has a corresponding test class:

 

Class1

Class1Test

Class2

Class2Test

Trigger1

Trigger1Test

Trigger2

Trigger2Test

 

If I right click on Class1Test and choose 'run tests', the results come back that Class1 is 100% covered but the Triggers are woefully uncovered.

 

If I right click on Trigger1Test and choose 'run tests', the results come back that Trigger1 is 100% covered but others (inc. Class1) are poorly covered.

 

It all seems a bit random to me :(

 

Any thoughts?

 

TIA

dkadordkador

When you right click on a class and choose run tests, it's only runs the tests *in that class*.  If you right-click on the project you should see an option to run ALL your tests, which should give you a comprehensive view of your test coverage.

benwrigleybenwrigley

Ah yes, that works thanks. Not entirely clear why the other behaviour occurs when testing a single class though. Thanks for your  help.

dkadordkador

If it only runs the tests in the class you selected, you're only going to get coverage from the tests in that class.

benwrigleybenwrigley

Which makes sense. But why does it complain about poor coverage *only* on my triggers and not my other classes that I'm not testing right now?

SomeshSomesh

We are currently looking into an issue around running tests from the IDE, we'll see if this is related.