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
finalistfinalist 

Deploy Validation test coverage lower than Sandbox test coverage

I have a custom controller and associated VF page that I am trying to deploy, and in the sandbox my Unit Test coverage for the class is showing as 97%.  All of my data is defined in the Unit Test.

 

When I go through the deployment validation in the Force.com IDE, the validation fails because it is only showing 47% test coverage of the same class.

 

All of the unit tests are defined in a single test class, and I am including the test class, the VF pages that it uses, and the controller (as all of the items) in my deployment.

 

There are triggers that also impact the test, but the lowest coverage on any of them is 75%, and the Code Coverage Total in the sandbox summary is 92%.

 

Any thoughts as to what might be causing the discrepancy between the sandbox test results and the IDE deployment wizard's test results? 

bob_buzzardbob_buzzard

When I've seen this before its because of unit test failures.  Is there any data in the production org that could be interfering with your test results (e.g more than the expected number of objects retrieved in a query because of pre-existing data?).

 

I've found it useful in the past to add system.debug statements throughout my tests and turn on debug logging for the user I'm deploying as.  Then I've been able to get some idea of how far through my tests I'm getting. 

finalistfinalist

Thanks, I'll take a look at that!

 

I have been using debug statements, and I ran into issues such as you describe when the data (such as recordtypes *ahem*) doesn't exist in production yet, but in those cases the Deployment Validation returns specific line numbers and the Unit Test failure messages.  The errors thrown up then do not indicate a lack of code coverage, but that there are test failures.

 

I'd really like to know where 50% of my code coverage up and went off to ... 

 

 

JuanBessJuanBess

If you run your unit test with Eclipse, you will see all the line numbers of the uncovered code.

Before, you can see the uncovered lines numbers if you run the unit test from the browser, but now, they remove that feature.... so, the only way that you have to know exactly the lines is eclipse.

 

J.