-1

Code Coverage for Class A in Dev org is 95 % , but for the same class it's 0% in Production . Compared the class and the test class and they are both identical in both the environments.

Have done Run all tests .

What can be the reason?

5
  • 4
    tough to answer without seeing the class & test class Jun 8, 2015 at 11:33
  • 1
    seealldata would be the first thing I would look at. Your test should be creating all the data that it needs and not rely on any data from the org.
    – BarCotter
    Jun 8, 2015 at 11:38
  • @BarCotter Yes the test class doesnot have seealldata=true. It creates all test data within the class itself. Jun 8, 2015 at 11:44
  • 2
    We would need to see the class and test class to help further.
    – BarCotter
    Jun 8, 2015 at 11:46
  • Are you sure in production test class doesn't get failed?
    – highfive
    Jun 8, 2015 at 13:01

2 Answers 2

2

Are you going between Spring '15 and Summer '15 orgs? The code coverage calculation for multi-line statements changed in Summer - http://releasenotes.docs.salesforce.com/en-us/summer15/release-notes/rn_apex_expressions_coverage.htm

0

One possible reason could be that you are trying to use specific Ids. Ids can sometimes differ between your prod and sandbox environment.

It is hard to tell what your problem is without seeing the classes.

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