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
Robert Robinson 48Robert Robinson 48 

Apex Code coverage 0% in production, while the controller and test are identical to UAT, which shows >90% coverage

I have 5 Controllers which affect opportunities. Each has a test which provides > 90% code coverage in UAT. When I look in production, these tests provide 0% code coverage when the Controllers and related tests are identical between UAT and production. General question is what could cause these tests to fail given the success in UAT and the artifacts promote successfully to production?
Best Answer chosen by Robert Robinson 48
Andrew GAndrew G
Perhaps clear the Test History in Production, recompile the classes and then rerun all tests and see how you go.

Reference:
https://help.salesforce.com/articleView?id=000332406&type=1&mode=1

Regards
Andrew

All Answers

Christan G 4Christan G 4
Hi Robert, I hope you are well. What error do you receive when you run the test classes in Production?
Andrew GAndrew G
Perhaps clear the Test History in Production, recompile the classes and then rerun all tests and see how you go.

Reference:
https://help.salesforce.com/articleView?id=000332406&type=1&mode=1

Regards
Andrew
This was selected as the best answer
Ravi Dutt SharmaRavi Dutt Sharma
Maybe check if you seeAllData=true in your test classes.
Robert Robinson 48Robert Robinson 48
Recompile did the trick. Thanks.