0

we want to check our org test coverage excluding managed package test classes. we checked by clicking Run All Test Classes in Setup -> Apex Classes -> Run All Test.

It's showing 61% but i am able to deploy the component there is no failure to deploy the code in prod.

But my concern is deploying is only valid if we have more that 75%. please tell us the viable solution to get the actual test coverage of the prod.

2
  • Did you perform "Run all test" in org? After running the same you would get the exact % of code coverage. Generally code coverage calculated on deployment or package creation is not stored in Salesforce. – Prasanna Sep 26 '16 at 10:54
  • yes, i performed Run All test in org and got 61% of code coverage. – lokesh kumar Sep 26 '16 at 15:56
0

You can do this in Developer console. In query Editor run this query and check the tooling API checkbox.

SELECT PercentCovered FROM ApexOrgWideCoverage 

Or for a particular class How many lines are covered for a specific class or trigger:

SELECT NumLinesCovered, NumLinesUncovered FROM ApexCodeCoverage WHERE ApexClassOrTriggerId = // class Id

Which lines are covered for a specific class or trigger:

SELECT Coverage FROM ApexCodeCoverage WHERE ApexClassOrTriggerId =// class Id

Reliable ways to calculate Overall Code Coverage in salesforce

3
  • SELECT PercentCovered FROM ApexOrgWideCoverage it's showing me same 61%. – lokesh kumar Sep 26 '16 at 9:19
  • @lokeshkumar run all test classes and then check. – Tushar Sharma Sep 26 '16 at 10:28
  • the above code coverage i got through Run All Test classes – lokesh kumar Sep 26 '16 at 15:55
0

If I am not wrong the test doesn't cover VFComponents and Pages. I guess your component doesn't have a controller and hence its not failing. Try deploying a class, I guess it won't let you deploy one.

2
  • you are correct but i am able to deploy class and trigger as well – lokesh kumar Sep 26 '16 at 15:55
  • is the org in trial ? – Avidev9 Sep 26 '16 at 18:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.